Skip to content

Commit

Permalink
Stop bundling binaryen.js builds (#1609)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kripken committed Jul 4, 2018
1 parent ac306cb commit 4c16bd2
Show file tree
Hide file tree
Showing 7 changed files with 34 additions and 226 deletions.
11 changes: 9 additions & 2 deletions CMakeLists.txt
Expand Up @@ -167,8 +167,15 @@ TARGET_LINK_LIBRARIES(binaryen passes wasm asmjs emscripten-optimizer ir cfg sup
INSTALL(TARGETS binaryen DESTINATION ${CMAKE_INSTALL_LIBDIR})

INSTALL(FILES src/binaryen-c.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
INSTALL(FILES bin/wasm.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})

# if binaryen.js and wasm.js were built (using "./build-js.sh", currently
# optional), install them
IF(EXISTS "bin/binaryen.js")
INSTALL(FILES bin/binaryen.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
ENDIF()
IF(EXISTS "bin/wasm.js")
INSTALL(FILES bin/wasm.js DESTINATION ${CMAKE_INSTALL_DATADIR}/${PROJECT_NAME})
ENDIF()

SET(wasm-shell_SOURCES
src/tools/wasm-shell.cpp
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -67,7 +67,7 @@ This repository contains code that builds the following tools in `bin/`:
* **wasm-ctor-eval**: A tool that can execute C++ global constructors ahead of time. Used by Emscripten.
* **wasm-emscripten-finalize**: Takes a wasm binary produced by llvm+lld and performs emscripten-specific passes over it.
* **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.
* **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).
* **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)).

Usage instructions for each are below.

Expand Down
13 changes: 9 additions & 4 deletions auto_update_tests.py
Expand Up @@ -23,8 +23,8 @@
from scripts.test.shared import (
ASM2WASM, MOZJS, NODEJS, WASM_OPT, WASM_AS, WASM_DIS,
WASM_CTOR_EVAL, WASM_MERGE, WASM_REDUCE, WASM2ASM, WASM_METADCE,
WASM_EMSCRIPTEN_FINALIZE, BINARYEN_INSTALL_DIR,
files_with_pattern, has_shell_timeout)
WASM_EMSCRIPTEN_FINALIZE, BINARYEN_INSTALL_DIR, BINARYEN_JS,
files_with_pattern, has_shell_timeout, options)
from scripts.test.wasm2asm import tests, spec_tests, extra_wasm2asm_tests, assert_tests, wasm2asm_dir


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

def update_binaryen_js_tests():
if not (MOZJS or NODEJS):
print 'no vm to run binaryen.js tests'
return

if not os.path.exists(BINARYEN_JS):
print 'no binaryen.js build to test'
return

print '\n[ checking binaryen.js testcases... ]\n'
Expand All @@ -299,7 +304,7 @@ def update_binaryen_js_tests():
continue
print s
f = open('a.js', 'w')
f.write(open(os.path.join('bin', 'binaryen.js')).read())
f.write(open(BINARYEN_JS).read())
if NODEJS:
f.write(node_test_glue())
test_path = os.path.join('test', 'binaryen.js', s)
Expand Down
216 changes: 0 additions & 216 deletions bin/binaryen.js

This file was deleted.

1 change: 1 addition & 0 deletions bin/readme.txt
@@ -0,0 +1 @@
This directory is empty until the native tools or .js builds are generated. This file makes sure it exists in git.
16 changes: 13 additions & 3 deletions check.py
Expand Up @@ -21,7 +21,7 @@

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


def run_binaryen_js_tests():
if not MOZJS and not NODEJS:
if not (MOZJS or NODEJS):
print 'no vm to run binaryen.js tests'
return

node_has_wasm = NODEJS and node_has_webassembly(NODEJS)

if not os.path.exists(BINARYEN_JS):
print 'no binaryen.js build to test'
return

print '\n[ checking binaryen.js testcases... ]\n'

for s in sorted(os.listdir(os.path.join(options.binaryen_test, 'binaryen.js'))):
Expand All @@ -419,7 +425,7 @@ def run_binaryen_js_tests():
f.write('''
console.warn = function(x) { console.log(x) };
''')
binaryen_js = open(os.path.join(options.binaryen_root, 'bin', 'binaryen.js')).read()
binaryen_js = open(BINARYEN_JS).read()
f.write(binaryen_js)
if NODEJS:
f.write(node_test_glue())
Expand Down Expand Up @@ -560,6 +566,10 @@ def run_gcc_torture_tests():


def run_emscripten_tests():
if not os.path.exists(os.path.join(options.binaryen_bin, 'wasm.js')):
print 'no wasm.js build to test'
return

print '\n[ checking wasm.js methods... ]\n'

for method_init in ['interpret-asm2wasm', 'interpret-s-expr', 'asmjs', 'interpret-binary', 'asmjs,interpret-binary', 'interpret-binary,asmjs']:
Expand Down
1 change: 1 addition & 0 deletions scripts/test/shared.py
Expand Up @@ -174,6 +174,7 @@ def is_exe(fpath):
WASM_METADCE = [os.path.join(options.binaryen_bin, 'wasm-metadce')]
WASM_EMSCRIPTEN_FINALIZE = [os.path.join(options.binaryen_bin,
'wasm-emscripten-finalize')]
BINARYEN_JS = os.path.join(options.binaryen_bin, 'binaryen.js')


def wrap_with_valgrind(cmd):
Expand Down

0 comments on commit 4c16bd2

Please sign in to comment.