diff --git a/README.md b/README.md index 4e431f8c876..cfe27d1b03b 100644 --- a/README.md +++ b/README.md @@ -13,6 +13,33 @@ analyzes it, removes dead code and rewrites and minimizes what's left. It also checks syntax, variable references, and types, and warns about common JavaScript pitfalls. +--- + +This is Vertispan LLC's fork of the Closure Compiler targeted to support J2CL, +which includes a few changes from Google's original repository, including: + + * Externs that specifically match various stable versions of Elemental2. + * Sourcemap support for BUNDLE optimization levels. + * Include defines in BUNDLE output. + * Restore the `PersistentInputStore` API - note that with the introduction of + the (experimental) `TypedAst` feature, we may drop this soon. + +As the upstream project undergoes regular tagged releases, the Vertispan +releases in turn will be versioned and tagged to match them, following a pattern +of `-`, where the `` is the tag that +Google released, followed by ``, an integer to increment for each +tagged release - when a new Closure Compiler release is released, the release +count will reset to `1`. Note that not all upstream tags will necessarily get an +associated Vertispan release. Later releases off of the same upstream tag will +then increment that count, should they be needed. + +The release process is to rebase this set of commits, then update the version in +the poms appropriately. When a release is pushed to Maven Central, a tag will +be pushed to our git repository with a matching version. Snapshot releases will +use a `-SNAPSHOT` suffix after the release count. + +--- + ## Getting Started The easiest way to install the compiler is with [NPM](https://npmjs.com) or diff --git a/bazel/sonatype_artifact_bundle.bzl b/bazel/sonatype_artifact_bundle.bzl index 5cfc04053b3..b13f3e91a82 100644 --- a/bazel/sonatype_artifact_bundle.bzl +++ b/bazel/sonatype_artifact_bundle.bzl @@ -42,11 +42,11 @@ def _sonatype_artifact_bundle(ctx): password = None generate_signatures = True - if version == _SNAPSHOT: + if version.endswith("-SNAPSHOT"): # A SNAPSHOT version can't be uploaded as a release # and thus doesn't need to be signed generate_signatures = False - elif not version.startswith("v") or not version[1:].isdigit(): + elif not version.startswith("v"): fail("--define=COMPILER_VERSION was malformed; got '{0}'".format(version)) else: password = _fail_missing_define(ctx, "CLEARTEXT_GPG_PASSPHRASE") diff --git a/deploy.sh b/deploy.sh index 9f05614b4b4..c8a6df51ed6 100755 --- a/deploy.sh +++ b/deploy.sh @@ -1,22 +1,52 @@ -bazel build //:sonatype_bundles -VERSION=0.3-SNAPSHOT +#!/bin/bash + +# Deployment script modeled roughly after upstream's js deployment wiring, +# this file runs the bazel command to produce bundles, then immediately +# unbundles the zip and deploys each artifact. This script differs slightly +# in that it uses gpg:sign-and-deploy-file to handle attaching signatures, +# and only uploads the artifacts that Vertispan is presently interested in. + +set -e + +DEFAULT_DEPLOY_URL=https://repo.vertispan.com/j2cl/ +DEFAULT_DEPLOY_REPO_ID=vertispan-snapshots + +VERSION=${1:-HEAD-SNAPSHOT} +DEPLOY_URL=${2:-$DEFAULT_DEPLOY_URL} +DEPLOY_REPO_ID=${3:-$DEFAULT_DEPLOY_REPO_ID} + +#TODO Find another way to pass in gpg passphrase - apparently +# this is the only way bazel can work with parameters passed +# in? Also, it is unnecessary, since we have to call sign-and-deploy-file +# anyway to let maven upload without manually pushing a +# bundle, so it is unnecessary. +# It might be easier to modify the .bzl instead of supporting +# this, and just have bazel produce the jars+poms. +bazel build //:sonatype_bundles --define=COMPILER_VERSION=$VERSION --define=CLEARTEXT_GPG_PASSPHRASE=$CLEARTEXT_GPG_PASSPHRASE + + +if [ -z "$CLEARTEXT_GPG_PASSPHRASE" ]; then + GOAL="deploy:deploy-file" +else + GOAL="gpg:sign-and-deploy-file" +fi mkdir tmp cd tmp mkdir parent unzip -n ../bazel-bin/closure-compiler-parent_bundle.jar -d parent -mvn deploy:deploy-file -Dfile=parent/pom.xml -DpomFile=parent/pom.xml -Durl=https://repo.vertispan.com/j2cl/ -DrepositoryId=vertispan-snapshots +mvn $GOAL -Dfile=parent/pom.xml -DpomFile=parent/pom.xml -Durl=$DEPLOY_URL -DrepositoryId=$DEPLOY_REPO_ID mkdir main unzip -n ../bazel-bin/closure-compiler-main_bundle.jar -d main -mvn deploy:deploy-file -Dfile=main/pom.xml -DpomFile=main/pom.xml -Durl=https://repo.vertispan.com/j2cl/ -DrepositoryId=vertispan-snapshots +mvn $GOAL -Dfile=main/pom.xml -DpomFile=main/pom.xml -Durl=$DEPLOY_URL -DrepositoryId=$DEPLOY_REPO_ID mkdir unshaded unzip -n ../bazel-bin/closure-compiler-unshaded_bundle.jar -d unshaded -mvn deploy:deploy-file -Dfile=unshaded/closure-compiler-unshaded-${VERSION}.jar -Djavadoc=unshaded/closure-compiler-unshaded-${VERSION}-javadoc.jar -Dsources=unshaded/closure-compiler-unshaded-${VERSION}-sources.jar -DpomFile=unshaded/pom.xml -Durl=https://repo.vertispan.com/j2cl/ -DrepositoryId=vertispan-snapshots +mvn $GOAL -Dfile=unshaded/closure-compiler-unshaded-${VERSION}.jar -Djavadoc=unshaded/closure-compiler-unshaded-${VERSION}-javadoc.jar -Dsources=unshaded/closure-compiler-unshaded-${VERSION}-sources.jar -DpomFile=unshaded/pom.xml -Durl=$DEPLOY_URL -DrepositoryId=$DEPLOY_REPO_ID cd - diff --git a/maven/closure-compiler-parent.pom.xml b/maven/closure-compiler-parent.pom.xml index 66e0bb76466..e44fee94365 100644 --- a/maven/closure-compiler-parent.pom.xml +++ b/maven/closure-compiler-parent.pom.xml @@ -25,7 +25,7 @@ Closure Compiler Parent 0.3-SNAPSHOT - https://github.com/google/closure-compiler/ + https://github.com/vertispan/closure-compiler/ Closure Compiler is a JavaScript optimizing compiler. It parses your JavaScript, analyzes it, removes dead code and rewrites and minimizes @@ -33,6 +33,11 @@ warns about common JavaScript pitfalls. It is used in many of Google's JavaScript apps, including Gmail, Google Web Search, Google Maps, and Google Docs. + This distribution is slightly modified from the original for easier use + with J2CL outside of Bazel by Vertispan LLC. The links and references in + this pom.xml will reference the Vertispan fork, to ensure that any error + introduced by our changes are not incorrectly blamed on the upstream + Google repository. 2009 @@ -42,31 +47,32 @@ - scm:git:https://github.com/google/closure-compiler.git + scm:git:https://github.com/vertispan/closure-compiler.git - scm:git:git@github.com:google/closure-compiler.git + scm:git:git@github.com:vertispan/closure-compiler.git - https://github.com/google/closure-compiler + https://github.com/vertispan/closure-compiler - code.google.com - http://github.com/google/closure-compiler/issues + GitHub Issues + http://github.com/vertispan/closure-compiler/issues - - Google - http://www.google.com - - closure-compiler-authors Closure Compiler Authors - closure-compiler-discuss@googlegroups.com + closure-compiler-discuss@googlegroups.com + + + Colin Alworth + colin@vertispan.com + Vertispan LLC + https://www.vertispan.com/