diff --git a/.github/ci_support/test_closure-compiler-npm.sh b/.github/ci_support/test_closure-compiler-npm.sh
index 779ff6c4566..57544008df4 100755
--- a/.github/ci_support/test_closure-compiler-npm.sh
+++ b/.github/ci_support/test_closure-compiler-npm.sh
@@ -20,7 +20,7 @@
# - PWD = closure-compiler-npm repo root
#
# Params:
-# 1. File name of compiler_unshaded_deploy.jar
+# 1. File name of compiler_uberjar_deploy.jar
function main() {
local compiler_jar="$1"
diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index baac2f86164..31eab42b9db 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -63,7 +63,7 @@ jobs:
# upload-artifact doesn't support paths with symlinks
run: |
mkdir -p ${{ env.UNSYMLINK_DIR }}
- cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/compiler_unshaded_deploy.jar
+ cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/compiler_uberjar_deploy.jar
cp -t ${{ env.UNSYMLINK_DIR }} bazel-bin/*_bundle.jar
# Share the following files with other jobs in this workflow. They can be grabbed using ID
@@ -74,7 +74,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: unshaded_compiler
- path: ${{ env.UNSYMLINK_DIR }}/compiler_unshaded_deploy.jar
+ path: ${{ env.UNSYMLINK_DIR }}/compiler_uberjar_deploy.jar
if-no-files-found: error
# If this build will be uploadaded as a SNAPSHOT, share the Sonatype bundles with the other
@@ -128,7 +128,7 @@ jobs:
path: compiler/bazel-bin
- name: Test closure-compiler-npm
- run: compiler/.github/ci_support/test_closure-compiler-npm.sh compiler/bazel-bin/compiler_unshaded_deploy.jar
+ run: compiler/.github/ci_support/test_closure-compiler-npm.sh compiler/bazel-bin/compiler_uberjar_deploy.jar
deploy-snapshots:
name: Deploy Snapshot Bundles to Sonatype
diff --git a/BUILD.bazel b/BUILD.bazel
index 952a851ebde..a70d1dda7e5 100644
--- a/BUILD.bazel
+++ b/BUILD.bazel
@@ -44,9 +44,9 @@ sonatype_artifact_bundle(
sonatype_artifact_bundle(
name = "compiler_unshaded_bundle",
artifact_id = "closure-compiler-unshaded",
- jar = ":compiler_unshaded_deploy.jar",
+ jar = ":compiler_unshaded",
javadoc = ":compiler_lib_no_runtime_libs.javadoc",
- pom = "maven/closure-compiler-unshaded.pom.xml",
+ pom = ":compiler_unshaded-pom",
sources = ":compiler_lib_no_runtime_libs.sources",
)
@@ -71,16 +71,28 @@ sonatype_artifact_bundle(
jar_jar(
name = "compiler_shaded",
- input_jar = ":compiler_unshaded_deploy.jar",
+ input_jar = ":compiler_uberjar_deploy.jar",
rules = "rules.jarjar",
)
java_binary(
- name = "compiler_unshaded",
+ name = "compiler_uberjar",
main_class = "com.google.javascript.jscomp.CommandLineRunner",
runtime_deps = [":compiler_lib"],
)
+# Produce an unshaded export jar based on :compiler_lib
+load("@rules_jvm_external//:defs.bzl", "java_export")
+version = "$(COMPILER_VERSION)" or "1.0-SNAPSHOT"
+java_export(
+ name = "compiler_unshaded",
+ maven_coordinates = "com.google.javascript:closure-compiler-unshaded:{0}".format(version),
+ runtime_deps = [
+ "//:compiler_lib",
+ ],
+ pom_template = "maven/closure-compiler-unshaded.pom.xml.tpl"
+)
+
java_binary(
name = "linter",
main_class = "com.google.javascript.jscomp.LinterMain",
@@ -173,7 +185,7 @@ oss_java_library(
"@com_google_errorprone_error_prone_annotations",
"@com_google_guava_failureaccess//jar",
"@com_google_guava_guava//jar",
- "@com_google_protobuf//:protobuf_java",
+ "@maven//:com_google_protobuf_protobuf_java",
"@com_google_re2j_re2j",
"@google_bazel_common//third_party/java/auto:value",
"@org_apache_ant_ant",
@@ -238,7 +250,7 @@ gen_java_tests(
"@com_google_guava_guava//jar",
"@com_google_guava_guava_testlib//jar",
"@com_google_jimfs_jimfs",
- "@com_google_protobuf//:protobuf_java",
+ "@maven//:com_google_protobuf_protobuf_java",
"@com_google_re2j_re2j",
"@com_google_truth_extensions_truth_liteproto_extension",
"@com_google_truth_extensions_truth_proto_extension",
diff --git a/README.md b/README.md
index 3bb1ce5a3b2..3b11a852310 100644
--- a/README.md
+++ b/README.md
@@ -259,7 +259,7 @@ you're most comfortable with.
### Building from a terminal
```bash
-$ bazelisk build //:compiler_unshaded_deploy.jar
+$ bazelisk build //:compiler_uberjar_deploy.jar
# OR to build everything
$ bazelisk build :all
```
@@ -292,7 +292,7 @@ directory. You can access it with a call to `java -jar ...` or by using the
package.json script:
```bash
-# java -jar bazel-bin/compiler_unshaded_deploy.jar [...args]
+# java -jar bazel-bin/compiler_uberjar_deploy.jar [...args]
yarn compile [...args]
```
diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel
index cbaa888b0be..261a572de97 100644
--- a/WORKSPACE.bazel
+++ b/WORKSPACE.bazel
@@ -12,6 +12,12 @@ http_archive(
url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG,
)
+load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
+rules_jvm_external_deps()
+
+load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
+rules_jvm_external_setup()
+
#
# To update google_bazel_common, locate the git commit to depend on and
# use something like the following to determine the sha256
@@ -164,3 +170,15 @@ http_archive(
load("@com_github_johnynek_bazel_jar_jar//:jar_jar.bzl", "jar_jar_repositories")
jar_jar_repositories()
+
+# Declare protobuf-java from maven central, so the unshaded maven jar can recognize external dependencies
+load("@rules_jvm_external//:defs.bzl", "maven_install")
+maven_install(
+ artifacts = [
+ "com.google.protobuf:protobuf-java:3.19.3",
+ ],
+ repositories = [
+ "https://repo1.maven.org/maven2",
+ ],
+ strict_visibility = True,
+)
diff --git a/maven/closure-compiler-unshaded.pom.xml b/maven/closure-compiler-unshaded.pom.xml.tpl
similarity index 97%
rename from maven/closure-compiler-unshaded.pom.xml
rename to maven/closure-compiler-unshaded.pom.xml.tpl
index 6c09ef8f693..ca5ea5bfb4a 100644
--- a/maven/closure-compiler-unshaded.pom.xml
+++ b/maven/closure-compiler-unshaded.pom.xml.tpl
@@ -43,4 +43,7 @@
0.3-SNAPSHOT
closure-compiler-main.pom.xml
+
+{dependencies}
+
diff --git a/package.json b/package.json
index 78ec64adf40..dd6e9516adc 100644
--- a/package.json
+++ b/package.json
@@ -19,6 +19,6 @@
"jsdom": "^16.3.0"
},
"scripts": {
- "compile": "java -jar bazel-bin/compiler_unshaded_deploy.jar"
+ "compile": "java -jar bazel-bin/compiler_uberjar_deploy.jar"
}
}