Skip to content

Dynamically generate custom closure compiler for AMP #22452

@rsimha

Description

@rsimha

Now that AMP's closure compiler is at the latest available version (#22446) modulo one awaited bug fix (google/closure-compiler#3041), it's time to think about how to stay there as new releases appear.

Here's my proposed solution:

  1. Wait for ES6 module support for "type-only import" like goog.requireType or TS import type google/closure-compiler#3041 to be fixed. After this, single pass can simply use node_modules/google-closure-compiler-java/compiler.jar with no changes.
  2. Delete third_party/closure-compiler/** and build-system/runner/dist/runner.jar
  3. Check in a copy of ant to third_party/ant/
  4. Whenever gulp dist or gulp check-types are invoked, run a pre-requisite task that generates runner.jar by calling ant clean && ant jar && ant test and makes sure everything worked

Notes:

  • Whenever a new version of closure compiler is released, a renovate PR will automatically test it out by generating a new runner.jar, running gulp check-types, performing a minified build, and running all our tests.
  • If a breaking change appears, we will be alerted by build / test failures, and can make the required changes and move on.
  • We'll no longer need to separately maintain compiler-and-tests.jar since we are no longer using a custom version of compiler.jar. The tests in build-system/runner should be sufficient to verify the custom AMP passes.
  • The speed up gains for multi pass due to nailgun will remain as they are, since we'll continue to re-use a single instance of the dynamically generated runner.jar

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions