86 Commits

Author SHA1 Message Date
Shawn Pearce
41c2e73da2 Support Bazel 0.5.1
Bazel 0.5.1 is using "bazel-out/darwin_x86_64-fastbuild/", which
failed these extraction patterns.  Allow anything before the
-fastbuild part of the path.

Change-Id: I850271bb1c657a5ffe77946a6beaf54a3680af75
2017-06-12 08:53:05 +09:00
David Ostrovsky
f2f4ee165c Consider plugin's test deps in eclipse classpath generation
Introduce the CUSTOM_PLUGINS_TEST_DEPS in tools/bzl/plugins.bzl
that allow plugin with external test dependencies to be listed.
That way Eclipse classpath generation process can consider these
dependencies.

Because the plugin's own test rule need these dependencies, it
should expose java_library rule called: <plugin>__plugin_test_deps:

  java_library(
      name = "high-availability__plugin_test_deps",
      visibility = ["//visibility:public"],
      exports = [
          "@byte-buddy//jar",
          "@mockito//jar",
          "@objenesis//jar",
          "@wiremock//jar",
      ],
  )

and re-use this rule in junit_tests rule, e.g.:

  junit_tests(
      name = "high_availability_tests",
      [...]
      deps = [
          [...]
          ":high-availability__plugin_test_deps",
      ]
  )

Bug: Issue 6351
Change-Id: I55b402fa6edb9f2506a91451d70e68d44d1a7762
2017-05-31 06:42:48 +00:00
David Ostrovsky
596fff00cc Eclipse project generation: Support jgit from external repository
This change fixes Eclipse project generation when jgit is consumed from
external repository. Only path to the library is added, but not the
sourcepath.

Test Plan:

* Switch to using jgit from external repository by amending the path
  in lib/jgit/jgit.bzl
* Run tools/eclipse/project.py
* Verify that classpath entries are added to the .classpath file

Change-Id: I2bdadb74b3ef869805a96671b7882917967998d6
2017-04-07 07:44:10 +00:00
David Pursehouse
c26261acf9 Fix launching daemon in Eclipse on MacOS
Change I5fc96bf1f removed the generation of the .primary_build_tool
file and change I3d6b90320 removed the build system abstraction with
the motivation that we now only have one build tool.

However this broke launching the daemon from Eclipse on MacOS, which
now fails because bazel is not on the path and can't be found.

Restore the removed functionality, but rename the file to .bazel_path

Change-Id: Ibd0ec09d3bf47f383ca68a37cca4e81640960416
2017-03-17 14:10:41 +09:00
David Pursehouse
34b59f0ad3 Get rid of references to .primary_build_tool
This was introduced to support both buck and bazel build tools, and
is no longer necessary since we completely dropped buck in favor of
bazel.

Change-Id: I5fc96bf1fc27f20180737fea954e150070e5302f
2017-03-15 08:38:05 +09:00
Han-Wen Nienhuys
8dfc795649 Make built-in bouncycastle actually work
This change fixes the following issues:

* server needs bcpkix for parsing public/private keys.

* do not special-case "jdk15on" in pkg_war.
  We only have these in the BC jars.

* remove BC specific license checking exceptions.

* remove language about requiring BC installed separately.

* remove BC special-casing from eclipse setup.

