Skip to content

Commit 4c16bd2

Browse files
authored
Stop bundling binaryen.js builds (#1609)
Instead, we point users to the bot @dcodeIO has, see #1571 This is useful because otherwise every change to binaryen.js requires bundling a build here, which is more work for contributors (and also grows the git repo over time). We still keep a bundled build of wasm.js. We use that for testing of the interpreter currently, and emscripten depends on it. Eventually wasm2asm may replace that. In any case, wasm.js builds are required far less frequently than binaryen.js.
1 parent ac306cb commit 4c16bd2

File tree

7 files changed

+34
-226
lines changed

7 files changed

+34
-226
lines changed

CMakeLists.txt

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,15 @@ TARGET_LINK_LIBRARIES(binaryen passes wasm asmjs emscripten-optimizer ir cfg sup
167167
INSTALL(TARGETS binaryen DESTINATION ${CMAKE_INSTALL_LIBDIR})
168168

169169
INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
170-
INSTALL(FILES bin/wasm.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
171-
INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
170+
171+
# if binaryen.js and wasm.js were built (using "./build-js.sh", currently
172+
# optional), install them
173+
IF(EXISTS "bin/binaryen.js")
174+
INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
175+
ENDIF()
176+
IF(EXISTS "bin/wasm.js")
177+
INSTALL(FILES bin/wasm.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
178+
ENDIF()
172179

173180
SET(wasm-shell_SOURCES
174181
src/tools/wasm-shell.cpp

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ This repository contains code that builds the following tools in `bin/`:
6767
* **wasm-ctor-eval**: A tool that can execute C++ global constructors ahead of time. Used by Emscripten.
6868
* **wasm-emscripten-finalize**: Takes a wasm binary produced by llvm+lld and performs emscripten-specific passes over it.
6969
* **wasm.js**: wasm.js contains Binaryen components compiled to JavaScript, including the interpreter, `asm2wasm`, the S-Expression parser, etc., which allow you to use Binaryen with Emscripten and execute code compiled to WASM even if the browser doesn't have native support yet. This can be useful as a (slow) polyfill.
70-
* **binaryen.js**: A standalone JavaScript library that exposes Binaryen methods for [creating and optimizing WASM modules](https://github.com/WebAssembly/binaryen/blob/master/test/binaryen.js/hello-world.js).
70+
* **binaryen.js**: A standalone JavaScript library that exposes Binaryen methods for [creating and optimizing WASM modules](https://github.com/WebAssembly/binaryen/blob/master/test/binaryen.js/hello-world.js). For builds, see [binaryen.js on npm](https://www.npmjs.com/package/binaryen) (or download it directly from [github](https://raw.githubusercontent.com/AssemblyScript/binaryen.js/master/index.js), [rawgit](https://cdn.rawgit.com/AssemblyScript/binaryen.js/master/index.js), or [unpkg](https://unpkg.com/binaryen@latest/index.js)).
7171

7272
Usage instructions for each are below.
7373

auto_update_tests.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
from scripts.test.shared import (
2424
ASM2WASM, MOZJS, NODEJS, WASM_OPT, WASM_AS, WASM_DIS,
2525
WASM_CTOR_EVAL, WASM_MERGE, WASM_REDUCE, WASM2ASM, WASM_METADCE,
26-
WASM_EMSCRIPTEN_FINALIZE, BINARYEN_INSTALL_DIR,
27-
files_with_pattern, has_shell_timeout)
26+
WASM_EMSCRIPTEN_FINALIZE, BINARYEN_INSTALL_DIR, BINARYEN_JS,
27+
files_with_pattern, has_shell_timeout, options)
2828
from scripts.test.wasm2asm import tests, spec_tests, extra_wasm2asm_tests, assert_tests, wasm2asm_dir
2929

3030

@@ -196,7 +196,7 @@ def update_bin_fmt_tests():
196196
def update_example_tests():
197197
print '\n[ checking example testcases... ]\n'
198198
for t in sorted(os.listdir(os.path.join('test', 'example'))):
199-
output_file = os.path.join('bin', 'example')
199+
output_file = os.path.join(options.binaryen_bin, 'example')
200200
libdir = os.path.join(BINARYEN_INSTALL_DIR, 'lib')
201201
cmd = ['-Isrc', '-g', '-pthread', '-o', output_file]
202202
if t.endswith('.txt'):
@@ -290,6 +290,11 @@ def update_wasm_merge_tests():
290290

291291
def update_binaryen_js_tests():
292292
if not (MOZJS or NODEJS):
293+
print 'no vm to run binaryen.js tests'
294+
return
295+
296+
if not os.path.exists(BINARYEN_JS):
297+
print 'no binaryen.js build to test'
293298
return
294299

295300
print '\n[ checking binaryen.js testcases... ]\n'
@@ -299,7 +304,7 @@ def update_binaryen_js_tests():
299304
continue
300305
print s
301306
f = open('a.js', 'w')
302-
f.write(open(os.path.join('bin', 'binaryen.js')).read())
307+
f.write(open(BINARYEN_JS).read())
303308
if NODEJS:
304309
f.write(node_test_glue())
305310
test_path = os.path.join('test', 'binaryen.js', s)

bin/binaryen.js

Lines changed: 0 additions & 216 deletions
This file was deleted.

bin/readme.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This directory is empty until the native tools or .js builds are generated. This file makes sure it exists in git.

check.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
from scripts.test.support import run_command, split_wast, node_test_glue, node_has_webassembly
2323
from scripts.test.shared import (
24-
BIN_DIR, EMCC, MOZJS, NATIVECC, NATIVEXX, NODEJS,
24+
BIN_DIR, EMCC, MOZJS, NATIVECC, NATIVEXX, NODEJS, BINARYEN_JS,
2525
WASM_AS, WASM_CTOR_EVAL, WASM_OPT, WASM_SHELL, WASM_MERGE, WASM_METADCE,
2626
WASM_DIS, WASM_REDUCE, binary_format_check, delete_from_orbit, fail, fail_with_error,
2727
fail_if_not_identical, fail_if_not_contained, has_vanilla_emcc,
@@ -404,10 +404,16 @@ def fix(x):
404404

405405

406406
def run_binaryen_js_tests():
407-
if not MOZJS and not NODEJS:
407+
if not (MOZJS or NODEJS):
408+
print 'no vm to run binaryen.js tests'
408409
return
410+
409411
node_has_wasm = NODEJS and node_has_webassembly(NODEJS)
410412

413+
if not os.path.exists(BINARYEN_JS):
414+
print 'no binaryen.js build to test'
415+
return
416+
411417
print '\n[ checking binaryen.js testcases... ]\n'
412418

413419
for s in sorted(os.listdir(os.path.join(options.binaryen_test, 'binaryen.js'))):
@@ -419,7 +425,7 @@ def run_binaryen_js_tests():
419425
f.write('''
420426
console.warn = function(x) { console.log(x) };
421427
''')
422-
binaryen_js = open(os.path.join(options.binaryen_root, 'bin', 'binaryen.js')).read()
428+
binaryen_js = open(BINARYEN_JS).read()
423429
f.write(binaryen_js)
424430
if NODEJS:
425431
f.write(node_test_glue())
@@ -560,6 +566,10 @@ def run_gcc_torture_tests():
560566

561567

562568
def run_emscripten_tests():
569+
if not os.path.exists(os.path.join(options.binaryen_bin, 'wasm.js')):
570+
print 'no wasm.js build to test'
571+
return
572+
563573
print '\n[ checking wasm.js methods... ]\n'
564574

565575
for method_init in ['interpret-asm2wasm', 'interpret-s-expr', 'asmjs', 'interpret-binary', 'asmjs,interpret-binary', 'interpret-binary,asmjs']:

scripts/test/shared.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,7 @@ def is_exe(fpath):
174174
WASM_METADCE = [os.path.join(options.binaryen_bin, 'wasm-metadce')]
175175
WASM_EMSCRIPTEN_FINALIZE = [os.path.join(options.binaryen_bin,
176176
'wasm-emscripten-finalize')]
177+
BINARYEN_JS = os.path.join(options.binaryen_bin, 'binaryen.js')
177178

178179

179180
def wrap_with_valgrind(cmd):

0 commit comments

Comments
 (0)