Add standalone BUCK build Change-Id: Ib3799ea6d41f214ceec8548f115784cb6d4b4127
diff --git a/.buckconfig b/.buckconfig new file mode 100644 index 0000000..c897236 --- /dev/null +++ b/.buckconfig
@@ -0,0 +1,13 @@ +[alias] + ref-protection = //:ref-protection + plugin = //:ref-protection + +[java] + src_roots = java, resources + +[project] + ignore = .git + +[cache] + mode = dir + dir = buck-out/cache
diff --git a/.gitignore b/.gitignore index 68892bf..cedbcae 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,6 +1,11 @@ -/target -/.classpath -/.project -/.settings/org.maven.ide.eclipse.prefs -/.settings/org.eclipse.m2e.core.prefs -/.idea +buck-out/ +bucklets +target/ +.buckd/ +.buckversion +.classpath +.project +.settings/org.maven.ide.eclipse.prefs +.settings/org.eclipse.m2e.core.prefs +.idea +.watchmanconfig
diff --git a/BUCK b/BUCK index 3351729..e0ae59e 100644 --- a/BUCK +++ b/BUCK
@@ -1,3 +1,5 @@ +include_defs('//bucklets/gerrit_plugin.bucklet') + gerrit_plugin( name = 'ref-protection', srcs = glob(['src/main/java/**/*.java']), @@ -10,6 +12,11 @@ ], ) +java_library( + name = 'classpath', + deps = [':ref-protection__plugin'], +) + java_test( name = 'ref-protection_tests', srcs = glob(['src/test/java/**/*.java']),
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK new file mode 100644 index 0000000..96d016a --- /dev/null +++ b/lib/gerrit/BUCK
@@ -0,0 +1,13 @@ +include_defs('//bucklets/maven_jar.bucklet') + +VER = '2.11' +REPO = MAVEN_CENTRAL + +maven_jar( + name = 'plugin-api', + id = 'com.google.gerrit:gerrit-plugin-api:' + VER, + sha1 = 'be80ff991f7b9f8669b7a2a399003ec1ae69ed31', + license = 'Apache2.0', + attach_source = False, + repository = REPO, +)
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md new file mode 100644 index 0000000..4c31765 --- /dev/null +++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,73 @@ +Build +===== + +This plugin is built with Buck. + +Two build modes are supported: Standalone and in Gerrit tree. Standalone +build mode is recommended, as this mode doesn't require local Gerrit +tree to exist. + +Build standalone +---------------- + +Clone bucklets library: + +``` + git clone https://gerrit.googlesource.com/bucklets + +``` +and link it to ref-protection directory: + +``` + cd ref-protection && ln -s ../bucklets . +``` + +Add link to the .buckversion file: + +``` + cd ref-protection && ln -s bucklets/buckversion .buckversion +``` + +Add link to the .watchmanconfig file: + +``` + cd ref-protection && ln -s bucklets/watchmanconfig .watchmanconfig +``` + +To build the plugin, issue the following command: + + +``` + buck build plugin +``` + +The output is created in + +``` + buck-out/gen/ref-protection.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/ref-protection +``` + +The output is created in + +``` + buck-out/gen/plugins/ref-protection/ref-protection.jar +``` + +This project can be imported into the Eclipse IDE: + +``` + ./tools/eclipse/project.py +``` + +How to build the Gerrit Plugin API is described in the [Gerrit +documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files).