Add bucklet based build to plugin archetype

If a plugin project is generated with the Maven plugin archetype it
should immediately be buildable with Buck, because Buck is our
preferred build tool for building plugins.

Change-Id: I158dc3df76e4585d9894b0be862aef4d13deb478
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2014-07-11 11:12:32 +02:00
parent f0ed6d5ac7
commit 9634f78025
7 changed files with 147 additions and 0 deletions

View File

@ -58,6 +58,17 @@ limitations under the License.
</includes>
</fileSet>
<fileSet filtered="true">
<directory></directory>
<include>.buckconfig</include>
<include>BUCK</include>
<include>VERSION</include>
<include>lib/gerrit/BUCK</include>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</fileSet>
<fileSet>
<directory></directory>
<includes>

View File

@ -0,0 +1,14 @@
[alias]
${pluginName} = //:${pluginName}
plugin = //:${pluginName}
[java]
src_roots = java, resources
[project]
ignore = .git
[cache]
mode = dir
dir = buck-out/cache

View File

@ -1,3 +1,7 @@
/.buckversion
/.buckd
/buck-out
/bucklets
/target
/.classpath
/.project

View File

@ -0,0 +1,22 @@
include_defs('//bucklets/gerrit_plugin.bucklet')
gerrit_plugin(
name = '${pluginName}',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/resources/**/*']),
manifest_entries = [
'Gerrit-PluginName: ${pluginName}',
'Gerrit-ApiType: ${gerritApiType}',
'Gerrit-ApiVersion: ${gerritApiVersion}',
'Gerrit-Module: ${package}.Module',
'Gerrit-SshModule: ${package}.SshModule',
'Gerrit-HttpModule: ${package}.HttpModule',
],
)
# this is required for bucklets/tools/eclipse/project.py to work
java_library(
name = 'classpath',
deps = [':${pluginName}__plugin'],
)

View File

@ -0,0 +1,5 @@
# Used by BUCK to include "Implementation-Version" in plugin Manifest.
# If this file doesn't exist the output of 'git describe' is used
# instead.
PLUGIN_VERSION = '${version}'

View File

@ -0,0 +1,12 @@
include_defs('//bucklets/maven_jar.bucklet')
VER = '${gerritApiVersion}'
REPO = MAVEN_LOCAL
maven_jar(
name = '${gerritApiType}-api',
id = 'com.google.gerrit:gerrit-${gerritApiType}-api:' + VER,
attach_source = False,
repository = REPO,
license = 'Apache2.0',
)

View File

@ -0,0 +1,79 @@
Build
=====
This plugin can be built with Buck or Maven.
Buck
----
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:
```
git clone https://gerrit.googlesource.com/bucklets
```
and link it to @PLUGIN@ plugin directory:
```
cd @PLUGIN@ && ln -s ../bucklets .
```
Add link to the .buckversion file:
```
cd @PLUGIN@ && ln -s bucklets/buckversion .buckversion
```
To build the plugin, issue the following command:
```
buck build plugin
```
The output is created in
```
buck-out/gen/@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:
```
./tools/eclipse/project.py
```
Maven
-----
Note that the Maven build is provided for compatibility reasons, but
it is considered to be deprecated and will be removed in a future
version of this plugin.
To build with Maven, run
```
mvn clean package
```