PolyGerrit: Make ES6 to ES5 transpilation actually work

Bump rules_closure version to this commit[1], that allows us to pass
--force_inject_library=es6_runtime to closure compiler, that fixes
missing injection of ES6 dependency with optimization level whitespace.

One side effect of this change: because of the recently made change in
rules_closure rules of how the external dependencies are consumed, we
cannot reuse some common dependencies that were already fetched during
gerrit build and must re-fetch them again, most notably:

* asm
* gson
* guava
* guice
* soy

The bad news here is, that re-fetching takes place with rules_closure's
java_import_external rule, that is not using our own download_file.py
utility and thus the artifacts are not cached in ~/.gerritcodereview
directory, so that when the build is repeated on the same machine but on
different clone of gerrit repository all rules_closure dependencies
are going to be re-fetched again.

Another complication of re-fetching is that the different versions of
the artifacts are now fetched: e.g. Gerrit is using guava 21, and
closure rule is using guava 20. The reason why we don't have the
collision here is because gerrit mounts this dependency under @guava
directory, whereas rules_closure is using canonical artifact name, so
that we get:

* external/com_google_guava/guava-20.0.jar # fetched by rules_closure
* external/guava/jar/guava-21.0.jar # fetched by gerrit

Test Plan:

1. conduct ES6 modification, e.g. apply this CL: [2]
2. run bazel build gerrit
3. verify that transpiled code actually work

[1] f68d4b5a55
[2] https://gerrit-review.googlesource.com/105104

Bug: Issue 6110
Change-Id: I3f3adf8ce5e613d45d1d0684b823e48e68a14080
This commit is contained in:
David Ostrovsky
2017-05-01 23:42:15 +02:00
committed by David Pursehouse
parent ca826ec8de
commit ac88bd0fa8
2 changed files with 10 additions and 19 deletions

View File

@@ -34,10 +34,9 @@ closure_js_library(
name = "closure_lib",
srcs = ["gr-app.js"],
convention = "GOOGLE",
language = "ECMASCRIPT6",
suppress = [
"JSC_BAD_JSDOC_ANNOTATION",
],
# TODO(davido): Clean up these issues: http://paste.openstack.org/show/608548
# and remove this supression
suppress = ["JSC_UNUSED_LOCAL_ASSIGNMENT"],
deps = [
"//lib/polymer_externs:polymer_closure",
"@io_bazel_rules_closure//closure/library",
@@ -52,6 +51,7 @@ closure_js_binary(
defs = [
"--polymer_pass",
"--jscomp_off=duplicate",
"--force_inject_library=es6_runtime",
],
language = "ECMASCRIPT5",
deps = [":closure_lib"],