Buck: Add support for gerrit GWT plugins
This changes extends gerrit_plugin function with additional gwt_module parameters. When passed, GWT application is created. Assumtion is met, that this application depends on gerrit-plugin-gwtui module. With this change Gerrit GWT plugins can be build with Buck: MODULE = 'com.googlesource.gerrit.plugins.cookbook.HelloForm' gerrit_plugin( name = 'cookbook-plugin', srcs = glob(['src/main/java/**/*.java']), resources = glob(['src/main/**/*']), gwt_module = MODULE, manifest_entries = [ 'Gerrit-PluginName: cookbook', 'Gerrit-Module: com.googlesource.gerrit.plugins.cookbook.Module', 'Gerrit-HttpModule: com.googlesource.gerrit.plugins.cookbook.HttpModule', 'Gerrit-SshModule: com.googlesource.gerrit.plugins.cookbook.SshModule', ] ) Change-Id: I4b131c7c2672675d99457651fcee63bf4f149c2f
This commit is contained in:
parent
61041106db
commit
c53827816d
@ -1,4 +1,5 @@
|
||||
include_defs('//gerrit-gwtui/gwt.defs')
|
||||
include_defs('//tools/gwt-constants.defs')
|
||||
|
||||
genrule(
|
||||
name = 'ui_optdbg',
|
||||
@ -25,14 +26,7 @@ genrule(
|
||||
gwt_application(
|
||||
name = 'ui_opt',
|
||||
module_target = MODULE,
|
||||
compiler_opts = [
|
||||
'-strict',
|
||||
'-style', 'OBF',
|
||||
'-optimize', '9',
|
||||
'-XdisableClassMetadata',
|
||||
'-XdisableCastChecking',
|
||||
'-XenableClosureCompiler',
|
||||
],
|
||||
compiler_opts = GWT_COMPILER_OPTS,
|
||||
deps = APP_DEPS,
|
||||
)
|
||||
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
# Rule definitions loaded by default into every BUCK file.
|
||||
|
||||
include_defs('//tools/gwt-constants.defs')
|
||||
|
||||
def genantlr(
|
||||
name,
|
||||
srcs,
|
||||
@ -128,6 +130,7 @@ def gerrit_plugin(
|
||||
deps = [],
|
||||
srcs = [],
|
||||
resources = [],
|
||||
gwt_module = None,
|
||||
manifest_file = None,
|
||||
manifest_entries = [],
|
||||
type = 'plugin',
|
||||
@ -149,20 +152,47 @@ def gerrit_plugin(
|
||||
srcs = mf_src,
|
||||
out = 'MANIFEST.MF',
|
||||
)
|
||||
gwt_deps = []
|
||||
static_jars = []
|
||||
if gwt_module:
|
||||
gwt_deps = GWT_PLUGIN_DEPS
|
||||
static_jars = [':%s-static-jar' % name]
|
||||
java_library2(
|
||||
name = name + '__plugin',
|
||||
srcs = srcs,
|
||||
resources = resources,
|
||||
deps = deps,
|
||||
compile_deps = ['//:%s-lib' % type],
|
||||
compile_deps = ['//:%s-lib' % type] + gwt_deps,
|
||||
)
|
||||
if gwt_module:
|
||||
prebuilt_jar(
|
||||
name = '%s-static-jar' % name,
|
||||
binary_jar = genfile('%s-static.zip' % name),
|
||||
deps = [':%s-static' % name],
|
||||
)
|
||||
genrule(
|
||||
name = '%s-static' % name,
|
||||
cmd = 'mkdir -p $TMP/static' +
|
||||
';unzip -qd $TMP/static $(location %s)' %
|
||||
':%s__gwt_application' % name +
|
||||
';cd $TMP' +
|
||||
';zip -qr $OUT .',
|
||||
out = '%s-static.zip' % name,
|
||||
deps = [':%s__gwt_application' % name]
|
||||
)
|
||||
gwt_application(
|
||||
name = name + '__gwt_application',
|
||||
module_target = gwt_module,
|
||||
compiler_opts = GWT_COMPILER_OPTS,
|
||||
deps = [':%s__plugin' % name] + gwt_deps,
|
||||
)
|
||||
java_binary(
|
||||
name = name,
|
||||
manifest_file = genfile('MANIFEST.MF'),
|
||||
deps = [
|
||||
':%s__plugin' % name,
|
||||
':%s__manifest' % name,
|
||||
],
|
||||
] + static_jars,
|
||||
visibility = visibility,
|
||||
)
|
||||
|
||||
|
13
tools/gwt-constants.defs
Normal file
13
tools/gwt-constants.defs
Normal file
@ -0,0 +1,13 @@
|
||||
GWT_COMPILER_OPTS = [
|
||||
'-strict',
|
||||
'-style', 'OBF',
|
||||
'-optimize', '9',
|
||||
'-XdisableClassMetadata',
|
||||
'-XdisableCastChecking',
|
||||
'-XenableClosureCompiler',
|
||||
]
|
||||
|
||||
GWT_PLUGIN_DEPS = [
|
||||
'//gerrit-plugin-gwtui:client',
|
||||
'//lib/gwt:user',
|
||||
]
|
Loading…
Reference in New Issue
Block a user