Skip to content
This repository has been archived by the owner on Dec 10, 2021. It is now read-only.

ampproject/amp-closure-compiler

Repository files navigation

Deprecation Notice

This repo was archived after AMP decided to stop using Closure compiler. See ampproject/amphtml#35264 for more details.

Original Readme Notes

This repo is a fork of the official Google Closure Compiler with added configuration for AMP's specific runners.

You can inspect them under the src directory.

This is not intended to be used outside the AMP Project, and no support is guaranteed.

If you're looking to use Closure Compiler for your project, here are some great places to get started:

  1. https://github.com/ampproject/rollup-plugin-closure-compiler
  2. https://github.com/google/closure-compiler-npm

Local Development Guide

  1. Clone this repo (ampproject/amp-closure-compiler)
    git clone [email protected]:ampproject/amp-closure-compiler.git
  2. Install packages
    cd amp-closure-compiler
    npm install # This will create node_modules/google-closure-compiler-java/compiler.jar
  3. Make your edits
    1. If you want to make changes to Google Closure Compiler itself:
      1. Clone https://github.com/google/closure-compiler/ (google/closure-compiler)
        git clone [email protected]:google/closure-compiler.git
      2. Make your edits to google/closure-compiler
      3. Build google/closure-compiler
      4. Link your built google/closure-compiler to amp-closure-compiler's compiler.jar
        # Run this from your source root directory
        ln -s closure-compiler/bazel-bin/compiler_unshaded_deploy.jar \
        amp-closure-compiler/node_modules/google-closure-compiler-java/compiler.jar
  4. Build amp-closure-compiler
    npm run clean
    npm run build
  5. There should now be several built node modules in amp-closure-compiler's /packages/ directory. You need to link them to them
    for dir in `ls packages/`;
    do;
      cd packages/$dir;
      npm link;
      cd ../..;
    done
  6. In amp-closure-compiler, you need to link these node modules:
    npm link @ampproject/google-closure-compiler
    npm link google-closure-compiler-java
    npm link google-closure-compiler-osx # may fail if you're not on OSX
    npm link google-closure-compiler-linux # may fail if you're not on Linux
    npm link google-closure-compiler-windows # may fail if you're not on Windows