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('//gerrit-gwtui/gwt.defs')
|
||||||
|
include_defs('//tools/gwt-constants.defs')
|
||||||
|
|
||||||
genrule(
|
genrule(
|
||||||
name = 'ui_optdbg',
|
name = 'ui_optdbg',
|
||||||
@ -25,14 +26,7 @@ genrule(
|
|||||||
gwt_application(
|
gwt_application(
|
||||||
name = 'ui_opt',
|
name = 'ui_opt',
|
||||||
module_target = MODULE,
|
module_target = MODULE,
|
||||||
compiler_opts = [
|
compiler_opts = GWT_COMPILER_OPTS,
|
||||||
'-strict',
|
|
||||||
'-style', 'OBF',
|
|
||||||
'-optimize', '9',
|
|
||||||
'-XdisableClassMetadata',
|
|
||||||
'-XdisableCastChecking',
|
|
||||||
'-XenableClosureCompiler',
|
|
||||||
],
|
|
||||||
deps = APP_DEPS,
|
deps = APP_DEPS,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
|
|
||||||
# Rule definitions loaded by default into every BUCK file.
|
# Rule definitions loaded by default into every BUCK file.
|
||||||
|
|
||||||
|
include_defs('//tools/gwt-constants.defs')
|
||||||
|
|
||||||
def genantlr(
|
def genantlr(
|
||||||
name,
|
name,
|
||||||
srcs,
|
srcs,
|
||||||
@ -128,6 +130,7 @@ def gerrit_plugin(
|
|||||||
deps = [],
|
deps = [],
|
||||||
srcs = [],
|
srcs = [],
|
||||||
resources = [],
|
resources = [],
|
||||||
|
gwt_module = None,
|
||||||
manifest_file = None,
|
manifest_file = None,
|
||||||
manifest_entries = [],
|
manifest_entries = [],
|
||||||
type = 'plugin',
|
type = 'plugin',
|
||||||
@ -149,20 +152,47 @@ def gerrit_plugin(
|
|||||||
srcs = mf_src,
|
srcs = mf_src,
|
||||||
out = 'MANIFEST.MF',
|
out = 'MANIFEST.MF',
|
||||||
)
|
)
|
||||||
|
gwt_deps = []
|
||||||
|
static_jars = []
|
||||||
|
if gwt_module:
|
||||||
|
gwt_deps = GWT_PLUGIN_DEPS
|
||||||
|
static_jars = [':%s-static-jar' % name]
|
||||||
java_library2(
|
java_library2(
|
||||||
name = name + '__plugin',
|
name = name + '__plugin',
|
||||||
srcs = srcs,
|
srcs = srcs,
|
||||||
resources = resources,
|
resources = resources,
|
||||||
deps = deps,
|
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(
|
java_binary(
|
||||||
name = name,
|
name = name,
|
||||||
manifest_file = genfile('MANIFEST.MF'),
|
manifest_file = genfile('MANIFEST.MF'),
|
||||||
deps = [
|
deps = [
|
||||||
':%s__plugin' % name,
|
':%s__plugin' % name,
|
||||||
':%s__manifest' % name,
|
':%s__manifest' % name,
|
||||||
],
|
] + static_jars,
|
||||||
visibility = visibility,
|
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