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:
		
				
					committed by
					
						
						David Pursehouse
					
				
			
			
				
	
			
			
			
						parent
						
							ca826ec8de
						
					
				
				
					commit
					ac88bd0fa8
				
			
							
								
								
									
										21
									
								
								WORKSPACE
									
									
									
									
									
								
							
							
						
						
									
										21
									
								
								WORKSPACE
									
									
									
									
									
								
							@@ -6,9 +6,9 @@ load("//plugins:external_plugin_deps.bzl", "external_plugin_deps")
 | 
			
		||||
 | 
			
		||||
http_archive(
 | 
			
		||||
    name = "io_bazel_rules_closure",
 | 
			
		||||
    strip_prefix = "rules_closure-0.4.1",
 | 
			
		||||
    sha256 = "ba5e2e10cdc4027702f96e9bdc536c6595decafa94847d08ae28c6cb48225124",
 | 
			
		||||
    url = "http://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/0.4.1.tar.gz",
 | 
			
		||||
    sha256 = "af1f5a31b8306faed9d09a38c8e2c1d6afc4c4a2dada3b5de11cceae8c7f4596",
 | 
			
		||||
    strip_prefix = "rules_closure-f68d4b5a55c04ee50a3196590dce1ca8e7dbf438",
 | 
			
		||||
    url = "https://bazel-mirror.storage.googleapis.com/github.com/bazelbuild/rules_closure/archive/f68d4b5a55c04ee50a3196590dce1ca8e7dbf438.tar.gz",  # 2017-05-05
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
# File is specific to Polymer and copied from the Closure Github -- should be
 | 
			
		||||
@@ -24,18 +24,9 @@ load("@io_bazel_rules_closure//closure:defs.bzl", "closure_repositories")
 | 
			
		||||
 | 
			
		||||
# Prevent redundant loading of dependencies.
 | 
			
		||||
closure_repositories(
 | 
			
		||||
    omit_aopalliance=True,
 | 
			
		||||
    omit_args4j=True,
 | 
			
		||||
    omit_jsr305=True,
 | 
			
		||||
    omit_gson=True,
 | 
			
		||||
    omit_guava=True,
 | 
			
		||||
    omit_guice=True,
 | 
			
		||||
    omit_soy=True,
 | 
			
		||||
    omit_icu4j=True,
 | 
			
		||||
    omit_asm=True,
 | 
			
		||||
    omit_asm_analysis=True,
 | 
			
		||||
    omit_asm_commons=True,
 | 
			
		||||
    omit_asm_util=True,
 | 
			
		||||
    omit_aopalliance = True,
 | 
			
		||||
    omit_args4j = True,
 | 
			
		||||
    omit_javax_inject = True,
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
ANTLR_VERS = "3.5.2"
 | 
			
		||||
 
 | 
			
		||||
@@ -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"],
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user