Skip to content

Commit

Permalink
Update readme, poms, and deploy script for first release
Browse files Browse the repository at this point in the history
  • Loading branch information
niloc132 committed Nov 4, 2023
1 parent 1d04521 commit c580422
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 19 deletions.
27 changes: 27 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<upstream-tag>-<release-count>`, where the `<upstream-tag>` is the tag that
Google released, followed by `<release-count>`, 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
Expand Down
4 changes: 2 additions & 2 deletions bazel/sonatype_artifact_bundle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
40 changes: 35 additions & 5 deletions deploy.sh
Original file line number Diff line number Diff line change
@@ -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 -
Expand Down
30 changes: 18 additions & 12 deletions maven/closure-compiler-parent.pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@
<name>Closure Compiler Parent</name>
<version>0.3-SNAPSHOT</version>

<url>https://github.com/google/closure-compiler/</url>
<url>https://github.com/vertispan/closure-compiler/</url>
<description>
Closure Compiler is a JavaScript optimizing compiler. It parses your
JavaScript, 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. 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.
</description>
<inceptionYear>2009</inceptionYear>

Expand All @@ -42,31 +47,32 @@

<scm>
<connection>
scm:git:https://github.com/google/closure-compiler.git
scm:git:https://github.com/vertispan/closure-compiler.git
</connection>
<developerConnection>
scm:git:[email protected]:google/closure-compiler.git
scm:git:[email protected]:vertispan/closure-compiler.git
</developerConnection>
<url>
https://github.com/google/closure-compiler
https://github.com/vertispan/closure-compiler
</url>
</scm>

<issueManagement>
<system>code.google.com</system>
<url>http://github.com/google/closure-compiler/issues</url>
<system>GitHub Issues</system>
<url>http://github.com/vertispan/closure-compiler/issues</url>
</issueManagement>

<organization>
<name>Google</name>
<url>http://www.google.com</url>
</organization>

<developers>
<developer>
<id>closure-compiler-authors</id>
<name>Closure Compiler Authors</name>
<email>[email protected] </email>
<email>[email protected]</email>
</developer>
<developer>
<name>Colin Alworth</name>
<email>[email protected]</email>
<organization>Vertispan LLC</organization>
<organizationUrl>https://www.vertispan.com/</organizationUrl>
</developer>
</developers>

Expand Down

0 comments on commit c580422

Please sign in to comment.