google-java-format is not uniformly available in package management
systems across OSes. More importantly, we want to make sure that all
contributors are using a standardized version, to avoid unnecessary
changes due to slight differences between versions.
While we're in the dev documentation, link to the Google Java Style
Guide, and remove some wording that is clearly redundant with the style
guide.
Change-Id: Ib14dab2e692339f836083fad08a7a435a2f24470
We still use Buck for the stable branches and when you switch from a
stable branch to the master branch it's annoying that '/buck-out' pops
up as untracked folder.
Change-Id: I2be21286706af6baa07e947cdef3a14666ce7cf2
Signed-off-by: Edwin Kempin <ekempin@google.com>
To guess what build system is used, we create now .primary_build_tool
file in the root of the project during the eclipse classpath generation.
Change the working directory for GWT SDM session to be .gwt_work_dir.
The reason for that Bazel doesn't allow to write to bazel-out.
Change-Id: I984068350244ee9d66807e4bc8c6779b34a26bab
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
eml files are generated by IntelliJ as a substitute for .iml files if
the workspace is organized in .classpath files. These should not be
pushed.
Change-Id: If47838a2a58b6d76cd6c68461d54929b0a732234
The new Buck version fixed annoying stdout spamming bug on unit test
failures: [1]. Now we can revert our monkey patching hack to prevent
that.
Since [2] Buck interferes with files in buck-out directory: [3]. Switch
to using eclipse-out directory as Eclipse output directory instead. For
this change it's necessary to clean up buck-out directory, otherwise
`buck test` would fail.
This version also fixed "Python client lost connection" bug: [4].
This reverts commit 94e93aaad22e67b5956627cff1a9cb84d03a29ec.
[1] https://github.com/facebook/buck/issues/505
[2] 35cb495b57
[3] https://github.com/facebook/buck/issues/527
[4] https://github.com/facebook/buck/issues/534
Change-Id: I4cd1a99ce9d0615713c235d873e6cdd61b1854bb
There is no reason to track .DS_Store files here: it's a metadata file
used by the Mac finder to hold info like where icons are located. Add
it to .gitignore to avoid cluttering "git status" output.
Change-Id: I2c59228e48ed8d5ef125d8a694ca05d20b622723
In Eclipse preferences under the Team -> Git -> Project section, if the
"Automatically ignore derived resources by adding them to .gitignore"
option is enabled (which is the default), Eclipse will automatically
add "/bin/" to the .gitignore file.
Update the .gitignore file with this change to prevent Eclipse from
causing unexpected modified files in the git status.
Change-Id: I0cce9dd40183ff93b01cd0b45c383607d48d1af1
The GWT compiler can output a report (or "story of your compile"),
describing the size of the JavaScript and which source classes
contributed to the overall download size. This is useful for
optimizing code splits in Dispatcher, and generally understanding
the impact of linking code together.
Only the "Split Point Report" is created.
The "Compiler Metrics" are not output.
The report is very slow to create, so it is not done by default.
Change-Id: I6ce86d65ee5f3e4bdba573d1f777ccc59767341d
AutoValue[1] is a lightweight annotation-processor-based library for
implementing classes with simple, obvious value semantics.
Add support for AutoValue to build rules and Eclipse project
generation. Buck does not currently have an officially-supported
interface for specifying annotation processor dependencies[2], so we
have to take the slightly ugly approach of monkey-patching
java_library and java_test to add annotation processor arguments to
each rule that requires annotation processing; hopefully this ugliness
can be reduced in the future.
[1] https://github.com/google/auto/tree/master/value
[2] https://github.com/facebook/buck/issues/85
Change-Id: I8b49d6f9f25d61688b667d964848c6ce106ae4ec
* stable-2.9:
Bash: Deploy plugin archetypes to Maven Central
Fix documentation of how to publish artifacts to Maven Central
Buck: Deploy plugin artifacts to Maven Central
Conflicts:
.gitignore
Change-Id: I72aca7e13b55fbbe34bbf00d799a8a05dc96a955
Switch deploying Gerrit extension and plugin API from Google storage
bucket to Maven Central.
To simplify the troubleshooting new trace option was added to
underlying python script. When environment variable VERBOSE=1
is set, then the mvn command is printed to stderr:
VERBOSE=1 buck build api_deploy_oss
Change-Id: I9ebe44ec8aca91aa6b5514f561209e7c50377927
Buck changed export_deps from a boolean to be exported_deps, a list of
dependencies that are to be added to deps and also exported. This
allows libraries to have dependencies for implementation use only, but
not expose them to callers for linkage.
exported_deps aren't transparently transitive anymore. This mostly
impacts the plugin-api:lib rule.
This is the first time Gerrit is using upstream Buck with no patches.
- Java memory settings for Buck can now be supplied in a project
specific file using `.buckjavaargs` in the root directory. The file
replaces the `.buckrc` previously supported by Gerrit's fork.
- Temporary directories for java_application() invoked from genrule()
is now supplied as part of the arguments using $TMP. This removes
one of the patches Gerrit had for Buck.
- Unit tests use the system temporary directory during testing. This
can be faster if the temporary directory is a tmpfs. Unfortunately
not all passing tests clean up after themselves, making it possible
to exhaust system memory and swap with useless tmpfs contents.
Using the system temporary directory for tests removes another patch
Gerrit had on top of Buck.
Change-Id: I3a9fe4aab0a33a8673df727e618122027a742638
genrule() can only produce one output. This is critical to the way
buck caching works for build results. The solution I learned from
the Buck team is to have the genrule() produce a ZIP file containing
all of the outputs, and use a unique genrule() to extract each
output from the ZIP.
Developers can now opt-into the buck cache by writing a local
config file:
cat >.buckconfig.local <<EOF
[cache]
mode = dir
dir = buck-cache
EOF
This can be very useful when switching commits around with GWT UI
code. If the UI code does not modify between commits there is no
rebuild time. If UI code does modify, rebuild time is reduced to
0 when switching back to a prior version you had previously built.
The cache needs local disk, so its not enabled by default.
Change-Id: If8f79637004fbc13ea37c419e5c9bb582a489ab5
Buck upstream now supports a daemon mode[1] which allows BUILD
files to be cached across invocations. This saves considerable
time on startup, especially for no-op incremental builds:
no-op without buckd: 10.6s
no-op with buckd: 5.2s
However the current daemon implementation is insecure. Users
should only run it on dedicated machines where they trust all
other running processes.
Buck now requires Java 7. If it is missing the build will fail.
[1] http://facebook.github.io/buck/command/buckd.html
Change-Id: I55dec63e467f8f4db5a799296fb7f588ce4b2aa1
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
These files keep showing up when I run git add . and it's throwing off
the release script, so I am telling git to forget about them.
Change-Id: I4c12e9c4d72acf8e8dc1345b6903cfa224e621ed
We now load our database settings in hosted development mode from
the $site_path/etc/gerrit.config, just like we would under daemon.
This reduces the number of weird configurations that are supported.
Change-Id: I0a13f16dd74bdb034d05650eadd5e36771109f3e
Signed-off-by: Shawn O. Pearce <sop@google.com>
We now can launch the daemon correctly from within the Eclipse debugger
without having to switch to using the WAR in our CLASSPATH. This works
by allowing Eclipse to supply all of the CLASSPATH, but we have to go
find our WAR resource content in gerrit-gwtui/target.
Bug: 340
Change-Id: I7dfbc0654cdc10099fb3de3041e615a9fda5fdb4
Signed-off-by: Shawn O. Pearce <sop@google.com>
This refactoring splits the code up into different components, with
their own per-component CLASSPATH. By moving all of our classes
into isolated components we can better isolate the classpaths and
try to avoid unexpected dependency problems. It also allows us to
more clearly define which components are used by the GWT UI and
thus must be compiled under GWT, and which components are run on
the server and can therefore use more of the J2SE API.
Change-Id: I833cc22bacc5655d1c9099ed7c2b0e0a5b08855a
Signed-off-by: Shawn O. Pearce <sop@google.com>
The pain in the neck thing is, we have to use their new WAR style
output, which requires us to run "mvn war:inplace" before we can
start debugging, or if any dependencies change, but we also need
to clean that out.
All RPC handles also moved inside of the module directory, which
makes it easier to debug in the hosted mode browser but breaks any
existing browser client, even though the JSON payloads have not
changed in format.
Bug: GERRIT-75
Signed-off-by: Shawn O. Pearce <sop@google.com>
This might exist if the developer is trying to test directly from
the source directory by running something like:
mvn package && java -jar target/gerrit-*.war foo
and the "foo" subcommand requires GerritServer.properties to speak
to the database.
Signed-off-by: Shawn O. Pearce <sop@google.com>
In general we map one Maven project description to one Git
repository, as each Maven project has its own unique version
number for its artifact.
This change pulls everything up one level so its a much more
typical directory layout, where the pom.xml is at the root
of the directory structure.
Signed-off-by: Shawn O. Pearce <sop@google.com>
This way we can easily depend upon other projects which also use
Maven, without needing to embed all of their dependencies directly
within our repository.
Signed-off-by: Shawn O. Pearce <sop@google.com>
We've made some schema changes about how patch data is stored and
represented in the Gerrit 2 database, so we need to import all of
the patch entities over again. This change includes a CLI tool
that can be run to re-import one or more patch set entities from
the corresponding Git commit.
Signed-off-by: Shawn O. Pearce <sop@google.com>
We also include .gz versions of every static resource, because
this allows Jetty (and possibly other servers) to efficiently
send the pre-compressed static resource to the client.
Signed-off-by: Shawn O. Pearce <sop@google.com>
This script is just a simple tool to help me export the current
PostgreSQL database into a format that is safe to send to a 3rd
party. All of the data is public on Gerrit's website, except for
the user's physical address contact information. We scrub that
out because we do not have consent from our users to disclose
that information.
Signed-off-by: Shawn O. Pearce <sop@google.com>
We don't need to track these files from hosted mode crashes.
Keeping them in .gitignore makes it easier to "git add ." and
not worry about them being included into the project.
Signed-off-by: Shawn O. Pearce <sop@google.com>
Gerrit 2 is a ground-up rewrite of Gerrit, using GWT (Google Web
Toolkit) for the client side user interface and a Java servlet
based backend.
Signed-off-by: Shawn O. Pearce <sop@google.com>