Having a standard tool for formatting saves reviewers' valuable time.
google-java-format is Google's standard formatter and is somewhat
inspired by gofmt[1]. This commit formats everything using
google-java-format version 1.2.
The downside of this one-off formatting is breaking blame. This can be
somewhat hacked around with a tool like git-hyper-blame[2], but it's
definitely not optimal until/unless this kind of feature makes its way
to git core.
Not in this change:
* Tool support, e.g. Eclipse. The command must be run manually [3].
* Documentation of best practice, e.g. new 100-column default.
[1] https://talks.golang.org/2015/gofmt-en.slide#3
[2] https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html
[3] git ls-files | grep java$ | xargs google-java-format -i
Change-Id: Id5f3c6de95ce0b68b41f0a478b5c99a93675aaa3
Signed-off-by: David Pursehouse <dpursehouse@collab.net>
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
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
Split the current gerrit-acceptance-tests in two parts:
* framework + some needed deps, that is exposed as additional plugin
artifact
* rest of the gerrit-acceptance-test project
To implement the split and not to pull in too many dependencies, some
refactoring was needed. Particularly, gerrit-server:testutil depends
on gerrit-server:server, that depends on almost everything. Similar
problem was with gerrit-pgm:pgm, that is needed for AbstractDaemonTest
to work. Split the rules in gerrit-pgm to break transitive dependency
chain. We shouldn't ship artifacts twice, in plugin-api and in
acceptance-framework.
This change also partially reverts Ie9e63de622, where
//gerrit-acceptance-tests:lib with all its transitive dependencies was
included in plugin-api artifact.
Expose gerrit-acceptance-framework as new plugin artifact. This allows
us to support unit tests in plugins in three different build modes:
* Buck in tree build mode
* Buck standalone build mode
* Maven build
To install gerrit-acceptance-framework locally, the following command
is used:
buck build api_install
To deploy gerrit-acceptance-framework to Maven Central, the following
command is used:
buck build api_deploy
To support unit tests in tree build mode, the following Buck variable
is exposed: GERRIT_TESTS and can be used, e.g.:
java_test(
name = 'cookbook_tests',
srcs = glob(['src/test/java/**/*IT.java']),
labels = ['cookbook-plugin'],
source_under_test = [':cookbook-plugin__plugin'],
deps = GERRIT_PLUGIN_API + GERRIT_TESTS + [
':cookbook-plugin__plugin',
],
)
To support unit tests in standalone build mode, acceptance-framework
maven jar is defined in lib/gerrit/BUCK file:
maven_jar(
name = 'acceptance-framework',
id = 'com.google.gerrit:gerrit-acceptance-framework:' + VER,
license = 'Apache2.0',
attach_source = False,
repository = REPO,
)
bucklets/gerrit_plugin.bucklet is extended with the same variable
that points to the new maven_jar artifact, so that the same Buck
java_test() rule can be used in both modes.
Test plan:
1. run tests in gerrit tree
2. apply corresponding change to cookbook-plugin and run tests in
gerrit tree mode
3. apply corresponding change to bucklets, and run tests for
cookbook-plugin in standalone build mode
Change-Id: I4cadf6616de36ca24712f8b07d282b7a50911105
Since Java 7 it is possible to replace the type arguments required to
invoke the constructor of a generic class with an empty set of type
parameters (<>) as long as the compiler can infer the type arguments
from the context [1].
Enable the Eclipse warning about redundant type arguments, and remove
the ones it warns about.
[1] http://goo.gl/SG21kM
Change-Id: I422882949a6a6a57391580d881f73120b2843a0e
There is now only one supported way to debug GWT, so remove the "SDM"
naming, as it's basically an implementation detail. Be consistent
between the launcher and class names,
gerrit_gwt_dbg -> GerritGwtDebugLauncher.
Update the documentation to be consistent as well, and link to the
article about Super Dev Mode.
Change-Id: If541bc48bf828a8af64d631d7acd6f663d5ecea1
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
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
{@code foo} is shorter and easier to read and write than
<code>foo</code>, which is why it was introduced years ago in the
javadoc processor. Make consistent use of it throughout the
documentation comments.
Change-Id: I59d428cb6c5015453629398b0697891b83c8e91d
The Maven build does not work since the introduction of CodeMirror.
Remove the build until to prevent people from trying to use a broken
build process. If buck is rejected this commit will be reverted, and
we will attempt to fix the Maven build to include CodeMirror. If buck
is accepted, we just saved time by avoiding a messy Maven change.
Change-Id: I147d8d1741d52f59de1d2ddce8e5e82583990c14
Try to reduce the size of the top-level BUCK file by moving
anything that has to do with Eclipse project generation and
classpath management into tools/eclipse.
Change-Id: Id779eaff4fe732908b28a8e3441004e364b59e21
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
gwt-dev.jar contains additional classes (eg. args4j version 2.0.12) that
can overwrite our dependency, therefore it should be imported as last
one in gerrit-gwtdebug pom.xml
Change-Id: Ic9797bf07c2f5f787bfcdb71104ea4156e523a1f
Signed-off-by: Dariusz Luksza <dariusz@luksza.org>
Eclipse overwrites these files when we import projects using m2e.
Eclipse 3 writes a timestamp at the top of these files making the Git
working tree dirty. Eclipse 4 (Juno) still overwrites these files but
doesn't write the timestamp. This should help keeping the working tree
clean. However, since the timestamp is currently present in these
files, Eclispe 4 would still make them dirty by overwriting and
effectively removing the timestamp.
This change removes the timestamp from these files. This help those
using Eclipse 4 and doesn't make it worse for those still using Eclispe
3.
Change-Id: Ic23299a12ac80f7294bcc602c8565889069a0d10
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
The 2.3 was released and what we have in the master branch
is targeted for 2.4.
Change-Id: Idca8a12aaef1dc5ea5f628b3640881e66f04dc9c
Signed-off-by: Sasa Zivkov <sasa.zivkov@sap.com>
Refactored the GWT client code to include only what the gerrit GWT
client. The gerrit GWT build was giving build warnings since the
getAsync() signature and implementation used types that were
not available to GWT.
Split the reviewdb into a client and server package.
Organized the imports to ease the migration.
Change-Id: I6cd6125eddcb1dd2b5c5e353edf163544248026b
Running Gerrit in gwtdebug mode resulted on client side in an
exception saying that javax.validation.ContraintViolation could not be
resolved. As a result of this exception the project access screen
failed to load.
This change now adds Maven dependencies to the validation-api jars in
the pom.xml of the gerrit-gwtdebug project to this fix this problem.
Change-Id: I8b2341c017a6cfbde490bd38b4e016d29707f96c
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
I meant to keep reusing the 2.1 version number for the entire
2.1 series during development, but botched it during the 2.1.4
development cycle and set it to 2.1.4-SNAPSHOT by mistake. Put
it back to 2.1-SNAPSHOT since 2.1.4 is released.
Change-Id: I37e206c0609bf3fd94a5aab8ea301c98b7fb013e
Signed-off-by: Shawn O. Pearce <sop@google.com>
When we started building gerrit-gwtdebug as a submodule, we broke
the way the Maven Eclipse plugin generated the project classpath.
Instead of the WAR, link to the JAR of each project.
Change-Id: Ie8a3723ee26c19710cac67eac79930a1ba992006
Signed-off-by: Shawn O. Pearce <sop@google.com>
We have to replicate the change for issue 4322[1] ourselves because
we cloned the development mode server setup code path to make it
easier to configure our context's CLASSPATH without having to build
the complete WAR file.
[1] http://code.google.com/p/google-web-toolkit/issues/detail?id=4322
Change-Id: I9447913ad1b5dc9c7bb904c4408d3e465994bf55
Signed-off-by: Shawn O. Pearce <sop@google.com>
Rather than listing all of our build projects in the parent pom,
list them where they are actually required to compile.
Change-Id: I27954f3e4affdaa258ee024c0899f0cacd3f2ae4
Signed-off-by: Shawn O. Pearce <sop@google.com>
Unfortunately GWT now requires the gwt.codesvr query parameter in the
URL anytime we load our host page with GWT code in it. To ensure it
is always present we save it into a cookie during startup and redirect
back to ourselves with the parameter added back into the URL if it was
not already present.
Since this block of JavaScript isn't needed in production we strip it
out of the host page unless our magical system property has been set
to true indicating we were launched through our debug launcher.
We also no longer strongly name the nocache file if we are in the
GWT development mode.
Change-Id: Ia7a91f66e21088ba269410d76461fe0be4480825
Signed-off-by: Shawn O. Pearce <sop@google.com>
We've changed so much since the 2.0.24 release that I'm really not
comfortable calling it 2.0.25.
Change-Id: I9cf28b0a97e0f74838bf893b79ce3105e0a7bfdb
Signed-off-by: Shawn O. Pearce <sop@google.com>
Unfortunately my recent Maven refactoring series didn't quite work
with the gwtdebug hosted mode debugging support project for gwtui.
The project removes gerrit-pgm (and its contained Jetty) from the
classpath but that was where we were getting our PostgreSQL JDBC
driver from.
We need to import the drivers directly in gwtdebug's own pom.
Change-Id: Iccb284e8f26b1287771e0251dbf2772bbeb43428
Signed-off-by: Shawn O. Pearce <sop@google.com>
We now include Jetty 7.x as part of our distribution WAR and allow
administrators to launch the embedded copy using our Daemon command
line program. This vastly simplifies server installation as you
do not need to download the Jetty servlet container and configure
it prior to using Gerrit Code Review.
Configuration of Jetty is performed using our gerrit.config, rather
than the Jetty XML configuration language. Jetty's language can be
quite a bit more powerful for isoteric configurations, but we want
to embed Jetty to simplify setup, not complicate it. Gerrit's own
configuration file in the git syntax is simpler, so we stick with
that and offer a limited subset of Jetty's configuration features
through httpd.* properties.
Logging currently goes only to stderr, which is fine for toy setups
but probably not ideal for a production environment.
Unfortunately we are still relying on GerritServer.properties to
get us the database connection information, and this DataSource is
not pooled. Thus the web handlers in our embedded container will
run slightly slower then the web handlers in a standalone container,
as the latter will be likely be using a connection pool configured
out of the container's JNDI namespace.
Bug: issue 202
Change-Id: Ia7956ba48cbc3a8d4241101db5ff493e16d26b9f
Signed-off-by: Shawn O. Pearce <sop@google.com>