Tested:
  rm bin/* lib/* in testsite
  ran 141 -> 142 schema upgrade successfully
  ran daemon successfully
  LICENSE.txt in war file has an entry for the BC license
  Loaded new project in eclipse; verified that BouncyCastleUtil.java loads.

Change-Id: I80c2b0c038ada8397b44373194bd199f491a39c3
2017-02-20 15:02:06 +01:00
David Pursehouse
7e43d1d1ad Rename project_bzl.py to project.py
Since the project.py script was removed along with the buck-based
build, it's not necessary to keep the _bzl suffix on the script for
the bazel build.

Change-Id: I3f97cab5cc0e855a5dc1865bb4cc00c18adea2e9
2017-01-24 08:45:16 +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
David Ostrovsky
75944f35a5 Bazel: Fix eclipse classpath generation
I2b065a8ec exposed sources in GWT UI plugin API. Given that classpath
generation tool chain depends on GWT UI plugin API, the transitive
closure was now included in the Eclipse classpath. But we don't want
to include the source JARs, because the source directories themself
already included.

Reported-By: Hector Oswaldo Caballero <hector.caballero@ericsson.com>
Change-Id: Iaef7eecba48f08f327dce6af258d45408850d859
2016-12-01 08:48:23 +01: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
64e1aff339 Bazel: Generate source dir for plugins in eclipse classpath
Change-Id: I9f71808b2ce6b29523143bcc98de4a5f50a5dc94
2016-11-25 09:58:39 +00:00
David Ostrovsky
7f95f255c1 Bazel: Respect test dependencies for classpath generation
Test dependencies must be respected during classpath generation because
some third party dependencies can be only used for the tests, but not
for production code path. Otherwise, we would end up producng classpath
that missing some dependencies and thus compilation errors in the IDE.

This was the case with jimfs, that was added as implicit dependency to
the 'tools/eclipse:classpath' rule.

Skip Test_runner_deploy.jar library from the Eclipse classpath, as it
includes some other third party dependency (most notably outdated
auto-value) that could collide with our own version of those
dependencies, causing classpath collisions, see: [1] for the glory
details: [1]. This is safe thing to do, as we rely on the Eclipse as
JUnit test execution environment anyway.

* [1] https://github.com/bazelbuild/bazel/issues/2044

Change-Id: I87fff277695a2f64c44a3af65471c0c901860a02
2016-11-22 22:20:25 +00:00
David Ostrovsky
78fa1c8ba4 Bazel: Fix eclipse classpath generation on first build
For GWT SDM mode to work, we need not only libEdit.jar but also
libEdit-src.jar. However in Bazel it is only get built, when it
is explicitly invoked. That why we have to explicitly build this
target. Also remove the assert, because the eclipse classpath
generation happens before the actual build (to prevent having
empty .classpath when compilation errors exist).

Change-Id: I7ec51f1d9e3488742964c49a3d34b46cad4e6bc2
2016-11-22 13:29:27 +00:00
David Pursehouse
925251392e project_bzl: remove unused imports and variables
Change-Id: Ife73efc57bff7ebc6e87c135a473ab268d8e0114
2016-11-15 19:57:57 +00:00
Zhen Chen
a617c47f83 Add missing import for project.py
import os.makedirs

Change-Id: Ibc279c8b7f2bb5198f9fa3fd1dfa587ee75e88b0
2016-11-15 11:50:45 -08:00
David Ostrovsky
c69f360714 Bazel: Generate Eclipse classpath
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
2016-11-15 10:12:44 -08:00
David Ostrovsky
19b60b5527 Bazel: Gracefully ignore eclipse-out directory
Bazel doesn't provide a way to exclude scanning directories in project
root: [1]. Add workaround, by teaching Eclipse to exclude BUILD file
instead. With this workaround in place Eclipse and Bazel build can
co-exist:

  $ tools/eclipse/project.py # generates .classpath and other files
  # Start Eclipse and rebuild gerrit, eclipse-out is created
  $ bazel test ... # works as expected now

[1] https://github.com/bazelbuild/bazel/issues/1083

Change-Id: I7e767d0768af8bba3acc84d5fc242cab0e9abfdb
2016-10-30 08:51:31 +01:00
David Pursehouse
40db52bbcd Remove explicit dependency on jimfs in Eclipse classpath
This was added in change Ifad802fa6 ("Buck: Fix eclipse classpath
file generation") to work around a bug in buck [1] which has since
been fixed.

This reverts commit ab81f68776681d770ec9e3b045803c26df4027a5.

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

Change-Id: I47a7c9f92daf8ecc9df4c209ac8f948ad3d5ed41
2016-10-13 09:59:58 +09:00
David Ostrovsky
f8c0901db8 Fix Eclipse classpath generation for source jars
Bug: Issue 4646
Change-Id: I8f7e5fcb20a0a3c70f147abb0fe3bfc5c07e359c
2016-09-27 22:02:48 +02:00
David Ostrovsky
ab81f68776 Buck: Fix eclipse classpath file generation
As pointed out in this issue: [1] recent Buck version seems to have
regression on auditing transitive dependencies without providing
'--dot' option to audit classpath command.

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

Change-Id: Ifad802fa6b418783e330214d31cb69f3b0aed8b2
2016-09-20 14:54:58 +02:00
David Ostrovsky
3931c16bdb Build with Java 8
Change-Id: I06f811fc46a606b719582c0724e8d0c89e823b37
2016-09-20 10:19:52 +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 Pursehouse
6925f8a7e4 project.py: Allow to specify the name of the generated project
Eclipse won't allow to open multiple projects with the same name.

Add a --name option to the project.py to allow to specify the name
of the generated project. This will allow to have multiple Gerrit
workspaces in Eclipse at the same time.

Change-Id: I6f6809a0a42ee21262eadd5125beb344cbaf7dfe
2016-05-30 09:53:15 +00:00
David Ostrovsky
08ea694499 Buck: Remove jgit cell
Cross cell support in Buck is considered as experimental feature, with
number of open issues: [1], [2], [3].  Moreover, to make Maven Central
machinery work, it was needed to create symbolic links in source tree.
That broke `buck targets` feature.

Remove it for now, and re-consider to add it later.

[1] https://github.com/facebook/buck/issues/656
[2] https://github.com/facebook/buck/issues/658
[3] https://github.com/facebook/buck/issues/717

Bug: Issue 3954
Change-Id: Ic621a07771f926001df181b46b2169e214ce208a
2016-04-20 22:02:49 +02:00
Michael Zhou
42c22a8fc8 Use @GwtIncompatible to exclude files incompatible with GWT
Currently, GWT's Super Dev Mode shows "Ignored 7 units with
compilation errors in first pass". This is because the 6 files listed
in this change refer to classes / methods that are not emulated in GWT
and should be excluded from the compilation. The production build
doesn't suffer from this problem because we exclude them in
gerrit-common/BUCK.

Instead of listing them in BUCK, rely on Guava's handy
@GwtIncompatible annotation. This tells the GWT compiler to ignore the
file entirely, both in Super Dev Mode and production build.

Add "-strict" to the launch configurations of Super Dev Mode so that
developers can catch errors earlier.

Change-Id: I6e2d6be303fa888a9b4776aaae1148d4fd9a211c
2016-04-11 08:12:06 +00:00
David Pursehouse
cb7f914a20 project.py: always download sources
Instead of downloading the sources optionally, always download them.
This will help to catch problems introduced in the build that prevent
the sources from downloading (see [1] for example).

Keep the --src option but mark it as deprecated.

Add a new --no-src option to explicitly prevent download of sources.

[1] https://gerrit-review.googlesource.com/#/c/74859/

Change-Id: I9b6a9e210f83fe6a5663011dc5c0daeaa2f7fe46
2016-02-24 01:29:58 +00:00
David Ostrovsky
17bb3dbfe8 Buck: Allow to consume JGit from its own cell
Consume JGit as first third party library from its own cell. Normally
the cell is defined as lib/jgit directory. It can be easily replaced
with CLI:

  buck build --config repositories.jgit=path/to/dev/jgit gerrit

or tweaking the .buckconfig:

  [repositories]
    jgit = path/to/dev/jgit

The former approach is sufficient to build and run the test from the
CLI, the latter is needed to generate eclipse project.

To isolate the JGit rules in its own cell some refactoring was needed.
JGit patch for GWT module was moved to gerrit-patch-jgit project, and
some symlinks were needed for maven machinery to work. include_defs()
doesn't work for now across cell boundaries, and native `buck fetch`
feature still has some limitations: [1]. Moreover, excluding paths,
unsigning JARs and license linking should be re-implemented on top
of it.

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

Test Plan:

Normal gerrit build and the build with hijacked JGit cell should work
in both standalone (gerrit.war) and Eclipse environment. Note, that
to test --config repositories.jgit=path/to/dev/jgit use case, the most
recent JGit tree must be used, that contains Buck driven build
implementation.

Change-Id: I39f2d5d75bbac88804406d6242b5e714f4916926
2016-02-09 00:40:08 +00:00
David Ostrovsky
feeb212308 Update Buck to newest version
Now, that cross-cell support is implemented: [1] we can share rules
between projects. Cell is a container with its own buck-out directory.
The Buck design allows to replace a cell with alternative location.
This is a preparation change to support cross-cell dependencies.

The prerequisite for the hijacked cell to work properly, is that the
classpaths are always represented as absolute paths. That was not the
case in Buck implementation and thus classpath resolution across cell
boundaries was broken. This got fixed in: [2], [3].

[1] https://github.com/facebook/buck/issues/116
[2] https://github.com/facebook/buck/issues/545
[3] https://github.com/facebook/buck/pull/558

Change-Id: I3b17129c0f7ca5801f03091fff5651fb63d1482f
2016-01-28 03:12:05 +00:00
David Ostrovsky
d383d114c4 Polygerrit: Decouple bower components rebuild from dev workflow
According to the polygerrit "development story", any changes related
to polymer components (aka bower_components) involves buck invocations:

  buck run //tools/js:bower2buck -- -o /tmp/newbuck

That why it doesn't really make sense to try to optimize for this use
case and to refresh polymer components in running container. This only
makes polygerrit development unnecessary slow. We are getting the main
use case to refresh the polygerrit sources in running container for
granted due to mounting the PolyGerritUiServlet to the source path.

Remove bower components rebuild filter and store zip file system in
bower component own servlet instead of leaking it to GerritLauncher
instance. Eclipse project generation depends now also on polymer
components.

Test Plan:

* Run:

  buck build polygerrit && \
      java -jar buck-out/gen/polygerrit/polygerrit.war daemon \
      --polygerrit-dev -d ../gerrit_testsite

* Change polygerrit sources, refresh the browser window and observe
that the changes are reflected and that there is no delay for
unnecessary `buck build //polygerrit-ui:polygerrit_components`
invocations, every time browser window is refreshed.

Change-Id: If86bbbe14b9ddf0fa5001b2bbb9a39629e9b383f
2016-01-22 08:30:21 -05:00
Dave Borowitz
004bf2a928 Eclipse: List GWT deps after non-GWT deps
The stated purpose of separating libs and gwt_libs is to avoid
incorrect versions of classes used elsewhere in Gerrit (e.g. servlet
API 3.0 instead of 3.1). But we were iterating through gwt_libs first,
so this wasn't actually working. Swap the order.

Also change the prefix check for GWT deps to a contains check, as buck
audit at some point started returning absolute paths to jars.

Change-Id: Ic372b6bfaca5a8a1c1b9cc32aaf868a86a91c6ef
2015-12-02 09:30:25 -05:00
David Ostrovsky
58cb4b4881 Update Buck to newest version
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
2015-12-02 14:07:12 +00:00
David Ostrovsky
7722378708 Buck: Fix SDM debug session
I4212ac327a moved gwt-dev transitive dependencies to first order
dependencies, but broke eclipse project generation, as javax
validation is still needed. If47aad9d7 tried to fix it and added
dependency to the missing library, but missed to add a dependency
to the sources as well to fix SDM debug session.

Test plan:

SDM debug session works as expected.

Change-Id: I9cc4ebe60b38c0a38006a6f08c9d70415a7a100c
2015-10-25 10:22:29 +00:00
David Ostrovsky
b8aa263bb1 Buck: Fix eclipse project generation
I4212ac327a moved gwt-dev transitive dependencies to first order
dependencies. This broke eclipse project generation, as javax validation
is still needed. Add it explicitly again.

Change-Id: If47aad9d7a354f088e94770684ba07ac6c77a827
2015-10-19 18:30:10 +02:00
David Ostrovsky
805ef02aa3 Buck: Tweak Eclipse project generation to include sources again
Ib3f22e70b7 upgraded to new Buck version but broke sources download
during Eclipse project creation. That's because the namespacing of
genrule() artifact. To rectify and to avoid querying the actual
location of source artifact from Buck for every source library with:

  $ buck targets --show_output //lib:foo__download_src | awk '{print $2}'

switch from using genrule() to prebuilt_jar() to induce the source from
binary artifact, because the location is stable for this rule.

Change-Id: I153d3e31b4f7098ddd5157b7b1bba17529c83b32
2015-10-15 08:11:19 +02:00
David Ostrovsky
f377aa96de Update buck to the latest version
This version includes a lot of new features and improvements,
including:

* Switched to top-down-building, which should generally make builds
  faster. The old behavior can be bypassed by passing --deep on the
  command line [1]

* New query command was added (inspired by Bazel) [2]

* Performance improvement in file globbing

Extend tools/eclipse/project.py to pass the --deep option to ask Buck
to execute bottom-up build when generating the Eclipse project. This is
needed otherwise after using the buck clean command only the gerrit.war
file would be fetched from the cache and the buck-out/gen/lib folder
would remain empty.

With [3] genrule output is now namespaced with the genrule name. Adapt
documentation and references in the code to the new location of Buck
artifacts. Because of this change, `buck clean` must be issued after
Buck upgrade, otherwise the build would fail. The same prolem exists
when switching between branches: `buck clean` must be issued, otherwise
the build would fail.

Test plan:

* buck build release
* buck build api_install
* buck test
* install and verify new gerrit site
* upgrade and verify existing gerrit site
* reindex existing gerrit site
* verify that tools/eclipse/project.py produces sane Eclipse project
* verify that unit test execution from Eclipse works
* verify that daemon started from Eclipse works
* verify that GWT SDM debug session started from Eclipe works

[1] 217cec33bc
[2] https://buckbuild.com/command/query.html
[3] c92ef212b5

Change-Id: Ib3f22e70b7cb9eb9349618f2bcc018bf799c40f8
2015-10-09 08:51:35 +02:00
Dave Borowitz
b8336f176a Move most GPG-related code to a gerrit-gpg module
Bouncy Castle is still an optional dependency for Gerrit, so we want
to avoid accidentally attempting to load Bouncy Castle classes when
they might not be available. Rather than try to guard every
org.bouncycastle.* reference with a hasPGP() check, reduce the surface
area of calls that actually require Bouncy Castle. Move almost all
code that calls Bouncy Castle into a new module, gerrit-gpg.

Callers need only interact with this module by installing the
GpgModule, which is careful to protect all Bouncy Castle class loading
with the appropriate havePGP() check. Moreover, this module doesn't
need to be installed in the gerrit-server package at all, so we can
break the compile-time dependency between gerrit-server and Bouncy
Castle, so accidentally introducing a dependency on Bouncy Castle
results in a compile error.

The REST API and extension APIs dealing with GPG keys only refer to
the GpgKeyInfo POJO, and don't need to actually refer to Bouncy Castle
classes. Add a shim interface, GpgApiAdapter, that is used by
AccountApiImpl to process GPG keys. GpgModule binds this interface to
either the Bouncy Castle enabled implementation, or a not-implemented
implementation.

Since there are various places in the server code where we want to
inspect whether signed push is enabled at the server level, but we
don't want to have to call into gerrit-gpg code to do this, bind a
boolean with @EnableSignedPush from GpgModule.

Change-Id: Idbab00a52d86216cae73d02876d56be54aef6581
2015-08-28 14:13:13 -04:00
David Ostrovsky
94aab1bd2b SDM: Fix launch configuration to find gerrit-plugin-gwtui module
This is needed to allow inspection of GWT plugin modules in SDM debug
session. Also document the needed step to extend launch configuration
with plugin GWT module name and source folder location.

Change-Id: I57bda915ba8fcd163a415e311021bf05cdd6c9e0
2015-07-27 02:59:26 +00:00
David Ostrovsky
f3285e0280 Buck: Fix eclipse project generation
After refactoring done in Ia46c0559a lib/jgit is recognized as source
folder for the non existing Edit patch library:

  $ buck audit classpath //gerrit-gwtui:ui_module
  buck-out/gen/lib/jgit/lib__Edit__output/Edit.jar

As the consequence non existing path is induced from it and included
in .classpath file:

  path="/home/davido/projects/gerrit/lib/jgit/src/main/java"

Add a check for existence of source folder and include it only if the
folder exists.

Change-Id: Icef39196173722c9c8b760c041a4c9ec9d22ab7c
2015-06-26 05:41:48 +00:00
Björn Pedersen
c357cebdae tools: use python on path
Use the canonical syntax to specify the python executable to use.

Avoids a fatal error if /usr/bin/python is a too old version (< 2.7).

Change-Id: I3e8affb52be993d35c0dcf90774d962a59ef5635
2015-06-18 17:10:11 +02:00
David Pursehouse
686bfea7b3 Fix minor python code style issues
Fix some minor issues that were reported by pyflakes and pylint.

- Rename arguments to prevent redefinition of built-in 'dir'
- Rename method call to prevent redefinition of built-in 'help'
- Remove unused imports
- Prefix unused variable with underscore to prevent warning

Change-Id: Ia9e21c0f1a69af43f6e4566be46c31bdda540d2f
2014-12-18 02:51:06 +00:00
David Ostrovsky
500f2c98c8 Improve GWT SDM debug session recompilation time by a factor of 10
One of the major features of upcoming GWT release 2.7 is incremental
compilation in SDM session.  Because Buck recompilation is
integrated as HTTP filter on every request, this optimization is
jeopardized: Buck is unaware that a SDM debug session is active.
We cannot entirely skip the Buck integration in SDM debug session
as the site must be initialized at least once.

Pass a Java property from Eclipse launch configuration and maintain
initialization map with initialized flag per user agent for the site.
This improves the time by a factor of 10, ca. 2 sec. for incremental
recompilation on my laptop:

   Compilation succeeded -- 1,822s
   Linking into
   <site>/gerrit-gwtui/com.google.gerrit.GerritGwtUI/compile-5/war/gerrit_ui;
   Writing extras to
   <site>/gerrit-gwtui/com.google.gerrit.GerritGwtUI/compile-5/extras/gerrit_ui
   Link succeeded
   Linking succeeded -- 0,190s
   2,140s total -- Compile completed

Change-Id: Id2cb19a675d500c04e6748216a77dbb4f26fa1ab
2014-12-04 11:23:14 +09: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
Dave Borowitz
08180de4de Support AutoValue
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
2014-11-08 08:31:08 -08:00
Stefan Lay
e0368d860f Add test sources to .classpath files of eclipse plugin projects
Change-Id: I274e7d52648eff78f8cf218b8146bdedac7f8007
Signed-off-by: Stefan Lay <stefan.lay@sap.com>
2014-10-02 09:43:05 +02:00
Saša Živkov
353f8752a8 Merge "Add an option to create eclipse projects also for plugins" 2014-09-24 07:57:18 +00:00
Stefan Lay
2e9a46e923 Add an option to create eclipse projects also for plugins
With the option --plugins project.py creates an own eclipse project
for each plugin. The plugin projects depend on the /gerrit project.
All libraries in the gerrit project are exported now in order to make
them available for the plugin projects.

The advantage of this is that now each eclipse project only contains
sources belonging to a single git repository. EGit assumes one git
repository per eclipse project. When the plugin sources are part of the
gerrit eclipse project, EGit cannot determine the git repository
correctly.

Change-Id: I154ca2e474e5a729d2adc2ec44fcfd9429387e51
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
2014-09-23 14:40:32 +02:00
Dave Borowitz
9c4a47051f Delete GWT DevMode launcher
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
2014-09-11 10:08:36 +00:00
Dave Borowitz
a5510e3490 Merge "GWT SuperDevMode: Spawn codeserver and Daemon in same process" 2014-09-10 16:51:46 +00: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