From e1f7833e7cb335ff3774f6b9ed466e2e645f11aa Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Mon, 22 Apr 2019 22:55:23 +0200 Subject: [PATCH] Force the compilation mode for tests to fastbuild. We can't use 'opt', because that trims out certain features needed by the unit testing framework. Using 'dbg' also doesn't make sense, because the time traveling debugger isn't usable in this context. --- elm/def.bzl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/elm/def.bzl b/elm/def.bzl index 33f1dd4..b73763f 100644 --- a/elm/def.bzl +++ b/elm/def.bzl @@ -8,6 +8,7 @@ _TOOLCHAIN = "@com_github_edschouten_rules_elm//elm:toolchain" def _do_elm_make( ctx, + compilation_mode, main, deps, additional_source_directories, @@ -55,7 +56,7 @@ def _do_elm_make( executable = "python", arguments = [ ctx.files._compile[0].path, - ctx.var["COMPILATION_MODE"], + compilation_mode, toolchain.elm.files.to_list()[0].path, elm_json.path, main.path, @@ -69,11 +70,13 @@ def _do_elm_make( def _elm_binary_impl(ctx): js_file = ctx.actions.declare_file(ctx.attr.name + ".js") - if ctx.var["COMPILATION_MODE"] == "opt": + compilation_mode = ctx.var["COMPILATION_MODE"] + if compilation_mode == "opt": # Step 1: Compile the Elm code. js1_file = ctx.actions.declare_file(ctx.attr.name + ".1.js") _do_elm_make( ctx, + compilation_mode, ctx.files.main[0], ctx.attr.deps, [], @@ -117,6 +120,7 @@ def _elm_binary_impl(ctx): # Don't attempt to compress the code after building. _do_elm_make( ctx, + compilation_mode, ctx.files.main[0], ctx.attr.deps, [], @@ -216,6 +220,7 @@ def _elm_test_impl(ctx): elmi_file = ctx.actions.declare_file(elmi_filename) _do_elm_make( ctx, + "fastbuild", ctx.files.main[0], ctx.attr.deps, [], @@ -246,6 +251,7 @@ def _elm_test_impl(ctx): js_file = ctx.actions.declare_file(ctx.attr.name + ".js") _do_elm_make( ctx, + "fastbuild", main_file, ctx.attr.deps + [ctx.attr._node_test_runner], [ctx.files.main[0].dirname],