18 Commits

Author SHA1 Message Date
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
David Ostrovsky
fa18907d7f Bazel: Reformat build files
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
2016-12-07 11:33:07 +00:00
Yuxuan 'fishy' Wang
75b98f77d9 bazel: add license to appropriate lib/ targets
This is to prepare for implementing genlicenses rule in bazel.

Change-Id: I60d79d5b53f9dd05c9f9ebfe6e6f658604c5a037
2016-09-26 16:42:38 +08:00
Han-Wen Nienhuys
bcb46c3cd8 bazel: upgrade Guice to 4.1.0, add multibindings
Change-Id: If9da85ffa0d5f5eba355764c28fca9d33664f894
2016-08-25 15:32:56 -03:00
Jonathan Nieder
04f3be812e Update guice-multibindings sha1
bdffdea92f0163839982704e4d52e92de5eff2f2 (Adds the Soy library and
injects it via EmailArguments, 2016-08-22) set the correct sha1 for
version 4.0.0 of this jar, but by the time it was merged, VERSION had
been increased to 4.1.0.  4d0d2cf9f1584ee4f5f2aa6dca56c9c3416d4f79
(Merge "Adds the Soy library and injects it via EmailArguments",
2016-08-23) and newer fail to build as a result:

 Download http://repo1.maven.org/maven2/com/google/inject/extensions/guice-multibindings/4.1.0/guice-multibindings-4.1.0.jar
 http://repo1.maven.org/maven2/com/google/inject/extensions/guice-multibindings/4.1.0/guice-multibindings-4.1.0.jar:
 expected f4509545b4470bbcc865aa500ad6fef2e97d28bf
 received 3b27257997ac51b0f8d19676f1ea170427e86d51

Change-Id: I80398dd6287c693f918382a0ce2c2a39456b01b8
2016-08-23 14:32:36 -07:00
David Ostrovsky
4d0d2cf9f1 Merge "Adds the Soy library and injects it via EmailArguments" 2016-08-23 19:06:39 +00:00
Wyatt Allen
bdffdea92f Adds the Soy library and injects it via EmailArguments
This change lays the groundwork for migrating email templates from VTL
to Soy (Closure Templates). This change does not modify the existing
template system or how emails are constructed. Moreover, it makes the
Soy library available alongside the Velocity library.

With this change, the Soy library (along with its dependencies) is added
to //gerrit-server:server and //gerrit-plugin-api:lib. A new license
definition is included for ICU4J.

A Guice provider for SoyTofu objects (which work as factories for Soy
template renderers) is injected into EmailArguments similarly to
VelocityRuntimeProvider.java. For technical reasons, a Soy template is
included, but is not used at this time. It does, however, provide a
simple example for how the email templates may look soon.

Feature: Issue 4345
Change-Id: I9625de1d129c04770d2a2dcfd4967c2c2779a81c
2016-08-22 09:45:33 -07:00
David Pursehouse
3f91b83633 Upgrade Guice to 4.1.0
Change-Id: I8806251e93d1ae04842a42469a87d0fb6c37828a
2016-08-20 12:52:31 +09:00
David Ostrovsky
b81b4f75ae Implement Bazel build
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
2016-06-14 21:12:02 +02:00
David Pursehouse
629b2b47e2 Update Guice to version 4.0
Fixes a bug [1] which prevented Gerrit startup under Java 8.

[1] https://github.com/google/guice/issues/904

Change-Id: Ie8be80351c06cef77e892725cc7a03663c4c4e02
2015-05-08 10:29:30 +00:00
David Ostrovsky
f9391640ab Update Guice version to 4.0-beta5
Beta 5 releases the fix to Cookie mutability bug [1], so that we can
switch again to Central repository and don't need custom Guice
guice-servlet build.

[1] http://code.google.com/p/google-guice/issues/detail?id=806

Change-Id: Ia766f3d9163afdae06ea7c702824909a8349b98e
2014-09-29 22:33:12 +02:00
David Ostrovsky
b938abbede Patch guice servlet extension to fix cookies bug
Since I255661a62 web session management code facing subtle cookies
mutability problem in request continuation code for background tasks.
Before this change, original request was used in background tasks.

Cookies mutability bug [1] was fixed by Guice team but wasn't released
yet.  Build against unreleased version and deploy it temporarily on Google 
storage bucket until the fix is released.

[1] http://code.google.com/p/google-guice/issues/detail?id=806

Change-Id: Ife019c22b85a0e1e49cfafeaeebb886be27aeacd
2014-06-16 17:43:50 +00:00
Shawn Pearce
4e1a8bc63d Update Buck
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
2013-11-29 10:50:59 -08:00
David Ostrovsky
bb360ebe06 Buck: generate javadocs for plugin and extension API
buck build api

generates now javadocs.

  buck build api_install

installs all plugin/extension related artifacts with javadocs in the
local Maven repository.

Change-Id: Ifa6a8eb469f388e16449576ff2bff01a5dce67dd
2013-11-24 02:04:51 +01:00
Shawn Pearce
3918177c6b Exclude Guava Maven data and javax sources from Guice JARs
Guice 4.0-beta leaked the maven metadata files for Guava when it was
repacked to a private namespace.  This confuses Buck when creating a
combined JAR that has both Guice and Guava.

Guice also leaked the source files for javax.annotation into its
binary JAR files. Buck sometimes finds and extracts these source
files at compile time, creating duplicate versions of the classes.

Change-Id: Iea0a3394530abd8b0853d016b7cb2f5182f82a96
2013-08-06 09:39:50 -07:00
Shawn Pearce
f4a6330088 Upgrade Guice to 4.0-beta
gerrit-review has been running on roughly this version for
months. Upgrade to the build available in Maven Central.

Change-Id: Idf4a7f618f06c5b79db29eae6335470d15ecd632
2013-08-05 15:54:12 -07:00
Shawn Pearce
bd5629718f Update buck build for strict dependencies
java_library() targets must now list every dependency they need for
an import. This permits buck to run more targets in parallel as it
has a better view of the dependency graph, and opens the door for
buck to make even more optimizations in the future.

Change-Id: I132bf47a725e44ba5950ba6ca76bfa72c3876906
2013-05-16 01:14:27 +00:00
Shawn Pearce
fd6bb9f6a5 Build with Buck
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
2013-05-09 13:40:36 +00:00