Skip to content

Commit ad59642

Browse files
authored
fix(bazel): use param file for compile (#1373)
* fixes issues on windows when dealing with many dependencies causing a 'command line too long' error
1 parent 176dec4 commit ad59642

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+280
-1
lines changed

bazel/emscripten_toolchain/toolchain.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,16 @@ def _impl(ctx):
346346
provides = ["variant:crosstool_build_mode"],
347347
),
348348

349+
# Feature to prevent 'command line too long' issues
350+
feature(
351+
name = "archive_param_file",
352+
enabled = True,
353+
),
354+
feature(
355+
name = "compiler_param_file",
356+
enabled = True,
357+
),
358+
349359
#### User-settable features
350360

351361
# Set if enabling exceptions.
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
load("@emsdk//emscripten_toolchain:wasm_rules.bzl", "wasm_cc_binary")
2+
3+
_TEST_TARGETS = [
4+
"long_command_line_file01",
5+
"long_command_line_file02",
6+
"long_command_line_file03",
7+
"long_command_line_file04",
8+
"long_command_line_file05",
9+
"long_command_line_file06",
10+
"long_command_line_file07",
11+
"long_command_line_file08",
12+
"long_command_line_file09",
13+
"long_command_line_file10",
14+
"long_command_line_file11",
15+
"long_command_line_file12",
16+
"long_command_line_file13",
17+
"long_command_line_file14",
18+
"long_command_line_file15",
19+
"long_command_line_file16",
20+
"long_command_line_file17",
21+
"long_command_line_file18",
22+
"long_command_line_file19",
23+
"long_command_line_file20",
24+
]
25+
26+
_TEST_TARGET_SUFFIXES = [
27+
"a",
28+
"b",
29+
"c",
30+
"d",
31+
"e",
32+
"f",
33+
"g",
34+
"h",
35+
"i",
36+
"j",
37+
]
38+
39+
[cc_library(
40+
name = "{}_{}".format(target, suffix),
41+
hdrs = ["include/{}.hh".format(target)],
42+
# stripping include prefix to create more flags passed to emcc
43+
strip_include_prefix = "include",
44+
srcs = ["{}.cc".format(target)],
45+
) for target in _TEST_TARGETS for suffix in _TEST_TARGET_SUFFIXES]
46+
47+
cc_binary(
48+
name = "long_command_line",
49+
linkshared = True,
50+
srcs = ["long_command_line.cc"],
51+
deps = [":{}_{}".format(target, suffix) for target in _TEST_TARGETS for suffix in _TEST_TARGET_SUFFIXES],
52+
)
53+
54+
wasm_cc_binary(
55+
name = "long_command_line_wasm",
56+
cc_target = ":long_command_line",
57+
outputs = [
58+
"long_command_line.js",
59+
"long_command_line.wasm",
60+
],
61+
)
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f1();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f2();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f3();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f4();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f5();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f6();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f7();
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
#pragma once
2+
3+
void f8();

0 commit comments

Comments
 (0)