diff --git a/.gitattributes b/.gitattributes index f461d46..5cc910b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1 +1,6 @@ +* text=auto +*.cc text eol=lf +*.h text eol=lf +*.json text eol=lf +*.ts text eol=lf /vendor/** linguist-generated=true diff --git a/src/generator/include/sourcemeta/codegen/generator_typescript.h b/src/generator/include/sourcemeta/codegen/generator_typescript.h index 307d307..d359027 100644 --- a/src/generator/include/sourcemeta/codegen/generator_typescript.h +++ b/src/generator/include/sourcemeta/codegen/generator_typescript.h @@ -26,9 +26,18 @@ class SOURCEMETA_CODEGEN_GENERATOR_EXPORT TypeScript { auto operator()(const IRUnion &entry) const -> void; private: +// Exporting symbols that depends on the standard C++ library is considered +// safe. +// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN +#if defined(_MSC_VER) +#pragma warning(disable : 4251) +#endif // NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members) std::ostream &output; std::string_view prefix; +#if defined(_MSC_VER) +#pragma warning(default : 4251) +#endif }; } // namespace sourcemeta::codegen diff --git a/test/e2e/typescript/CMakeLists.txt b/test/e2e/typescript/CMakeLists.txt index b43e1af..dcdfdf9 100644 --- a/test/e2e/typescript/CMakeLists.txt +++ b/test/e2e/typescript/CMakeLists.txt @@ -9,6 +9,12 @@ target_link_libraries(sourcemeta_codegen_e2e_typescript_unit target_compile_definitions(sourcemeta_codegen_e2e_typescript_unit PRIVATE E2E_TYPESCRIPT_PATH="${CMAKE_CURRENT_SOURCE_DIR}") +if(WIN32) + set(TSC_BIN "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc.cmd") +else() + set(TSC_BIN "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc") +endif() + set(E2E_SCHEMAS "") file(GLOB TYPESCRIPT_DIALECT_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/*") foreach(DIALECT_DIRECTORY ${TYPESCRIPT_DIALECT_DIRECTORIES}) @@ -20,8 +26,7 @@ foreach(DIALECT_DIRECTORY ${TYPESCRIPT_DIALECT_DIRECTORIES}) get_filename_component(CASE_NAME ${CASE_DIRECTORY} NAME) list(APPEND E2E_SCHEMAS "${CASE_DIRECTORY}/schema.json") add_test(NAME "e2e.typescript.tsc.${DIALECT_NAME}.${CASE_NAME}/expected.d.ts" - COMMAND "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc" --noEmit - "${CASE_DIRECTORY}/expected.d.ts") + COMMAND "${TSC_BIN}" --noEmit "${CASE_DIRECTORY}/expected.d.ts") endif() endforeach() endif()