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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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>
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
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