gerrit/polygerrit-ui
David Ostrovsky ac88bd0fa8 PolyGerrit: Make ES6 to ES5 transpilation actually work
Bump rules_closure version to this commit[1], that allows us to pass
--force_inject_library=es6_runtime to closure compiler, that fixes
missing injection of ES6 dependency with optimization level whitespace.

One side effect of this change: because of the recently made change in
rules_closure rules of how the external dependencies are consumed, we
cannot reuse some common dependencies that were already fetched during
gerrit build and must re-fetch them again, most notably:

* asm
* gson
* guava
* guice
* soy

The bad news here is, that re-fetching takes place with rules_closure's
java_import_external rule, that is not using our own download_file.py
utility and thus the artifacts are not cached in ~/.gerritcodereview
directory, so that when the build is repeated on the same machine but on
different clone of gerrit repository all rules_closure dependencies
are going to be re-fetched again.

Another complication of re-fetching is that the different versions of
the artifacts are now fetched: e.g. Gerrit is using guava 21, and
closure rule is using guava 20. The reason why we don't have the
collision here is because gerrit mounts this dependency under @guava
directory, whereas rules_closure is using canonical artifact name, so
that we get:

* external/com_google_guava/guava-20.0.jar # fetched by rules_closure
* external/guava/jar/guava-21.0.jar # fetched by gerrit

Test Plan:

1. conduct ES6 modification, e.g. apply this CL: [2]
2. run bazel build gerrit
3. verify that transpiled code actually work

[1] f68d4b5a55
[2] https://gerrit-review.googlesource.com/105104

Bug: Issue 6110
Change-Id: I3f3adf8ce5e613d45d1d0684b823e48e68a14080
2017-05-15 17:00:02 +09:00
..
app PolyGerrit: Make ES6 to ES5 transpilation actually work 2017-05-15 17:00:02 +09:00
.gitattributes Add the skeleton of a new UI based on Polymer, PolyGerrit 2015-11-09 22:01:28 +00:00
.gitignore Serve fonts from Gerrit instead of Google Fonts. 2016-04-01 13:11:02 -04:00
BUILD Bazel: Reformat build files 2016-12-07 11:33:07 +00:00
README.md Fix polygerrit.war path when building PolyGerrit with Bazel 2017-01-23 14:38:00 -08:00
run-server.sh Don't hardcode /bin/bash 2017-03-03 08:12:45 -06:00
server.go Add CLI flag to run-server.go for local plugins 2017-02-09 09:09:27 -08:00
wct.conf.js Add the skeleton of a new UI based on Polymer, PolyGerrit 2015-11-09 22:01:28 +00:00

README.md

PolyGerrit

Installing Node.js

# Debian/Ubuntu
sudo apt-get install nodejs-legacy

# OS X with Homebrew
brew install node

All other platforms: download from nodejs.org.

Installing Bazel

Follow the instructions here to get and install Bazel.

Local UI, Production Data

This is a quick and easy way to test your local changes against real data. Unfortunately, you can't sign in, so testing certain features will require you to use the "test data" technique described below.

Installing go

This is required for running the run-server.sh script below.

# Debian/Ubuntu
sudo apt-get install golang

# OS X with Homebrew
brew install go

All other platforms: download from golang.org

Then add go to your path:

PATH=$PATH:/usr/local/go/bin

Running the server

To test the local UI against gerrit-review.googlesource.com:

./run-server.sh

Then visit http://localhost:8081

Local UI, Test Data

One-time setup:

  1. Build Gerrit
  2. Set up a local test site. Docs here and here.

When your project is set up and works using the classic UI, run a test server that serves PolyGerrit:

bazel build polygerrit && \
java -jar bazel-bin/polygerrit.war daemon --polygerrit-dev \
-d ../gerrit_testsite --console-log --show-stack-trace

Running Tests

One-time setup:

# Debian/Ubuntu
sudo apt-get install npm

# OS X with Homebrew
brew install npm

# All platforms (including those above)
sudo npm install -g web-component-tester

Run all web tests:

./polygerrit-ui/app/run_test.sh

If you need to pass additional arguments to wct:

WCT_ARGS='-p --some-flag="foo bar"' ./polygerrit-ui/app/run_test.sh

For interactively working on a single test file, do the following:

./polygerrit-ui/run-server.sh

Then visit http://localhost:8081/elements/foo/bar_test.html

Style guide

We follow the Google JavaScript Style Guide with a few exceptions. When in doubt, remain consistent with the code around you.