From a07a82420f8b26c7636877366a9fcb36722d1c69 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Fri, 30 Aug 2019 07:53:08 +0200 Subject: [PATCH 1/3] PolyGerrit: Run WCT tests using bazelisk If bazelisk is installed, this bazel wrapper should be used to pick the right bazel version specified in the .bazelversion file. Change-Id: I4b5a32a15d190fd5733866dc18bbb1ed27a37f18 --- polygerrit-ui/app/run_test.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/polygerrit-ui/app/run_test.sh b/polygerrit-ui/app/run_test.sh index 22cfcfe8b7..c45428c970 100755 --- a/polygerrit-ui/app/run_test.sh +++ b/polygerrit-ui/app/run_test.sh @@ -12,9 +12,15 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi +bazel_bin=$(which bazelisk >/dev/null 2>&1) +if [[ -z "$bazel_bin" ]]; then + echo "Warning: bazelisk is not installed; falling back to bazel." + bazel_bin=bazel +fi + # WCT tests are not hermetic, and need extra environment variables. # TODO(hanwen): does $DISPLAY even work on OSX? -bazel test \ +${bazel_bin} test \ --test_env="HOME=$HOME" \ --test_env="WCT=${wct_bin}" \ --test_env="WCT_ARGS=${WCT_ARGS}" \ From 7c12542c097e02e70700ac0e530ed6188209190b Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Mon, 15 Jul 2019 09:02:37 +0200 Subject: [PATCH 2/3] Bazel: Adapt docs for custom plugins with external deps After flipping of --incompatible_disallow_load_labels_to_cross_package_boundaries bit in Bazel: [1], currently documented way to import external dependencies from plugins that implement standalone build mode doesn't work any more. This change documents an alternative approach how to make it work, without abandoning of standalone build mode. [1] https://github.com/bazelbuild/bazel/issues/6408 Bug: Issue 10885 Change-Id: I7b1c4e9fa4f6ba8966efcde4cdee7d76d6f59d1c --- Documentation/dev-build-plugins.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Documentation/dev-build-plugins.txt b/Documentation/dev-build-plugins.txt index 072c22c9dc..3e8085733e 100644 --- a/Documentation/dev-build-plugins.txt +++ b/Documentation/dev-build-plugins.txt @@ -122,16 +122,25 @@ CUSTOM_PLUGINS_TEST_DEPS = [ ---- If the plugin(s) being bundled in the release have external dependencies, include them -in `plugins/external_plugin_deps`. You should alias `external_plugin_deps()` so it -can be imported for multiple plugins. For example: +in `plugins/external_plugin_deps`. Create symbolic link from plugin's own +`external_plugin_deps()` file in plugins directory and prefix the file with +plugin name, e.g.: ---- -load(":my-plugin/external_plugin_deps.bzl", my_plugin="external_plugin_deps") -load(":my-other-plugin/external_plugin_deps.bzl", my_other_plugin="external_plugin_deps") + $ cd plugins + $ ln -s oauth/external_plugin_deps.bzl oauth_external_plugin_deps.bzl + $ ln -s uploadvalidator/external_plugin_deps.bzl uploadvalidator_external_plugin_deps.bzl +---- + +Now the plugin specific dependency files can be imported: + +---- +load(":oauth_external_plugin_deps.bzl", oauth_deps="external_plugin_deps") +load(":uploadvalidator_external_plugin_deps.bzl", uploadvalidator_deps="external_plugin_deps") def external_plugin_deps(): - my_plugin() - my_other_plugin() + oauth_deps() + uploadvalidator_deps() ---- [NOTE] From 402274a247a08b3468a8dee09337fadbe768b439 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Mon, 2 Sep 2019 00:38:19 +0200 Subject: [PATCH 3/3] run_test.sh: Fix bazelisk location detection In I4b5a32a15d WCT tests invocation was switched from bazel to bazelisk, but bazelisk location command was wrong. stderr and stdout was erroneously redirected to the /dev/null, so that the actual location of the bazelisk command was lost. Fix the location detection command by redirecting only stderr but not stdout to the null device. Change-Id: I66cb33e0074675e00b0e58bb11413b5151a57533 --- polygerrit-ui/app/run_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/polygerrit-ui/app/run_test.sh b/polygerrit-ui/app/run_test.sh index c45428c970..f450118bb5 100755 --- a/polygerrit-ui/app/run_test.sh +++ b/polygerrit-ui/app/run_test.sh @@ -12,7 +12,7 @@ if [[ -z "$npm_bin" ]]; then exit 1 fi -bazel_bin=$(which bazelisk >/dev/null 2>&1) +bazel_bin=$(which bazelisk 2>/dev/null) if [[ -z "$bazel_bin" ]]; then echo "Warning: bazelisk is not installed; falling back to bazel." bazel_bin=bazel