You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Explicit outputs for wasm_cc_binary
* Backwards compatibility
* data_runfiles restore
* restore test_bazel.sh
* Using wrong path on accident
* two separate rules for legacy support
* Added name attribute to wasm_cc_binary rule
Copy file name to clipboardExpand all lines: bazel/emscripten_toolchain/wasm_binary.py
+21-33Lines changed: 21 additions & 33 deletions
Original file line number
Diff line number
Diff line change
@@ -3,16 +3,9 @@
3
3
This script will take a tar archive containing the output of the emscripten
4
4
toolchain. This file contains any output files produced by a wasm_cc_binary or a
5
5
cc_binary built with --config=wasm. The files are extracted into the given
6
-
output path.
6
+
output paths.
7
7
8
-
The name of archive is expected to be of the format `foo` or `foo.XXX` and
9
-
the contents are expected to be foo.js and foo.wasm.
10
-
11
-
Several optional files may also be in the archive, including but not limited to
12
-
foo.js.mem, pthread-main.js, and foo.wasm.map.
13
-
14
-
If the file is not a tar archive, the passed file will simply be copied to its
15
-
destination.
8
+
The contents of the archive are expected to match the given outputs extnames.
16
9
17
10
This script and its accompanying Bazel rule should allow you to extract a
18
11
WebAssembly binary into a larger web application.
@@ -29,39 +22,34 @@ def ensure(f):
29
22
pass
30
23
31
24
32
-
defcheck(f):
33
-
ifnotos.path.exists(f):
34
-
raiseException('Expected file in archive: %s'%f)
35
-
36
-
37
25
defmain():
38
26
parser=argparse.ArgumentParser()
39
27
parser.add_argument('--archive', help='The archive to extract from.')
40
-
parser.add_argument('--output_path', help='The path to extract into.')
28
+
parser.add_argument('--outputs', help='Comma separated list of files that should be extracted from the archive. Only the extname has to match a file in the archive.')
29
+
parser.add_argument('--allow_empty_outputs', help='If an output listed in --outputs does not exist, create it anyways.', action='store_true')
41
30
args=parser.parse_args()
42
31
43
32
args.archive=os.path.normpath(args.archive)
33
+
args.outputs=args.outputs.split(",")
44
34
45
-
basename=os.path.basename(args.archive)
46
-
stem=basename.split('.')[0]
47
-
48
-
# Extract all files from the tarball.
49
35
tar=tarfile.open(args.archive)
50
-
tar.extractall(args.output_path)
51
-
52
-
# At least one of these two files should exist at this point.
0 commit comments