35 Commits

Author SHA1 Message Date
David Ostrovsky
e1359a35e1 Bazel: Harmonize names of external repositories
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
2018-06-13 11:38:03 +09:00
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
Han-Wen Nienhuys
c1a6976b50 bazel: put source jars in the same package.
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
2016-11-30 08:48:20 +01:00
David Ostrovsky
8c9a9ea486 Expose sources in GWT UI plugin API
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
2016-11-22 22:16:18 +00:00
David Ostrovsky
2502fab15a Bazel: Implement GWT UI build for the plugins
TEST PLAN:

  $ bazel build plugins/cookbook-plugin

Deploy to the server site and verify that it works.

Change-Id: I98af807f9c92ba4ed7efad332d8fdee407bb8ce6
2016-11-15 15:29:13 -08:00
David Ostrovsky
6546085df7 Bazel: use a custom maven_jar rule
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
2016-11-09 08:31:11 +01:00
David Ostrovsky
c84bce4cae Bump GWT version to 2.8.0
Change-Id: I0dd10792a0c12adba3927c18dabc31875df3622f
2016-10-27 22:22:05 +02: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
David Ostrovsky
a0ebd115f7 Bazel: Fix building GWT UI
Change-Id: I83dd5ca82868474ec0c6a7a77eed40e62e1570b1
2016-09-21 18:04:04 +02:00
David Ostrovsky
071060903b Merge changes from topic 'bazel-build'
* changes:
  Bazel: Build gerrit WAR with GWT UI
  Bazel: Build GWT UI
  Implement Bazel build for gerrit-gwtui project
  Implement Bazel build for codemirror library
  Bazel: Produce headless war
  Implement Bazel build for gerrit-war project
  Implement Bazel build for gerrit-main project
  Bazel: add java_doc rule
  Bazel: Create sources for plugin API
2016-09-20 11:57:48 +00:00
David Ostrovsky
013af9ec3f Bazel: Build GWT UI
Port Buck gwt_binary() native rule: [1] to Skylark.

TEST PLAN:

  bazel build gerrit-gwtui:ui_optdbg

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

Change-Id: I24d11f10928a8000304bc4233156ddc50fad8931
2016-09-20 13:47:12 +02:00
David Ostrovsky
7817498d77 Bump GWT version to 2.8.0-rc2
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
2016-09-19 15:10:11 +02: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
c3574e99ad Remove gwt-test-utils and disabled tests that depend on it
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
2016-02-10 16:48:10 +09:00
David Ostrovsky
1ae0210ab4 Buck: Move gwt-dev transitive deps to first order dependency
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
2015-10-18 19:01:42 +02:00
Shawn Pearce
b0735a3c02 Remove org.json:json and fix gwt-dev deps
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
2015-06-25 10:03:24 -07:00
David Ostrovsky
11c56681b0 Update GWT to 2.7
As pointed out in this thread on GWT-discuss development group [1],
gwt-dev is going to be unbundled in 2.7 release. That means that we
would have to supply its dependencies explicitly.  To start with we
need to pass in ASM library.

It's unclear though, if we need asm-commons and asm-xml as it compiles
without it, but corresponding parent-pom contains it [2].

GWT unit tests were disabled as gwt-test-utils doesn't seem to work yet
against upcoming GWT 2.7 release. Issue was filed upstream [3].

As was pointed out in this thread [4], codeserver is now shipped in
gwt-dev.jar as well. Stop fetching codeserver.jar in addition and use
the bits from gwt-dev.jar.

[1] https://groups.google.com/d/topic/google-web-toolkit/LwXXQCG_I_k/discussion
[2] http://repo1.maven.org/maven2/org/ow2/asm/asm-parent/5.0.3/asm-parent-5.0.3.pom
[3] https://github.com/gwt-test-utils/gwt-test-utils/issues/68
[4] https://groups.google.com/d/topic/google-web-toolkit-contributors/pFYPE7Uoub8/discussion

Bug: issue 3008
Bug: issue 3027
Change-Id: Ib8f9ed0c767e9f41f104253fdc8b74a8cbbe38ab
2014-12-04 11:23:01 +09:00
David Ostrovsky
9adf60e96f GWT SuperDevMode: Spawn codeserver and Daemon in same process
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
2014-09-10 18:47:58 +02:00
David Ostrovsky
12968f26df GWT DevMode is dead; set up SuperDevMode
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
2014-08-15 21:33:18 +00:00
Michael Zhou
38214b31db Bump GWT version to 2.6.1
Change-Id: I426f9ae884295d95c51e2deb23cdb768ceb93dee
2014-05-27 14:59:04 -04:00
Shawn Pearce
06e069cfcc Update Buck and use gwt_binary()
Migrate gwt build tool chain to built in gwt_binary() rule [1].

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

Change-Id: I1f13f4d29864bc7e7278f8a2b2e39c882acf44aa
2014-05-19 11:41:31 -07:00
David Ostrovsky
2919972ce4 Enable disabled gwtui tests
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
2014-03-10 06:22:39 +00:00
David Ostrovsky
56d89b458a Bump GWT version to 2.6.0
Change-Id: I3353e086112bd1bc4ac9bb2adc35110324c70059
2014-03-05 06:44:24 +00:00
David Ostrovsky
a283507bcc Update GWT version to 2.6.0-rc3
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
2014-01-23 06:39:08 +01:00
David Pursehouse
e177cab903 Handle KeyboardInterrupt in buck GWT compiler wrapper script
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
2013-10-24 15:40:10 +09:00
Shawn Pearce
55583ac43e Update buck
$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
2013-10-18 17:06:56 +00:00
David Pursehouse
acc5159f85 Update gwt-test-utils
The currently specified version is no longer available on the
repository.

Update the BUCK config to use the latest release.

Change-Id: I918ef3fe3f899d5ab4682114586084f99a324403
2013-10-12 12:11:43 -04:00
Christian Halstrick
ec2adce0b6 Fix version of gwt-test-utils
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
2013-10-01 16:53:10 +02:00
Doug Kelly
c4e8ae3291 Update prettify to March 4, 2013 release
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
2013-09-18 13:06:19 -05:00
Shawn Pearce
627a250c72 Update Buck
$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
2013-08-15 17:25:45 +00:00
Michael Zhou
7b8161da76 Added gwt-test-utils to test EditIterator.
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
2013-06-12 11:20:49 -07:00
Shawn Pearce
6dec5bf32e Fix the buck springboard to always work from Eclipse
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
2013-05-13 13:02:25 -07:00
Chirayu Desai
4c5ee48f47 Python3 support
* 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>
2013-05-13 14:07:42 +05:30
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