interpret ELM_FLAGS correctly

master
Brian Hicks 2020-05-14 17:02:19 -05:00
parent 48f4f4bd10
commit 9e9e1ba22e
4 changed files with 6 additions and 8 deletions

View File

@ -11,7 +11,7 @@ stdenv.mkDerivation {
buildInputs = [ elmPackages.elm ninja nodePackages.uglify-js ]; buildInputs = [ elmPackages.elm ninja nodePackages.uglify-js ];
buildPhase = '' buildPhase = ''
./script/ninja.sh > build.ninja ./script/ninja.sh > build.ninja
env ELM_HOME=.elm ninja env ELM_HOME=.elm ELM_FLAGS= ninja
''; '';
installPhase = "cp -r dist/ $out/"; installPhase = "cp -r dist/ $out/";

View File

@ -1,9 +1,9 @@
script/ninja.sh { script/ninja.sh {
prep: ./script/ninja.sh > build.ninja && ninja prep: ./script/ninja.sh > build.ninja && env ELM_FLAGS=--debug ninja
} }
src/** vendor/** { src/** vendor/** {
prep: ninja prep: env ELM_FLAGS=--debug ninja
} }
dist/** { dist/** {

View File

@ -4,14 +4,14 @@ set -euo pipefail
IN="${1:-}" IN="${1:-}"
OUT="${2:-}" OUT="${2:-}"
FLAGS="${@:3}" ELM_FLAGS="${ELM_FLAGS:-}"
if test -z "$IN" || test -z "$OUT"; then if test -z "$IN" || test -z "$OUT"; then
echo "usage: ${0:-} src/Main.elm dist/elm.js --optimize" echo "usage: ${0:-} src/Main.elm dist/elm.js --optimize"
exit 1 exit 1
fi fi
elm make "$FLAGS" --output="$OUT" "$IN" elm make $ELM_FLAGS --output="$OUT" "$IN"
# change the cmpiled elm file to not immediately call the compiled function # change the cmpiled elm file to not immediately call the compiled function
sed -i 's/(function(scope/function init(scope/g' "$OUT" sed -i 's/(function(scope/function init(scope/g' "$OUT"

View File

@ -4,10 +4,8 @@ set -eou pipefail
ELM_FILES="$(find src -name '*.elm')" ELM_FILES="$(find src -name '*.elm')"
cat <<EOF cat <<EOF
elmFlags=--debug
rule elm rule elm
command = ./script/elm-make-module.sh \$in \$out \$elmFlags command = ./script/elm-make-module.sh \$in \$out
rule es6ify rule es6ify
command = ./script/es6ify.sh \$in \$export > \$out command = ./script/es6ify.sh \$in \$export > \$out