![]() 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]
|
||
---|---|---|
.. | ||
app | ||
.gitattributes | ||
.gitignore | ||
BUILD | ||
README.md | ||
run-server.sh | ||
server.go | ||
wct.conf.js |
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:
- Build Gerrit
- 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.