Support --nolegacy_external_runfiles bazel flag
Update to Bazel 0.18 and rules_nodejs 0.15.3
Closes #309
PiperOrigin-RevId: 218510119
diff --git a/.bazelrc b/.bazelrc
index 1141edf..41e47fa 100644
--- a/.bazelrc
+++ b/.bazelrc
@@ -5,3 +5,7 @@
test:debug --test_arg=--node_options=--inspect-brk --test_output=streamed --test_strategy=exclusive --test_timeout=9999 --nocache_test_results
build --workspace_status_command=./tools/bazel_stamp_vars.sh
+
+# Turn off legacy external runfiles
+run --nolegacy_external_runfiles
+test --nolegacy_external_runfiles
diff --git a/.circleci/config.yml b/.circleci/config.yml
index 2f50695..50afdee 100644
--- a/.circleci/config.yml
+++ b/.circleci/config.yml
@@ -9,8 +9,8 @@
## IMPORTANT
# If you change the `docker_image` version, also change the `cache_key` suffix
-var_1: &docker_image angular/ngcontainer:0.6.0
-var_2: &cache_key rules_typescript-{{ checksum "yarn.lock" }}-0.6.0
+var_1: &docker_image angular/ngcontainer:0.7.0
+var_2: &cache_key rules_typescript-{{ checksum "yarn.lock" }}-0.7.0
var_3: &setup-bazel-remote-cache
run:
name: Start up bazel remote cache proxy
diff --git a/internal/karma/ts_web_test.bzl b/internal/karma/ts_web_test.bzl
index ddb3b02..728b887 100644
--- a/internal/karma/ts_web_test.bzl
+++ b/internal/karma/ts_web_test.bzl
@@ -25,6 +25,12 @@
_CONF_TMPL = "//internal/karma:karma.conf.js"
_DEFAULT_KARMA_BIN = "@npm//@bazel/karma/bin:karma"
+def _short_path_to_manifest_path(ctx, short_path):
+ if short_path.startswith("../"):
+ return short_path[3:]
+ else:
+ return ctx.workspace_name + "/" + short_path
+
def _ts_web_test_impl(ctx):
conf = ctx.actions.declare_file(
"%s.conf.js" % ctx.label.name,
@@ -98,10 +104,6 @@
},
)
- karma_executable_path = ctx.executable.karma.short_path
- if karma_executable_path.startswith(".."):
- karma_executable_path = "external" + karma_executable_path[2:]
-
karma_runfiles = [
conf,
amd_names_shim,
@@ -118,15 +120,15 @@
if [ -e "$RUNFILES_MANIFEST_FILE" ]; then
while read line; do
declare -a PARTS=($line)
- if [ "${{PARTS[0]}}" == "{TMPL_workspace}/{TMPL_karma}" ]; then
+ if [ "${{PARTS[0]}}" == "{TMPL_karma}" ]; then
readonly KARMA=${{PARTS[1]}}
- elif [ "${{PARTS[0]}}" == "{TMPL_workspace}/{TMPL_conf}" ]; then
+ elif [ "${{PARTS[0]}}" == "{TMPL_conf}" ]; then
readonly CONF=${{PARTS[1]}}
fi
done < $RUNFILES_MANIFEST_FILE
else
- readonly KARMA={TMPL_karma}
- readonly CONF={TMPL_conf}
+ readonly KARMA=../{TMPL_karma}
+ readonly CONF=../{TMPL_conf}
fi
export HOME=$(mktemp -d)
@@ -143,8 +145,8 @@
$KARMA ${{ARGV[@]}}
""".format(
TMPL_workspace = ctx.workspace_name,
- TMPL_karma = karma_executable_path,
- TMPL_conf = conf.short_path,
+ TMPL_karma = _short_path_to_manifest_path(ctx, ctx.executable.karma.short_path),
+ TMPL_conf = _short_path_to_manifest_path(ctx, conf.short_path),
),
)
return [DefaultInfo(
diff --git a/package.bzl b/package.bzl
index f2e223e..49848c7 100644
--- a/package.bzl
+++ b/package.bzl
@@ -38,8 +38,8 @@
_maybe(
http_archive,
name = "build_bazel_rules_nodejs",
- urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.15.1.zip"],
- strip_prefix = "rules_nodejs-0.15.1",
+ urls = ["https://github.com/bazelbuild/rules_nodejs/archive/0.15.3.zip"],
+ strip_prefix = "rules_nodejs-0.15.3",
)
# ts_web_test depends on the web testing rules to provision browsers.