Add support for Bazel in Gerrit tree build Change-Id: I05d24424e3f7a3d74835d8a0a7192afa459798e3
diff --git a/BUILD b/BUILD new file mode 100644 index 0000000..d441b3c --- /dev/null +++ b/BUILD
@@ -0,0 +1,14 @@ +load("//tools/bzl:plugin.bzl", "gerrit_plugin") + +gerrit_plugin( + name = "importer", + srcs = glob(["src/main/java/**/*.java"]), + gwt_module = "com.googlesource.gerrit.plugins.importer.Importer", + manifest_entries = [ + "Gerrit-PluginName: importer", + "Gerrit-Module: com.googlesource.gerrit.plugins.importer.Module", + "Gerrit-SshModule: com.googlesource.gerrit.plugins.importer.SshModule", + "Gerrit-HttpModule: com.googlesource.gerrit.plugins.importer.HttpModule", + ], + resources = glob(["src/main/**/*"]), +)
diff --git a/src/main/resources/Documentation/about.md b/src/main/resources/Documentation/about.md index b7b867e..b914b97 100644 --- a/src/main/resources/Documentation/about.md +++ b/src/main/resources/Documentation/about.md
@@ -32,7 +32,6 @@ administrators can see who imported when which project. Imports do also send audit events. -<a id="project-import"> ### Project Import The import project functionality allows to import (move) a project from @@ -44,7 +43,6 @@ Draft changes, draft patch sets, change edits and draft comments are *not* imported. -<a id="project-import-process"> #### Process A project import would be done in several steps: @@ -72,7 +70,6 @@ fast since it only needs to transfer the delta since the initial (last) import. -<a id="project-import-preconditions"> #### Preconditions Preconditions for a project import: @@ -106,7 +103,6 @@ All locally created users are added to an internal group called "Imported Users". -<a id="project-import-commands"> #### Commands Importing a project can be done via @@ -132,7 +128,6 @@ When doing a project import the project in the target Gerrit server can be created with a new name or under another parent project. -<a id="project-import-steps"> #### How the project import works The project import is implemented in such a way that it replays the @@ -163,7 +158,6 @@ global capability is assigned) * add link to original change as a new change message -<a id="import-file"> #### Import File At a point in time a project can be imported only by a single process. @@ -177,7 +171,6 @@ input parameters do not need to be specified again when the import is resumed. -<a id="resume-project-import"> #### Resume Project Import Once a project was imported, the project import can be resumed to @@ -207,7 +200,6 @@ This means that any modification of these properties in the target Gerrit server is overridden if the import of a change is resumed. -<a id="complete-project-import"> #### Complete Project Import Completing the project import deletes all refs under the @@ -216,7 +208,6 @@ project import anymore. Also the project doesn't appear in the list of imported projects anymore. -<a id="project-copy"> ### Project Copy Project copy is a special case of project import, where a project from @@ -226,7 +217,6 @@ is granted the 'Copy Project' capability (provided by this plugin) or the 'Administrate Server' capability. -<a id="project-copy-commands"> #### Commands Copying a project can be done via @@ -253,14 +243,12 @@ parent project. But you can reparent the project copy after the copy is done. -<a id="project-rename"> ### Project Rename By doing a [project copy](#project-copy) and then using the [delete-project](https://gerrit.googlesource.com/plugins/delete-project/+doc/master/src/main/resources/Documentation/about.md) plugin to delete the source project, a project can be renamed. -<a id="group-import"> ### Group Import The import group functionality allows to import a Gerrit group from one @@ -270,7 +258,6 @@ preserved on import, but the default that is configured for this option on the target Gerrit server is applied to each imported group. -<a id="group-import-preconditions"> #### Preconditions Preconditions for a group import: @@ -304,7 +291,6 @@ Missing owner groups and missing included groups can be automatically imported into the target Gerrit server. -<a id="group-import-commands"> #### Commands Importing a group can be done via
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md index a96e116..3c49502 100644 --- a/src/main/resources/Documentation/build.md +++ b/src/main/resources/Documentation/build.md
@@ -1,71 +1,28 @@ Build ===== -This plugin can be built with Buck. +This plugin can be built with Bazel. -Buck ----- +Clone (or link) this plugin to the `plugins` directory of Gerrit's source tree. -Two build modes are supported: Standalone and in Gerrit tree. -The standalone build mode is recommended, as this mode doesn't require -the Gerrit tree to exist locally. - -### Build standalone - -Clone bucklets library: +Then issue ``` - git clone https://gerrit.googlesource.com/bucklets - -``` -and link it to @PLUGIN@ plugin directory: - -``` - cd @PLUGIN@ && ln -s ../bucklets . + bazel build plugins/@PLUGIN@ ``` -Add link to the .buckversion file: - -``` - cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion -``` - -Add link to the .watchmanconfig file: -``` - cd @PLUGIN@ && ln -s bucklets/watchmanconfig .watchmanconfig -``` - -To build the plugin, issue the following command: - - -``` - buck build plugin -``` +in the root of Gerrit's source tree to build The output is created in ``` - buck-out/gen/@PLUGIN@.jar + bazel-genfiles/plugins/@PLUGIN@/@PLUGIN@.jar ``` -### Build in Gerrit tree - -Clone or link this plugin to the plugins directory of Gerrit's source -tree, and issue the command: - -``` - buck build plugins/@PLUGIN@ -``` - -The output is created in - -``` - buck-out/gen/plugins/@PLUGIN@/@PLUGIN@.jar -``` - -This project can be imported into the Eclipse IDE: +This project can be imported into the Eclipse IDE. +Add the plugin name to the `CUSTOM_PLUGINS` set in +Gerrit core in `tools/bzl/plugins.bzl`, and execute: ``` ./tools/eclipse/project.py ``` -