5 Commits

Author SHA1 Message Date
David Ostrovsky
20c2fd4f0b Bazel: Add fixes for --incompatible_load_{java|python}_rules_from_bzl
This change is fixing "All Java build rules should be loaded from
Starlark" warning flagged by latest buildifier version: [1]. Python
rules are now also loaded from the Starlark.

Also extract codemirror library import to BUILD file. This is needed to
avoid cycle in the workspace file, after importing java rules from
Starlark.

[1] https://github.com/bazelbuild/buildtools/blob/master/WARNINGS.md#native-java

Change-Id: I36192c9465d988b25cf09c250e110f15850910cd
2019-09-02 00:42:25 +02:00
Han-Wen Nienhuys
9f76663fcb Set the workspace root through a JVM property sourceRoot
Before, the workspace root was compiled into the binary. Since our
tests depend on the GerritLauncher, this killed any kind of cross-user
test caching.

For Polygerrit development, run gerrit as

    java -DsourceRoot=/path/to/my/checkout -jar gerrit.war

Change-Id: I3321f26dafeb68bfa924c53b686d066a921803d0
2019-05-17 11:21:53 +02: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
e6c7e629c6 bazel: abstract the build system in static serving.
Provide BazelBuild to stub out the Bazel build.

Tested:

Production use case:
1.) bazel build polygerrit && \
    $(bazel info output_base)/external/local_jdk/bin/java \
     -jar bazel-bin/polygerrit.war daemon -d ../test_site \
     --console-log --show-stack-trace

Development mode use cases:
2.) bazel build polygerrit \
      //polygerrit-ui:polygerrit_components.bower_components.zip &&
    $(bazel info output_base)/external/local_jdk/bin/java \
     -jar bazel-bin/polygerrit.war daemon \
     --polygerrit-dev -d ../gerrit_testsite --console-log --show-stack-trace

checked that updates under polygerrit-ui/app/index.html are served
live.

3.) Run tools/eclipse/project.py, started gwt_daemon launcher,
verified that it worked.

4.) Run tools/eclipse/project.py, started gerit_gwt_debug launcher,
verified that GWT SDM worked.

Change-Id: I9d105e00e953b63c78306e9e37d5152673627727
2016-11-13 07:27:17 -08: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