Skip to content

Commit

Permalink
Merge #323
Browse files Browse the repository at this point in the history
323: Remove `node.sh`. r=reitermarkus a=reitermarkus



Co-authored-by: Markus Reiter <[email protected]>
  • Loading branch information
bors[bot] and reitermarkus authored Sep 19, 2019
2 parents c183ee3 + 33372b0 commit 139d454
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 50 deletions.
3 changes: 0 additions & 3 deletions docker/Dockerfile.wasm32-unknown-emscripten
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ RUN apt-get install -y --no-install-recommends python
COPY emscripten.sh /
RUN bash /emscripten.sh

COPY node.sh /
RUN bash /node.sh

COPY emscripten-entry.sh /
ENTRYPOINT ["/emscripten-entry.sh"]

Expand Down
39 changes: 20 additions & 19 deletions docker/node-wasm
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#!/bin/bash
#!/usr/bin/env bash

path="$(dirname $1)"
file="$(basename $1)"
set -e

# Workaround for
# https://github.com/kripken/emscripten/issues/4542

# Consider a project with this struct
# Consider a project with this structure:
#
# ├── src
# │   ├── bin
# │   │   └── prog.rs
Expand All @@ -16,32 +16,33 @@ file="$(basename $1)"
# ├── examples
# │   └── a.rs
# └── tests
# └── t.rs
#     └── t.rs
#
# We expect that the artifacts will be generated in
# (where ? = release or debug)
#
# target/wasm32-unknown-emscripten/?/deps/
# for tests and benches
# `target/wasm32-unknown-emscripten/{debug,release}/deps/`
# (for tests and benches)
#
# target/wasm32-unknown-emscripten/?/examples/
# `target/wasm32-unknown-emscripten/{debug,release}/examples/`
# for examples
#
# target/wasm32-unknown-emscripten/?/
# for main programs (main.rs and bin/*.rs)
# `target/wasm32-unknown-emscripten/{debug,release}/`
# for main programs (`main.rs` and `bin/*.rs`)
#
# Because of https://github.com/kripken/emscripten/issues/4542
# the script must be executed from where the dependencies are.

path="$(dirname "${1}")"
file="$(basename "${1}")"
base="$(basename "${path}")"

base="$(basename $path)"
if [ "$base" != "deps" -a "$base" != "examples" ]; then
# main programs requeries the artifacts in $path/deps
cd "$path/deps"
exec /node-*/bin/node "../$file"
if [[ "${base}" != "deps" ]] && [[ "${base}" != "examples" ]]; then
# main programs requeries the artifacts in `${path}/deps`
cd "${path}/deps"
exec node "../${file}"
else
# all deps of tests, benches and examples are in $path dir
cd "$path"
exec /node-*/bin/node "$file"
# all deps of tests, benches and examples are in `${path}` dir
cd "${path}"
exec node "${file}"
fi

28 changes: 0 additions & 28 deletions docker/node.sh

This file was deleted.

0 comments on commit 139d454

Please sign in to comment.