Skip to content

Commit

Permalink
Fix website, fix google#545
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkprime committed Jul 23, 2018
1 parent 53f40c4 commit 5451e55
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -129,9 +129,11 @@ libjsonnet++.so: $(LIB_CPP_OBJ)
# JavaScript build of C binding
JS_EXPORTED_FUNCTIONS = 'EXPORTED_FUNCTIONS=["_jsonnet_make", "_jsonnet_evaluate_snippet", "_jsonnet_fmt_snippet", "_jsonnet_ext_var", "_jsonnet_ext_code", "_jsonnet_tla_var", "_jsonnet_tla_code", "_jsonnet_realloc", "_jsonnet_destroy", "_jsonnet_import_callback"]'

JS_RUNTIME_METHODS = 'EXTRA_EXPORTED_RUNTIME_METHODS=["cwrap", "_free", "getValue", "lengthBytesUTF8", "_malloc", "Pointer_stringify", "setValue", "stringToUTF8", "addFunction"]'


libjsonnet.js: $(LIB_SRC) $(ALL_HEADERS)
$(EMCXX) -s $(JS_EXPORTED_FUNCTIONS) $(EMCXXFLAGS) $(LDFLAGS) $(LIB_SRC) -o $@
$(EMCXX) -s WASM=0 -s $(JS_EXPORTED_FUNCTIONS) -s $(JS_RUNTIME_METHODS) $(EMCXXFLAGS) $(LDFLAGS) $(LIB_SRC) -o $@

# Copy javascript build to doc directory
doc/js/libjsonnet.js: libjsonnet.js
Expand Down
2 changes: 1 addition & 1 deletion doc/js/demo.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ let ctx_mapping = { };
let ctx_counter = 1;

// We don't use ctx, instead just rely on Javascript's cloure environment.
let import_callback = Runtime.addFunction(function (ctx_, base_, rel_, found_here_, success_) {
let import_callback = addFunction(function (ctx_, base_, rel_, found_here_, success_) {
let vm = ctx_mapping[ctx_].vm
let files = ctx_mapping[ctx_].files
let base = Module.Pointer_stringify(base_);
Expand Down
5 changes: 5 additions & 0 deletions tools/scripts/push_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ if [ ! -r 'doc/_config.yml' ]; then
exit 1
fi

if [ ! -r 'doc/js/libjsonnet.js' ]; then
echo 'Cannot push as docs/js/libjsonnet.js has not been built.' >&1
exit 1
fi

working_dir=$1
if [ -z "$working_dir" ]; then
working_dir=$(mktemp -d "/tmp/jsonnet_gh_pages_XXXX")
Expand Down

0 comments on commit 5451e55

Please sign in to comment.