Add bucklet based build to GWT plugin archetype

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

Change-Id: I837a48cb02deedd2ca29aeb2adeb563a26b0e196
Signed-off-by: Edwin Kempin <edwin.kempin@sap.com>
This commit is contained in:
Edwin Kempin 2014-10-28 17:37:45 +01:00
parent 0b2f24cd04
commit 5b178b5d29
8 changed files with 187 additions and 0 deletions

View File

@ -51,6 +51,18 @@ 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>
<include>lib/gwt/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,23 @@
include_defs('//bucklets/gerrit_plugin.bucklet')
gerrit_plugin(
name = '${pluginName}',
srcs = glob(['src/main/java/**/*.java']),
resources = glob(['src/main/**/*']),
gwt_module = '${package}.HelloPlugin',
manifest_entries = [
'Gerrit-PluginName: ${pluginName}',
'Gerrit-ApiType: plugin',
'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,20 @@
include_defs('//bucklets/maven_jar.bucklet')
VER = '${gerritApiVersion}'
REPO = MAVEN_LOCAL
maven_jar(
name = 'plugin-api',
id = 'com.google.gerrit:gerrit-plugin-api:' + VER,
attach_source = False,
repository = REPO,
license = 'Apache2.0',
)
maven_jar(
name = 'gwtui-api',
id = 'com.google.gerrit:gerrit-plugin-gwtui:' + VER,
attach_source = False,
repository = REPO,
license = 'Apache2.0',
)

View File

@ -0,0 +1,32 @@
include_defs('//bucklets/maven_jar.bucklet')
VERSION = '${Gwt-Version}'
maven_jar(
name = 'user',
id = 'com.google.gwt:gwt-user:' + VERSION,
license = 'Apache2.0',
attach_source = False,
)
maven_jar(
name = 'dev',
id = 'com.google.gwt:gwt-dev:' + VERSION,
license = 'Apache2.0',
deps = [
':javax-validation',
':javax-validation_src',
],
attach_source = False,
exclude = ['org/eclipse/jetty/*'],
)
maven_jar(
name = 'javax-validation',
id = 'javax.validation:validation-api:1.0.0.GA',
bin_sha1 = 'b6bd7f9d78f6fdaa3c37dae18a4bd298915f328e',
src_sha1 = '7a561191db2203550fbfa40d534d4997624cd369',
license = 'Apache2.0',
visibility = [],
)

View File

@ -0,0 +1,77 @@
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.
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
```
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
```