Add buck standalone build Change-Id: If20d5473313bebf521a50b25749ce9cd9d4f92a6
diff --git a/.buckconfig b/.buckconfig new file mode 100644 index 0000000..6148033 --- /dev/null +++ b/.buckconfig
@@ -0,0 +1,17 @@ +[alias] + admin-console = //:admin-console + plugin = //:admin-console + src = //:admin-console-sources + +[java] + jar_spool_mode = direct_to_jar + src_roots = java, resources + +[project] + ignore = .git, eclipse-out/ + parallel_parsing = true + +[cache] + mode = dir + dir = buck-out/cache +
diff --git a/.gitignore b/.gitignore index 0ebe6cf..07ac684 100644 --- a/.gitignore +++ b/.gitignore
@@ -1,5 +1,11 @@ -/target +/.buckd/ +/.buckversion /.classpath -/.settings -/.project *.DS_Store +/.project +/.settings +/.watchmanconfig +/buck-out/ +/bucklets +/eclipse-out/ +/target
diff --git a/BUCK b/BUCK index 17b8fee..87cc534 100644 --- a/BUCK +++ b/BUCK
@@ -1,7 +1,13 @@ +include_defs('//bucklets/gerrit_plugin.bucklet') +include_defs('//bucklets/java_sources.bucklet') + +SOURCES = glob(['src/main/java/**/*.java']) +RESOURCES = glob(['src/main/resources/**/*']) + gerrit_plugin( name = 'admin-console', - srcs = glob(['src/main/java/**/*.java']), - resources = glob(['src/main/resources/**/*']), + srcs = SOURCES, + resources = RESOURCES, manifest_entries = [ 'Gerrit-PluginName: admin-console', 'Gerrit-SshModule: com.googlesource.gerrit.plugins.adminconsole.AdminConsoleCommandModule', @@ -9,3 +15,15 @@ 'Implementation-URL: https://gerrit-review.googlesource.com/#/admin/projects/plugins/admin-console', ] ) + +java_library( + name = 'classpath', + deps = GERRIT_PLUGIN_API + [ + ':admin-console__plugin', + ], +) + +java_sources( + name = 'admin-console-sources', + srcs = SOURCES + RESOURCES, +)
diff --git a/lib/gerrit/BUCK b/lib/gerrit/BUCK new file mode 100644 index 0000000..53cc550 --- /dev/null +++ b/lib/gerrit/BUCK
@@ -0,0 +1,14 @@ +include_defs('//bucklets/maven_jar.bucklet') + +VER = '2.12.4' +REPO = MAVEN_CENTRAL + +maven_jar( + name = 'plugin-api', + id = 'com.google.gerrit:gerrit-plugin-api:' + VER, + sha1 = 'aad189fe4f9fa5c3f8048b5e4972512b4b3e2a24', + attach_source = False, + repository = REPO, + license = 'Apache2.0', +) +
diff --git a/src/main/resources/Documentation/build.md b/src/main/resources/Documentation/build.md new file mode 100644 index 0000000..b4af23f --- /dev/null +++ b/src/main/resources/Documentation/build.md
@@ -0,0 +1,118 @@ +Build +===== + +This plugin is built with Buck or Maven. + +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 @PLUGIN@ directory: + +``` + cd @PLUGIN@ && ln -s ../bucklets . +``` + +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 +``` + +The output is created in: + +``` + buck-out/gen/@PLUGIN@.jar +``` + +This project can be imported into the Eclipse IDE: + +``` + ./bucklets/tools/eclipse.py +``` + +To execute the tests run: + +``` + buck test +``` + +To build plugin sources run: + +``` + buck build src +``` + +The output is created in: + +``` + buck-out/gen/@PLUGIN@-sources.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: + +``` + ./tools/eclipse/project.py +``` + +To execute the tests run: + +``` + buck test --include @PLUGIN@ +``` + +Maven +----- + +To build with Maven, run + +``` +mvn clean package +``` + +How to build the Gerrit Plugin API is described in the [Gerrit +documentation](../../../Documentation/dev-buck.html#_extension_and_plugin_api_jar_files). + +[Back to @PLUGIN@ documentation index][index] + +[index]: index.html