34 Commits

Author SHA1 Message Date
Han-Wen Nienhuys
b0fb0a7a96 Remove 'final' from method signatures across gerrit.
Change-Id: I986a5507aa26ceb28305a7b08991e85238bde0e3
2017-06-14 09:18:42 +02:00
Dave Borowitz
292fa154c1 Format all Java files with google-java-format
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>
2017-02-07 10:04:39 +09:00
David Ostrovsky
fdbfcad77d Remove Buck based build
Bug: Issue 5302
Change-Id: I6e860446ef30ff0ad1c7c49fc0e39d39d921820b
2017-01-23 12:44:58 +00:00
Liam Miller-Cushon
131f58f742 Fix jar entry paths to be canonical
e.g.
gerrit-antlr/src/main/antlr3/com/google/gerrit/server/query/QueryLexer.java
instead of:
./gerrit-antlr/src/main/antlr3/com/google/gerrit/server/query/QueryLexer.java

Change-Id: I256cfcd68fb3ef454462cf47ddac09f3525bf427
2017-01-17 11:10:41 -08: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
Han-Wen Nienhuys
29cced5e29 bazel: remove 'out' attribute from genrule2, and use throughout.
This centralizes the OSX mktemp solution.

Change-Id: Iaab18450146b649245b36865bedc5d7b50d1aa07
2016-11-02 13:54:10 +01: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
cf6f4a4eb0 Remove unnecessary dependencies
Since [1] dependencies to targets used in $(location //path/to:target)
macro are added implicitly.

Similar build rules simplification was applied in I6c8ddb40ef and in
Id98257e111.

[1] https://github.com/facebook/buck/issues/128

Change-Id: Ife9717f37a9cdf55358da61b7e9df26fdf23c501
2015-09-18 06:02:35 +00:00
Dave Borowitz
e23ea2c7b9 Kill @Rewrite support in queries
These had been significantly pared down since almost all queries of
consequence are sent as-is to the secondary index subsystem. The
remaining queries just existed to simplify some arbitrary subtrees
into slightly less complicated subtrees. This required almost a
thousand lines of magical supporting code for something with no
remaining performance benefit. Let it die a graceful death.

Change-Id: I99ee92549b6619e7aa7529875149073f55c85c69
2015-05-27 03:55:33 +00:00
Dave Borowitz
b364901445 Support change~branch~id in query syntax
It is odd that we describe this in the REST API as a canonical way of
referring to a change, but don't support it in the query syntax. Since
the query parser is also used by the /r handler, this fixes that there
as well.

Unlike in the ChangesCollection parser, allow prefix searches for the
id portion, to be consistent with other search operators.

Change-Id: I55e1cc33caf907cb0ff17dae7a81a46156b6f562
2014-12-10 09:55:08 -08:00
Gustaf Lundh
a3e4722e4c Allow Hashtags searches prefixed with "#".
Change-Id: I9567e5292c84c68ef9b32159da9cc922e553aaa8
2014-09-29 17:59:35 +02:00
David Ostrovsky
d8af092c0a Buck: Remove usage of genfile()
genfile() is considered to be deprecated and is going to be discontinued
in future Buck releases [1].

[1] https://groups.google.com/forum/#!topic/buck-build/Ci8Y95USD8I

Change-Id: I7a5a1ee99d1448c412bb51b793c1e874dd3c62f4
2014-06-10 07:14:18 +00:00
Shawn Pearce
72fb6cc514 Remove unused .gitignore
These were necessary only for the Maven based build.

Change-Id: Ie26669e6ccae60a52d2db1b8ad362e2fa88a26f2
2013-11-28 22:56:51 -08:00
David Ostrovsky
c53fd3ae49 Delete eclipse left-over files from the Maven poop era
Change-Id: Ie3a75e8c6a2d274cd39e362259ab20cff474eb8d
2013-11-28 22:55:09 -08:00
Dave Borowitz
0b052a5bca Document that QueryParseException message is shown to end users
Change-Id: Ib2799757eaae4d2dff1edddc18fe62679097f1e1
2013-08-22 11:51:26 -07:00
Shawn Pearce
11d27c8ee8 Update Buck
Latest version of buck is faster than the prior version used by
Gerrit.  No-op updates when loading a debug version of the UI now take
only 1.804s on my laptop (previously 7s) and a draft UI compile is
only 24.659s (previously 39s).

The slow acceptance tests must now be excluded with `--exclude slow`.
Buck changed the meaning of the -e option to be --emulator, which is
unfortunately useful only for Android application developers.

genrule() now needs to use $(exe) to reference the binary to run,
offers $(location) to make it easier to find files in the build tree.

The empty srcs array is no longer required for genrule().  Buck has
determined it is sufficiently powerful with $(location) and deps that
requiring srcs is unnecessary.

Supporting .src.zip files in the srcs array of java_library() means
Gerrit no longer needs to run a separate genrule() to extract files
produced by ANTLR, or call javac inside of the BuckPrologCompiler
support glue.

Change-Id: Ib03042921a081b867a7aad0423bd45523e42917a
2013-07-26 18:11:51 -07:00
Shawn Pearce
9e4e243cfd Fix genantlr() to support buck caching
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
2013-05-30 14:12:07 -07:00
David Ostrovsky
dcee57212f Delete Maven based build
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
2013-05-21 20:28:56 -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
Shawn Pearce
9240c299f0 Begin 2.8
Change-Id: Ie0bc733853be435fba147dd64ef8cbc5a0027ee0
2013-05-06 19:39:10 -07:00
Shawn Pearce
d47ca8a66d Start 2.7 development
Change-Id: I08dc590bb1f62af67d88eb11313d5d4cfe2423c4
2013-03-21 12:12:47 -07:00
Shawn O. Pearce
757df06505 Allow {} to be used for quoting in query expressions
This makes it a little easier to query for group names that contain
a space over SSH:

  ssh srv gerrit query " 'status:open NOT reviewerin:{Developer Group}' "

Change-Id: I7c81c752236c85d4ed5bd3ed7ad79486b3336510
2012-12-03 09:59:14 -08:00
Edwin Kempin
20f99685d9 Update versions in pom's to start Gerrit 2.6 development
Change-Id: I4fb8cb41250c5b640a8d9e47caf97dc4670ff428
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2012-08-22 14:09:52 +02:00
Sasa Zivkov
90119f8256 Remove timestamp from all org.eclipse.core.resources.prefs files.
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>
2012-07-04 14:06:09 +02:00
Anatol Pomazau
2f12c650ec Add Intellij IDEA files to ignore list
Change-Id: Ie948a1b3c9df95e79fc09ef343d0d49ff3b267c2
2012-05-03 13:17:43 -07:00
Edwin Kempin
daf6bd9865 Update parent version in pom.xml's to 2.5-SNAPSHOT
Change-Id: I3b2f0f532fc10b98657de117c80113fe0eac3bc4
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
2012-05-03 09:49:17 +02:00
Sasa Zivkov
17e17dd8b9 Change version in pom.xml to 2.4-SNAPSHOT
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>
2012-04-18 12:55:40 +02:00
Martin Fick
7f7eadff20 Update poms to Gerrit 2.3-SNAPSHOT
Change-Id: I6f54a783959c58fb75114251e07a6871bc889904
2012-02-22 17:19:32 -07:00
Mohan Zhang
3a6dbe93c3 Add entries to .gitignore for m2e settings/preference files
Change-Id: Ie70c285440b6200ad7f4dd8dea8a97317e1e62fc
2011-12-12 16:56:53 -06:00
Shawn O. Pearce
ebf043277d Package source JARs for antlr, httpd, server
Change-Id: I9879c8d995b83925bc3a798a5e3668be133f8a3d
Signed-off-by: Shawn O. Pearce <sop@google.com>
2011-10-31 17:35:30 -07:00
Eric Anderson
a68b89fd53 Updating eclipse settings for 3.7 and m2e 1.0
Change-Id: Ic0f134719769e3d8b8cfb6f70703f9a61fcd2538
2011-07-29 08:29:51 -07:00
Shawn O. Pearce
4e67700dab Change version to 2.2-SNAPSHOT
Change-Id: I1d3e6c42bc678536162a81d2b13372659a1c3dec
Signed-off-by: Shawn O. Pearce <sop@google.com>
2011-05-31 10:30:57 -07:00
Shawn O. Pearce
b1901c0797 Move ANTLR code to its own package
This way we can set the Eclipse warnings/error reporting for the
generated code to ignore problems we normally try to prevent in
human written sources.

Change-Id: I0b32d4ebf95611f58468a14e81489bf76f5d7603
Signed-off-by: Shawn O. Pearce <sop@google.com>
2011-05-19 09:58:37 -07:00