10 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
David Ostrovsky
930f29e2fd Bazel: Automatically fix lint errors with buildifier
In recent buildifier versions, lint errors can be fixed automatically:

  $ find . \( -name BUILD -o -name "*.bzl" \) -print \
      | xargs buildifier --lint=fix

This commit was created with Buildifier version 0.19.2:

  $ buildifier --version
buildifier version: 0.19.2
buildifier scm revision: d39e4d5c25111527369142f16cdb49aa67707313

Change-Id: I1f06cd4596e794981ccc2d9fc2d1da9b17f3973a
2019-01-08 23:11:59 +01:00
David Pursehouse
1fa4bcfb6e Bazel: Clean up package visibility settings
For packages having a default visiblity defined, it is redundant to also
set the same visibility per package, so remove those.

For packages that only have one rule, and its visibility differs from the
default visibility, remove the default visibility.

Also clean up wrapping of some of the default definitions.

Change-Id: I9e81c3f724b4ffde7a652b485d33c650866ad122
2018-12-07 11:07:41 +09:00
David Pursehouse
3f988d2c28 Revert refactoring of Account.USER_NAME_PATTERN
In changes I02ce9c6b6 ("Optimize USER_NAME_PATTERN string and its
usage") and I8082b2ad3 ("Account.java: introduce compiled pattern
and use where applicable"), the usage of Account.USER_NAME_PATTERN
was refactored.

This refactoring conflicts with separate refactoring that was done
on the master branch. Instead of trying to resolve the conflicts,
which ends up with the changes effectively being reverted, just
revert them here. The refactoring that was done on master can then
be backported here.

This reverts commit 1ee03aa948553654283702220cbf36798ac1e45e.
This reverts commit cf97d694febd26aeea66c6f16355a721860f80fd.

Change-Id: I199d2f1531ec2b59d4263f1b72f1c967913bb9a5
2018-09-05 12:28:01 +09:00
Jacek Centkowski
1ee03aa948 Account.java: introduce compiled pattern and use where applicable
There is no point in compiling USER_NAME_PATTERN over and over again
in all those places where it is used hence compiled version was added.

Note that original version was kept so that there is no collateral
damage in plugins that use it.

Change-Id: I8082b2ad3e04a6407e9c41f969a0e274386b63ab
Signed-off-by: Jacek Centkowski <jcentkowski@collab.net>
2018-09-03 17:44:51 +02:00
David Ostrovsky
f98a60b35f 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-08 19:33:01 +09: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 Pursehouse
1f9b0c76ef PatchSetApprovalTest: Extend GerritBaseTests
Remove the setup of KeyUtil which is now done in GerritBaseTests.

Change-Id: Ia84c41e3a21d0867e81d951e1b5a619953ead253
2016-11-22 10:05:47 +09:00
Han-Wen Nienhuys
888f4ac705 bazel: generate the classpath in a file, for use with eclipse.
Change-Id: I6562c045a7e47c6661889d63f3103e1aeef113ec
2016-11-14 23:23:56 -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