Recent Bazel versions support dash character in external repository
names. Consistently use them with one exception: javax_inject. This is
needed to match the name in the rules_closure.
Change-Id: I1e75690fe1ee2ab32fffe07c0c30dbed84753960
Reformat the Bazel build files with the buildifier tool [1].
The style is different for Bazel files. Most notably, indentation level
is 4 spaces instead of 2, and " is used instead of '.
[1] https://github.com/bazelbuild/buildifier
Change-Id: I95c0c6f11b6d76572797853b4ebb5cee5ebd3c98
This lets us associate the jar and the src jar in the java_import()
declaration, so IDE plugins could understand how artifacts and source
are connected.
Classpath generation for Eclipse IDE was adjusted to reflect the changed
location of the source artifact.
Change-Id: I2cf9c6db3ad4b648457f2ac8d380c3771b4a3ee2
gwt_binary() uses Bazel feature to retrieve the sources from the
dependency libraries. For the standalone API this feature cannot be
used as the only dependency is GWT UI plugin API. Expose the sources
in GWT UI plugin API as well.
TEST PLAN:
Apply this change and create the plugin API:
$ ./tools/maven/api.sh install
Apply reviewers plugin Bazel build implementation change: [1] and
verify, that the reviewers plugin can be built with the GWT UI plugin
API created with this change.
[1] https://gerrit-review.googlesource.com/91830
Change-Id: I2b065a8eccbc33020d461834704d684871f463d7
TEST PLAN:
$ bazel build plugins/cookbook-plugin
Deploy to the server site and verify that it works.
Change-Id: I98af807f9c92ba4ed7efad332d8fdee407bb8ce6
Using existing download_file.py from custom maven_jar Skylark rule
gives us the following advantages:
* fetching of sources (needed for GWT JSNI build and IDE integration)
* server support for proxies
* global, per-user cache of artifacts
* support for local maven repository (~/.m2)
Change-Id: Ic246dd9298775a6819f05453c601c688d8cb7ab9
There are number of important changes in this GWT release:
1. HtmlUnit, Jetty and their dependencies upgrade: [1],[2],[3]
2. Unbundled most dependencies from GWT Maven artifacts
With 1. we can remove patched WebServer fork from GWT project, that
was needed to adapt to Jetty 9 version. With 2. we don't need to
strip Jetty classes from gwt-dev artifact any more to avoid classpath
collisions (we wouldn't get classpath collisions to start with because
of 1.). However, because of 2. we need to add quite some dependencies
that we got for granted in gwt-dev in early GWT releases on our own:
* Apache Ant, Apache 2.0 License
* Apache Tapestry, Apache 2.0 License
* CERN colt, CERN own or LGPL License
* Google JS Interop annotations, Apache 2.0 License
* W3C CSS sac library, License W3C IPR SOFTWARE NOTICE
According to the release notes: [4].
Double/Boolean are not boxed anymore
That leads to the NPE when such method:
void showLineEndings(boolean s);
is used with null value:
p.showLineEndings(in.showLineEndings);
where in.showLineEndings is null. Adapt the code to accept
Boolean instead.
gwtjsonrpc is updated to version 1.10 which is built for GWT 2.8.0-rc2.
TEST PLAN:
* Verified that daemon works
* Verified that SDM works
[1] https://github.com/gwtproject/gwt/issues/8712
[2] https://sourceforge.net/p/htmlunit/bugs/1656/
[3] https://gwt-review.googlesource.com/7857
[4] http://www.gwtproject.org/release-notes.html#Release_Notes_2_8_0_RC1
Change-Id: I3f009f3ef0cbb8bafac236fb9a81c951697a5903
To run the tests:
bazel test //...
To build the Gerrit plugin API, run:
bazel build gerrit-plugin-api:plugin-api_deploy.jar
To build the Gerrit extension API, run:
bazel build gerrit-extension-api:extension-api_deploy.jar
TODOs:
Licenses
Reduce visibility (all public for now)
Generate HTML Documentation
Core plugins
gerrit_plugin() rule to build plugins in tree and standalone modes
GWT UI (only gwt_module() skylark rule is provided, no gwt_binary())
PolyGerrit UI
WAR
Publish artifacts to Maven Central
Ask Bazel team to add Gerrit to their CI on ci.bazel.io
Contributed-By: Han-Wen Nienhuys <hanwen@google.com>
Change-Id: I9a86e670882a44a5c966579cdeb8ed79b1590de3
gwt-test-utils is broken [1] and the tests that depend on it have
been disabled for ages.
It doesn't look like there's going to be any new release of a
fixed version, and since Gerrit is moving away from GWT it's not
worth trying to maintain it ourselves.
Remove the disabled tests, and the dependency to gwt-test-utils.
[1] https://github.com/gwt-test-utils/gwt-test-utils/issues/68
Change-Id: If7ae8d5790146ddfad528a1db2f6f6c3ae497970
Since bottom-up to top-down graph traversal switch in Buck, only
first order dependencies are built per default. This leads to a
problem when gerrit is built without --deep option (per default).
Move gwt-dev dependencies to gwt_binary() rules.
The correct fix for this issue would be to model the GWT compiler
as a tool, and ensure that its transitive deps are added as first
order deps of the gwt_binary() rules: [1]. Put this workaround for
now in tree and fix build breakages. We can always improve things
when Buck supports that new model.
Test plan:
* buck clean
* change one of GWT classes
* buck build //gerrit-gwtui:ui_opt
* buck build api_install
[1] https://github.com/facebook/buck/issues/469
Change-Id: I4212ac327acd27f33256c1ba1e86c0b098e07a93
GWT 2.7 dev JAR no longer lists org.json:json as a dep in its pom.xml
file. Instead it requests ow2-asm. Fix the dep list to drop the
difficult org.json:json and put in the requested ow2 JARs.
Move ow2-asm deps down onto gwt-dev JAR where they belong. These are
required by the compiler code inside gwt-dev, not user code linked
with gwt_module().
Change-Id: I54df92daf40d77e61bed4ed4b549981e8d798ca1
Simplify SDM experience by embedding codeserver and daemon in one
process: no multiple launch configurations must be started and
the output must not be captured in different IDE console windows.
Unfortunately, as is Codeserver implementation is based on outdated
Jetty. Replace WebServer.java from GWT project (same license like
Gerrit itself, preserving the license header) and adjust it to run
against Jetty 9 that is used by Gerrit.
This also removes the need to fetch outdated Jetty version that we
have just wiped out from gwt-dev.jar during download from Central.
Change-Id: I616a53eb080d49a2bdf7a2211067b821af9f85d7
The codeserver runs separately and cannot easily be embedded in Gerrit
because it depends on an outdated version of Jetty. We may change this
behavior when GWT is updated.
Prerequisite is to download gwt-codeserver.jar and dependencies:
buck build codeserver
Start CodeServer with new launch configuration:
tools/eclipse/gerrit_gwt_codeserver.launch
And follow the instructions: [1].
[1] http://stackoverflow.com/a/18333050/116472
Inspired-By: Thomas Broyer <t.broyer@gmail.com>
Change-Id: Ieff7190db6bc151eae1274105ccf828eaa652027
a283507bccbd408540ae1baf75eb80eb59dce031 disabled EditIteratorTest due
to gwt-test-utils uncompatibility with new GWT 2.6 release.
After fixing the compatibility problem in [1] the tests can be enabled
again.
[1] https://github.com/gwt-test-utils/gwt-test-utils/issues/62
Change-Id: I1f93e6422a1ae60d66f4d8b4abac23b6a1acb4f9
GWT 2.6.0 has Java 7 support and other new features [1].
Internal Jetty version, shipped with GWT was updated to 8.1. This
version collides with the version that is used internally by Gerrit
(9.1). To resolve the conflict, GWT's own Jetty version is stripped
from the gwt-dev.jar with maven_jar() method and Gerrit's own Jetty
used instead. Missing Jetty artifacts, needed for the GWT to run in
dev mode:
* jetty-webapp
* jetty-xml
are included now as dependency of gerrit-gwtdebug project.
New GWT version updates a number of dependencies that are used in
Gerrit [3]. Update them too.
EditIteratorTest test is failing with NSME Exception in gwt-test-utils
framework, so deactivate it for now [2].
[1] http://www.gwtproject.org/release-notes.html#Release_Notes_2_6_0_RC1
[2] https://code.google.com/p/gwt-test-utils/issues/detail?id=179
[3]
* Guava 15.0
* Protobuf 2.5.0
* ASM 4.1
Change-Id: I0fa96da6465d52febeae65168b0bd1c2913f6c7e
If the user terminates a build while the GWT compilation is
running, the wrapper script exits with a Python TraceBack.
Handle KeyboardInterrupt and exit gracefully with a message
to the stderr console.
Change-Id: I634b9e57e6ebcc85b4ed9627953f5900cd4ac44a
$TMP, $DEPS, $SRCS, $OUT are no longer supplied by Buck in the
environment unless they appear in the command line. Pass $TMP
where it was assumed to be magically supplied. This allows steps
to continue to use buck-out/gen/ for temporary storage instead of
polluting the system /tmp.
Change-Id: Iea8380e5f93fa16ec77457eb76404832bde93a39
The currently specified version is no longer available on the
repository.
Update the BUCK config to use the latest release.
Change-Id: I918ef3fe3f899d5ab4682114586084f99a324403
The SNAPSHOT version 0.45 doesn't exist anymore on the
specified repository. Switch to snapshot version 0.46.
Because of this bug calling "tools/eclipse/project.py"
didn't work properly. You have to delete your
~/.gerritcodereview/buck-cache to see this problem.
Change-Id: Ie249d6aedf30e579c90f3f457807ff84a3bdb110
Updated version of prettify: in addition to adding new syntax
highlighters, it appears to run much better in IE versions >8.
This would manifest as an unhandled JavaScript exception.
Additionally, formatting appeared to not work well in IE standards
mode and Safari because the @media selector was getting mangled
by GWT. This was fixed in an update to GWT 2.5.1.
Change-Id: Idcc095dac1007c6794e9f67fa12a92b01695d5cf
$DEPS is now funny, it is an unexpanded string using the shell
variable $GEN_DIR. Upstream buck suggests using $(eval echo $DEPS)
to access the string value as $DEPS will not expand to the complete
file paths.
Instead of using eval modify our only use of $DEPS inside of the
GWT compiler helper to replace $GEN_DIR at the start of a string
with the value from the environment.
The JUnit support in Buck was updated recently and PrologTestCase
is being identified as a test to run. Rename its execution method
to prevent it from being identified as a test and push real call
down into the concrete base class.
Change-Id: Ic7e119cd26e72ee95e155e8507785c77b7692acf
Modfied lib/maven.defs so that maven_jar() is able to handle snapshot
builds.
Simplified the implementation of the advance() method in
EditIterator. Previously, the method was calling substring()
on the lines, which was unnecessary.
Change-Id: I3b00caa140539ae77605721d741afae75ae1448e
JettyDaemon invokes buck build to ensure GWT JS is up-to-date before
running the server. To be completely compatible with the command line
build it uses the same PATH environment variable, ignoring the PATH
that is inherited from Eclipse.
Including the PATH as part of the genrule() command ensures buck will
rewrite the properties file anytime the user modifies the PATH, rather
than only when there are updates to GWT Java sources.
Using a properties file frees us from worrying about double quoting in
shell: once in the genrule, again in the script itself.
Using a single properties file ensures any GWT UI can be computed or
verified by JettyDaemon. This change simplifies bootstrap for a
developer as they no longer need to build the UI before launching the
server from within Eclipse. JettyDaemon now takes care of it.
Change-Id: If096a60d9a3f9d6d1502cc947b966109b4458717
* Mostly involves changing print to be a function, and adding
"from __future__ import print_function" for copatibility.
Change-Id: I3129233726e0116a348753a2e2bb68806a08668c
Signed-off-by: Chirayu Desai <cdesai@cyanogenmod.org>
Implement a new build system using Buck[1], Facebook's
open source clone of Google's internal build system.
Pros:
- Concise build language
- Test and build output is concise
- Test failures and stack traces show on terminal
- Reliable incrementals; clean is unnecessary
- Extensible with simple blocks of Python
- Fast
buck: clean: 0.452s, full 1m21.083s [*], no-op: 7.145s,
mvn: clean: 4.596s, full 2m53.776s, no-op: 59.108s,
[*] full build includes downloading all dependencies,
time can vary due to remote server performance.
Cons:
- No Windows support
- No native Maven Central support (added by macros)
- No native GWT, Prolog, or WAR support (added by macros)
- Bootstrap of buck requires Ant
Getting started:
git clone https://gerrit.googlesource.com/buck
cd buck
ant
Mac OS X:
PATH="`pwd`/bin:/System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands:$PATH"
Linux:
PATH="`pwd`/bin:$PATH"
Importing into Eclipse:
$ time buck build :eclipse
0m48.949s
Import existing project from `pwd`
Import 'gerrit' (do not import other Maven based projects)
Expand 'gerrit'
Right click 'buck-out' > Properties
Under Attributes check 'Derived'
If the code doesn't currently compile but an updated classpath
is needed, refresh the configs and obtain missing JARs:
$ buck build :eclipse_project :download
Running JUnit tests:
$ time buck test --all -e slow # skip slow tests
0m19.320s
$ time buck test --all # includes acceptance tests
5m17.517s
Building WAR:
$ buck build :gerrit
$ java -jar buck-out/gen/gerrit.war
Building release:
$ buck test --all && buck build :api :release
$ java -jar buck-out/gen/release.war
$ ls -lh buck-out/gen/{extension,plugin}-api.jar
Downloading dependencies:
Dependencies are normally downloaded automatically, but Buck can
inspect its graph and download missing dependencies so future
compiles can run without the network:
$ buck build :download
[1] http://facebook.github.io/buck/
Change-Id: I40853b108bd8e153cefa0896a5280a9a5ff81655