Skip to content

Commit 02787f7

Browse files
authored
Fix Windows CI (#4)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent bc27bef commit 02787f7

3 files changed

Lines changed: 21 additions & 2 deletions

File tree

.gitattributes

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
* text=auto
2+
*.cc text eol=lf
3+
*.h text eol=lf
4+
*.json text eol=lf
5+
*.ts text eol=lf
16
/vendor/** linguist-generated=true

src/generator/include/sourcemeta/codegen/generator_typescript.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,18 @@ class SOURCEMETA_CODEGEN_GENERATOR_EXPORT TypeScript {
2626
auto operator()(const IRUnion &entry) const -> void;
2727

2828
private:
29+
// Exporting symbols that depends on the standard C++ library is considered
30+
// safe.
31+
// https://learn.microsoft.com/en-us/cpp/error-messages/compiler-warnings/compiler-warning-level-2-c4275?view=msvc-170&redirectedfrom=MSDN
32+
#if defined(_MSC_VER)
33+
#pragma warning(disable : 4251)
34+
#endif
2935
// NOLINTNEXTLINE(cppcoreguidelines-avoid-const-or-ref-data-members)
3036
std::ostream &output;
3137
std::string_view prefix;
38+
#if defined(_MSC_VER)
39+
#pragma warning(default : 4251)
40+
#endif
3241
};
3342

3443
} // namespace sourcemeta::codegen

test/e2e/typescript/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ target_link_libraries(sourcemeta_codegen_e2e_typescript_unit
99
target_compile_definitions(sourcemeta_codegen_e2e_typescript_unit
1010
PRIVATE E2E_TYPESCRIPT_PATH="${CMAKE_CURRENT_SOURCE_DIR}")
1111

12+
if(WIN32)
13+
set(TSC_BIN "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc.cmd")
14+
else()
15+
set(TSC_BIN "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc")
16+
endif()
17+
1218
set(E2E_SCHEMAS "")
1319
file(GLOB TYPESCRIPT_DIALECT_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/*")
1420
foreach(DIALECT_DIRECTORY ${TYPESCRIPT_DIALECT_DIRECTORIES})
@@ -20,8 +26,7 @@ foreach(DIALECT_DIRECTORY ${TYPESCRIPT_DIALECT_DIRECTORIES})
2026
get_filename_component(CASE_NAME ${CASE_DIRECTORY} NAME)
2127
list(APPEND E2E_SCHEMAS "${CASE_DIRECTORY}/schema.json")
2228
add_test(NAME "e2e.typescript.tsc.${DIALECT_NAME}.${CASE_NAME}/expected.d.ts"
23-
COMMAND "${PROJECT_SOURCE_DIR}/node_modules/.bin/tsc" --noEmit
24-
"${CASE_DIRECTORY}/expected.d.ts")
29+
COMMAND "${TSC_BIN}" --noEmit "${CASE_DIRECTORY}/expected.d.ts")
2530
endif()
2631
endforeach()
2732
endif()

0 commit comments

Comments
 (0)