Merge changes Ia6447e62,Ic09dc032,I7f1ee1d6,I26fd741d,I1f13f4d2

* changes:
  Buck: Rename gwtxml to gwt_xml in gwt_module()
  Buck: Omit default values to gwt_binary() rule
  Buck: Make gwt_module() rule more pythonic
  Buck: Merge deps and compile_deps parameters in gwt_module() rule
  Update Buck and use gwt_binary()
This commit is contained in:
Shawn Pearce
2014-05-19 19:30:04 +00:00
committed by Gerrit Code Review
18 changed files with 123 additions and 220 deletions

View File

@@ -1 +1 @@
021695d5e68cde7457c9849fd0a2397f91e6491e 75000f4273a399d2cd2768512639da80748877b7

2
BUCK
View File

@@ -5,7 +5,7 @@ gerrit_war(name = 'chrome', ui = 'ui_chrome')
gerrit_war(name = 'firefox', ui = 'ui_firefox') gerrit_war(name = 'firefox', ui = 'ui_firefox')
gerrit_war(name = 'safari', ui = 'ui_safari') gerrit_war(name = 'safari', ui = 'ui_safari')
gerrit_war(name = 'withdocs', docs = True) gerrit_war(name = 'withdocs', docs = True)
gerrit_war(name = 'release', docs = True, context = ['//plugins:core.zip'], visibility = ['//tools/maven:']) gerrit_war(name = 'release', docs = True, context = ['//plugins:core'], visibility = ['//tools/maven:'])
API_DEPS = [ API_DEPS = [
'//gerrit-extension-api:extension-api', '//gerrit-extension-api:extension-api',

View File

@@ -42,13 +42,6 @@ Verify that `buck` is accessible:
which buck which buck
---- ----
If you plan to use the link:#buck-daemon[Buck daemon] add a symbolic
link in `~/bin` to the buckd executable:
----
ln -s `pwd`/bin/buckd ~/bin/
----
To enable autocompletion of buck commands, install the autocompletion To enable autocompletion of buck commands, install the autocompletion
script from `./scripts/bash_completion` in the buck project. Refer to script from `./scripts/bash_completion` in the buck project. Refer to
the script's header comments for installation instructions. the script's header comments for installation instructions.
@@ -470,8 +463,8 @@ It is safe to run several buck daemons started from different project
directories and they will not interfere with each other. Buck's documentation directories and they will not interfere with each other. Buck's documentation
covers daemon in http://facebook.github.io/buck/command/buckd.html[buckd]. covers daemon in http://facebook.github.io/buck/command/buckd.html[buckd].
The trivial use case is to run `buckd` from the project's root directory and To use `buckd` the additional watchman program must be installed, see
run `buck` as usual: link:https://github.com/facebook/watchman[watchman] for details.
---- ----
buckd buckd

View File

@@ -20,14 +20,13 @@ java_library(
gwt_module( gwt_module(
name = 'client', name = 'client',
srcs = glob([SRC + 'common/**/*.java'], excludes = EXCLUDES), srcs = glob([SRC + 'common/**/*.java'], excludes = EXCLUDES),
gwtxml = SRC + 'Common.gwt.xml', gwt_xml = SRC + 'Common.gwt.xml',
deps = [ deps = [
':annotations',
'//gerrit-extension-api:client',
'//gerrit-patch-jgit:client', '//gerrit-patch-jgit:client',
'//gerrit-prettify:client', '//gerrit-prettify:client',
'//gerrit-reviewdb:client', '//gerrit-reviewdb:client',
],
compile_deps = [
':annotations',
'//lib:gwtjsonrpc', '//lib:gwtjsonrpc',
'//lib:gwtorm', '//lib:gwtorm',
'//lib/jgit:jgit', '//lib/jgit:jgit',

View File

@@ -10,7 +10,7 @@ gwt_module(
SRC + 'common/SubmitType.java', SRC + 'common/SubmitType.java',
SRC + 'webui/GerritTopMenu.java', SRC + 'webui/GerritTopMenu.java',
]), ]),
gwtxml = SRC + 'Extensions.gwt.xml', gwt_xml = SRC + 'Extensions.gwt.xml',
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )

View File

@@ -3,7 +3,7 @@ SRC = 'src/main/java/com/google/gwtexpui/'
gwt_module( gwt_module(
name = 'Clippy', name = 'Clippy',
srcs = glob([SRC + 'clippy/client/*.java']), srcs = glob([SRC + 'clippy/client/*.java']),
gwtxml = SRC + 'clippy/Clippy.gwt.xml', gwt_xml = SRC + 'clippy/Clippy.gwt.xml',
resources = [ resources = [
SRC + 'clippy/client/clippy.css', SRC + 'clippy/client/clippy.css',
SRC + 'clippy/client/clippy.swf', SRC + 'clippy/client/clippy.swf',
@@ -11,8 +11,6 @@ gwt_module(
deps = [ deps = [
':SafeHtml', ':SafeHtml',
':UserAgent', ':UserAgent',
],
compile_deps = [
'//lib/gwt:user', '//lib/gwt:user',
'//lib:LICENSE-clippy', '//lib:LICENSE-clippy',
], ],
@@ -30,7 +28,7 @@ java_library(
gwt_module( gwt_module(
name = 'GlobalKey', name = 'GlobalKey',
srcs = glob([SRC + 'globalkey/client/*.java']), srcs = glob([SRC + 'globalkey/client/*.java']),
gwtxml = SRC + 'globalkey/GlobalKey.gwt.xml', gwt_xml = SRC + 'globalkey/GlobalKey.gwt.xml',
resources = [ resources = [
SRC + 'globalkey/client/KeyConstants.properties', SRC + 'globalkey/client/KeyConstants.properties',
SRC + 'globalkey/client/key.css', SRC + 'globalkey/client/key.css',
@@ -38,8 +36,8 @@ gwt_module(
deps = [ deps = [
':SafeHtml', ':SafeHtml',
':UserAgent', ':UserAgent',
'//lib/gwt:user',
], ],
compile_deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )
@@ -53,18 +51,18 @@ java_library(
gwt_module( gwt_module(
name = 'Progress', name = 'Progress',
srcs = glob([SRC + 'progress/client/*.java']), srcs = glob([SRC + 'progress/client/*.java']),
gwtxml = SRC + 'progress/Progress.gwt.xml', gwt_xml = SRC + 'progress/Progress.gwt.xml',
resources = [SRC + 'progress/client/progress.css'], resources = [SRC + 'progress/client/progress.css'],
compile_deps = ['//lib/gwt:user'], deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )
gwt_module( gwt_module(
name = 'SafeHtml', name = 'SafeHtml',
srcs = glob([SRC + 'safehtml/client/*.java']), srcs = glob([SRC + 'safehtml/client/*.java']),
gwtxml = SRC + 'safehtml/SafeHtml.gwt.xml', gwt_xml = SRC + 'safehtml/SafeHtml.gwt.xml',
resources = [SRC + 'safehtml/client/safehtml.css'], resources = [SRC + 'safehtml/client/safehtml.css'],
compile_deps = ['//lib/gwt:user'], deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )
@@ -74,19 +72,19 @@ java_test(
'src/test/java/com/google/gwtexpui/safehtml/client/**/*.java', 'src/test/java/com/google/gwtexpui/safehtml/client/**/*.java',
]), ]),
deps = [ deps = [
':SafeHtml_lib', ':SafeHtml',
'//lib:junit', '//lib:junit',
'//lib/gwt:user', '//lib/gwt:user',
'//lib/gwt:dev', '//lib/gwt:dev',
], ],
source_under_test = [':SafeHtml_lib'], source_under_test = [':SafeHtml'],
) )
gwt_module( gwt_module(
name = 'UserAgent', name = 'UserAgent',
srcs = glob([SRC + 'user/client/*.java']), srcs = glob([SRC + 'user/client/*.java']),
gwtxml = SRC + 'user/User.gwt.xml', gwt_xml = SRC + 'user/User.gwt.xml',
compile_deps = ['//lib/gwt:user'], deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )

View File

@@ -3,8 +3,8 @@ SRC = 'src/main/java/com/google/gerrit/'
gwt_module( gwt_module(
name = 'client', name = 'client',
srcs = glob([SRC + 'client/**/*.java']), srcs = glob([SRC + 'client/**/*.java']),
gwtxml = SRC + 'GerritGwtUICommon.gwt.xml', gwt_xml = SRC + 'GerritGwtUICommon.gwt.xml',
compile_deps = ['//lib/gwt:user'], deps = ['//lib/gwt:user'],
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )

View File

@@ -1,20 +1,22 @@
include_defs('//gerrit-gwtui/gwt.defs') include_defs('//gerrit-gwtui/gwt.defs')
include_defs('//tools/gwt-constants.defs') include_defs('//tools/gwt-constants.defs')
from multiprocessing import cpu_count
DEPS = [
'//gerrit-gwtexpui:CSS',
'//lib:gwtjsonrpc',
]
genrule( genrule(
name = 'ui_optdbg', name = 'ui_optdbg',
cmd = 'cd $TMP;' + cmd = 'cd $TMP;' +
'unzip -q $SRCDIR/ui_dbg.zip;' + 'unzip -q $(location :ui_dbg);' +
'mv' + 'mv' +
' gerrit_ui/gerrit_ui.nocache.js' + ' gerrit_ui/gerrit_ui.nocache.js' +
' gerrit_ui/dbg_gerrit_ui.nocache.js;' + ' gerrit_ui/dbg_gerrit_ui.nocache.js;' +
'unzip -qo $SRCDIR/ui_opt.zip;' + 'unzip -qo $(location :ui_opt);' +
'mkdir -p $(dirname $OUT);' + 'mkdir -p $(dirname $OUT);' +
'zip -qr $OUT .', 'zip -qr $OUT .',
srcs = [
genfile('ui_dbg.zip'),
genfile('ui_opt.zip'),
],
deps = [ deps = [
':ui_dbg', ':ui_dbg',
':ui_opt', ':ui_opt',
@@ -23,28 +25,37 @@ genrule(
visibility = ['PUBLIC'], visibility = ['PUBLIC'],
) )
gwt_application( gwt_binary(
name = 'ui_opt', name = 'ui_opt',
module_target = MODULE, modules = [MODULE],
compiler_opts = GWT_COMPILER_OPTS, module_deps = [':ui_module'],
deps = APP_DEPS + [':ui_dbg'], deps = DEPS + ['//lib/gwt:dev', ':ui_dbg'],
local_workers = cpu_count(),
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,
) )
gwt_application( gwt_binary(
name = 'ui_dbg', name = 'ui_dbg',
module_target = MODULE, modules = [MODULE],
compiler_opts = DEBUG_OPTS + ['-strict'], style = 'PRETTY',
deps = APP_DEPS, optimize = 0,
module_deps = [':ui_module'],
deps = DEPS + ['//lib/gwt:dev'],
local_workers = cpu_count(),
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,
visibility = ['//:eclipse'], visibility = ['//:eclipse'],
) )
gwt_user_agent_permutations( gwt_user_agent_permutations(
name = 'ui', name = 'ui',
module_name = 'gerrit_ui', module_name = 'gerrit_ui',
module_target = MODULE, modules = [MODULE],
compiler_opts = DEBUG_OPTS + ['-draftCompile'], module_deps = [':ui_module'],
browsers = BROWSERS, deps = DEPS,
deps = APP_DEPS,
visibility = ['//:'], visibility = ['//:'],
) )
@@ -53,9 +64,10 @@ DIFFY = glob(['src/main/java/com/google/gerrit/client/diffy*.png'])
gwt_module( gwt_module(
name = 'ui_module', name = 'ui_module',
srcs = glob(['src/main/java/**/*.java']), srcs = glob(['src/main/java/**/*.java']),
gwtxml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'), gwt_xml = 'src/main/java/%s.gwt.xml' % MODULE.replace('.', '/'),
resources = glob(['src/main/java/**/*'], excludes = DIFFY), resources = glob(['src/main/java/**/*'], excludes = DIFFY),
deps = [ deps = [
':diffy_logo',
'//gerrit-gwtexpui:Clippy', '//gerrit-gwtexpui:Clippy',
'//gerrit-gwtexpui:GlobalKey', '//gerrit-gwtexpui:GlobalKey',
'//gerrit-gwtexpui:Progress', '//gerrit-gwtexpui:Progress',
@@ -67,9 +79,6 @@ gwt_module(
'//gerrit-patch-jgit:client', '//gerrit-patch-jgit:client',
'//gerrit-prettify:client', '//gerrit-prettify:client',
'//gerrit-reviewdb:client', '//gerrit-reviewdb:client',
],
compile_deps = [
':diffy_logo',
'//gerrit-gwtexpui:CSS', '//gerrit-gwtexpui:CSS',
'//lib:gwtjsonrpc', '//lib:gwtjsonrpc',
'//lib:gwtjsonrpc_src', '//lib:gwtjsonrpc_src',
@@ -113,16 +122,16 @@ java_test(
'src/main/java/com/google/gerrit/GerritGwtUI.gwt.xml', 'src/main/java/com/google/gerrit/GerritGwtUI.gwt.xml',
], ],
deps = [ deps = [
':ui_module_lib', ':ui_module',
'//gerrit-common:client_lib', '//gerrit-common:client',
'//gerrit-extension-api:client_lib', '//gerrit-extension-api:client',
'//lib:junit', '//lib:junit',
'//lib/gwt:dev', '//lib/gwt:dev',
'//lib/gwt:user', '//lib/gwt:user',
'//lib/gwt:gwt-test-utils', '//lib/gwt:gwt-test-utils',
'//lib/jgit:jgit', '//lib/jgit:jgit',
], ],
source_under_test = [':ui_module_lib'], source_under_test = [':ui_module'],
vm_args = ['-Xmx512m'], vm_args = ['-Xmx512m'],
visibility = ['//tools/eclipse:classpath'], visibility = ['//tools/eclipse:classpath'],
) )

View File

@@ -26,36 +26,35 @@ ALIASES = {
} }
MODULE = 'com.google.gerrit.GerritGwtUI' MODULE = 'com.google.gerrit.GerritGwtUI'
DEBUG_OPTS = [
'-style', 'PRETTY',
'-optimize', '0',
]
APP_DEPS = [':ui_module']
def gwt_user_agent_permutations( def gwt_user_agent_permutations(
name, name,
module_name, module_name,
module_target, modules,
compiler_opts = [], style = 'PRETTY',
optimize = 0,
draft_compile = True,
module_deps = [],
deps = [], deps = [],
browsers = [], browsers = BROWSERS,
visibility = []): visibility = []):
from multiprocessing import cpu_count
for ua in browsers: for ua in browsers:
impl = ua impl = ua
if ua in ALIASES: if ua in ALIASES:
impl = ALIASES[ua] impl = ALIASES[ua]
xml = ''.join([ xml = ''.join([
"<module rename-to='%s'>" % module_name, "<module rename-to='%s'>" % module_name,
"<inherits name='%s'/>" % module_target, "<inherits name='%s'/>" % modules[0],
"<set-property name='user.agent' value='%s'/>" % impl, "<set-property name='user.agent' value='%s'/>" % impl,
"<set-property name='locale' value='default'/>", "<set-property name='locale' value='default'/>",
"</module>", "</module>",
]) ])
gwt = '%s_%s.gwt.xml' % (module_target.replace('.', '/'), ua) gwt = '%s_%s.gwt.xml' % (modules[0].replace('.', '/'), ua)
jar = '%s_%s.gwtxml.jar' % (name, ua) gwt_name = '%s_%s' % (name, ua)
jar = '%s.gwtxml.jar' % (gwt_name)
genrule( genrule(
name = '%s_%s_gwtxml_gen' % (name, ua), name = '%s_gwtxml_gen' % gwt_name,
cmd = 'cd $TMP;' + cmd = 'cd $TMP;' +
('mkdir -p $(dirname %s);' % gwt) + ('mkdir -p $(dirname %s);' % gwt) +
('echo "%s">%s;' % (xml, gwt)) + ('echo "%s">%s;' % (xml, gwt)) +
@@ -63,15 +62,22 @@ def gwt_user_agent_permutations(
out = jar, out = jar,
) )
prebuilt_jar( prebuilt_jar(
name = '%s_%s_gwtxml_lib' % (name, ua), name = '%s_gwtxml_lib' % gwt_name,
binary_jar = genfile(jar), binary_jar = genfile(jar),
deps = [':%s_%s_gwtxml_gen' % (name, ua)], gwt_jar = genfile(jar),
deps = [':%s_gwtxml_gen' % gwt_name],
) )
gwt_application( gwt_binary(
name = '%s_%s' % (name, ua), name = gwt_name,
module_target = module_target + '_' + ua, modules = [modules[0] + '_' + ua],
compiler_opts = compiler_opts, style = style,
deps = deps + [':%s_%s_gwtxml_lib' % (name, ua)], optimize = optimize,
draft_compile = draft_compile,
module_deps = module_deps + [':%s_gwtxml_lib' % gwt_name],
deps = deps,
local_workers = cpu_count(),
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,
visibility = visibility, visibility = visibility,
) )

View File

@@ -6,8 +6,8 @@ gwt_module(
SRC + 'diff/Edit_JsonSerializer.java', SRC + 'diff/Edit_JsonSerializer.java',
SRC + 'diff/ReplaceEdit.java', SRC + 'diff/ReplaceEdit.java',
], ],
gwtxml = SRC + 'JGit.gwt.xml', gwt_xml = SRC + 'JGit.gwt.xml',
compile_deps = [ deps = [
'//lib:gwtjsonrpc', '//lib:gwtjsonrpc',
'//lib/gwt:user', '//lib/gwt:user',
'//lib/jgit:jgit', '//lib/jgit:jgit',

View File

@@ -588,7 +588,13 @@ public class JettyServer {
String pkg = "gerrit-gwtui"; String pkg = "gerrit-gwtui";
String target = "ui_" + rule.select((HttpServletRequest) request); String target = "ui_" + rule.select((HttpServletRequest) request);
String rule = "//" + pkg + ":" + target; String rule = "//" + pkg + ":" + target;
File zip = new File(new File(gen, pkg), target + ".zip"); // TODO(davido): instead of assuming specific Buck's internal
// target directory for gwt_binary() artifacts, ask Buck for
// the location of user agent permutation GWT zip, e. g.:
// $ buck targets --show_output //gerrit-gwtui:ui_safari \
// | awk '{print $2}'
String child = String.format("%s/__gwt_binary_%s__", pkg, target);
File zip = new File(new File(gen, child), target + ".zip");
synchronized (this) { synchronized (this) {
try { try {

View File

@@ -6,17 +6,15 @@ gwt_module(
SRC + 'client/**/*.java', SRC + 'client/**/*.java',
SRC + 'common/**/*.java', SRC + 'common/**/*.java',
]), ]),
gwtxml = SRC + 'PrettyFormatter.gwt.xml', gwt_xml = SRC + 'PrettyFormatter.gwt.xml',
resources = glob([ resources = glob([
'src/main/java/com/google/gerrit/prettify/client/*.properties', 'src/main/java/com/google/gerrit/prettify/client/*.properties',
]), ]),
deps = [ deps = [
':google-code-prettify',
'//gerrit-patch-jgit:client', '//gerrit-patch-jgit:client',
'//gerrit-reviewdb:client', '//gerrit-reviewdb:client',
'//gerrit-gwtexpui:SafeHtml', '//gerrit-gwtexpui:SafeHtml',
],
compile_deps = [
':google-code-prettify',
'//lib:guava', '//lib:guava',
'//lib:gwtjsonrpc', '//lib:gwtjsonrpc',
'//lib/gwt:user', '//lib/gwt:user',

View File

@@ -3,8 +3,8 @@ SRC = 'src/main/java/com/google/gerrit/reviewdb/'
gwt_module( gwt_module(
name = 'client', name = 'client',
srcs = glob([SRC + 'client/**/*.java']), srcs = glob([SRC + 'client/**/*.java']),
gwtxml = SRC + 'ReviewDB.gwt.xml', gwt_xml = SRC + 'ReviewDB.gwt.xml',
compile_deps = [ deps = [
'//gerrit-extension-api:client', '//gerrit-extension-api:client',
'//lib:gwtorm', '//lib:gwtorm',
'//lib:gwtorm_src' '//lib:gwtorm_src'

View File

@@ -32,12 +32,6 @@ maven_jar(
visibility = [], visibility = [],
) )
python_binary(
name = 'compiler',
main = 'compiler.py',
visibility = ['PUBLIC'],
)
maven_jar( maven_jar(
name = 'gwt-test-utils', name = 'gwt-test-utils',
id = 'com.googlecode.gwt-test-utils:gwt-test-utils:0.47', id = 'com.googlecode.gwt-test-utils:gwt-test-utils:0.47',

View File

@@ -1,65 +0,0 @@
#!/usr/bin/python
# Copyright (C) 2013 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from __future__ import print_function
from multiprocessing import cpu_count
from os import makedirs, mkdir, path
from subprocess import Popen, PIPE
from sys import argv, stderr
cp, opt, end = [], [], False
module, TMP, outzip = argv[1], argv[2], argv[3]
for a in argv[4:]:
if end:
if a.endswith('.jar'):
cp.append(path.expandvars(a))
elif a == '--':
end = True
else:
opt.append(a)
if not outzip.endswith('.zip'):
print("%s must end with .zip" % outzip, file=stderr)
exit(1)
for d in ['deploy', 'unit_cache', 'work']:
mkdir(path.join(TMP, d))
if not path.exists(path.dirname(outzip)):
makedirs(path.dirname(outzip))
cmd = [
'java', '-Xmx512m',
'-Djava.io.tmpdir=' + TMP,
'-Dgwt.normalizeTimestamps=true',
'-Dgwt.persistentunitcachedir=' + path.join(TMP, 'unit_cache'),
'-classpath', ':'.join(cp),
'com.google.gwt.dev.Compiler',
'-deploy', path.join(TMP, 'deploy'),
'-workDir', path.join(TMP, 'work'),
'-war', outzip,
'-localWorkers', str(cpu_count()),
] + opt + [module]
try:
gwt = Popen(cmd, stdout=PIPE, stderr=PIPE)
out, err = gwt.communicate()
if gwt.returncode != 0:
print(out + err, file=stderr)
exit(gwt.returncode)
except KeyboardInterrupt:
print("Interrupted by user", file=stderr)
exit(1)

View File

@@ -57,15 +57,9 @@ def war(
dep.extend(DOCS_DEP) dep.extend(DOCS_DEP)
cmd.extend(['--lib', DOCS_LIB]) cmd.extend(['--lib', DOCS_LIB])
if context: if context:
root = get_base_path() for t in context:
if root: dep.append(t)
root = '/'.join(['..' for _ in root.split('/')]) + '/' cmd.append('$(location %s)' % t)
for r in context:
dep.append(r[:r.rindex('.')])
if r.startswith('//'):
r = root + r[2:]
r = r.replace(':', '/')
src.append(genfile(r))
if src: if src:
cmd.append('$SRCS') cmd.append('$SRCS')
@@ -84,9 +78,9 @@ def gerrit_war(name, ui = 'ui_optdbg', context = [], docs = False, visibility =
libs = LIBS + ['//gerrit-war:version'], libs = LIBS + ['//gerrit-war:version'],
pgmlibs = PGMLIBS, pgmlibs = PGMLIBS,
context = [ context = [
'//gerrit-main:main_bin.jar', '//gerrit-main:main_bin',
'//gerrit-war:webapp_assets.zip', '//gerrit-war:webapp_assets',
'//gerrit-gwtui:' + ui + '.zip', '//gerrit-gwtui:' + ui,
] + context, ] + context,
docs = docs, docs = docs,
visibility = visibility, visibility = visibility,

View File

@@ -15,6 +15,7 @@
# Rule definitions loaded by default into every BUCK file. # Rule definitions loaded by default into every BUCK file.
include_defs('//tools/gwt-constants.defs') include_defs('//tools/gwt-constants.defs')
import copy
def genantlr( def genantlr(
name, name,
@@ -31,48 +32,15 @@ def genantlr(
out = out, out = out,
) )
def gwt_module( def gwt_module(gwt_xml=None, **kwargs):
name, kw = copy.deepcopy(kwargs)
srcs, if 'resources' not in kw:
gwtxml = None, kw['resources'] = []
resources = [], if gwt_xml:
deps = [], kw['resources'] += [gwt_xml]
compile_deps = [], if 'srcs' in kw:
visibility = []): kw['resources'] += kw['srcs']
if gwtxml: java_library(**kw)
resources = resources + [gwtxml]
java_library(
name = name,
deps = deps + compile_deps,
resources = srcs + resources,
visibility = visibility,
)
java_library(
name = name + '_lib',
srcs = srcs,
deps = [':' + name] + [d + '_lib' for d in deps] + compile_deps,
visibility = visibility,
)
def gwt_application(
name,
module_target,
compiler_opts = [],
compiler_jvm_flags = [],
deps = [],
visibility = []):
cmd = ['$(exe //lib/gwt:compiler)', module_target, '$TMP', '$OUT']
cmd += compiler_opts + ['--', '$DEPS']
genrule(
name = name,
cmd = ' '.join(cmd),
deps = [
'//lib/gwt:compiler',
'//lib/gwt:dev',
] + deps,
out = '%s.zip' % name,
visibility = visibility,
)
def gerrit_extension( def gerrit_extension(
name, name,
@@ -106,6 +74,7 @@ def gerrit_plugin(
manifest_entries = [], manifest_entries = [],
type = 'plugin', type = 'plugin',
visibility = ['PUBLIC']): visibility = ['PUBLIC']):
from multiprocessing import cpu_count
mf_cmd = 'v=$(git describe HEAD);' mf_cmd = 'v=$(git describe HEAD);'
if manifest_file: if manifest_file:
mf_src = [manifest_file] mf_src = [manifest_file]
@@ -154,11 +123,14 @@ def gerrit_plugin(
out = '%s-static.zip' % name, out = '%s-static.zip' % name,
deps = [':%s__gwt_application' % name] deps = [':%s__gwt_application' % name]
) )
gwt_application( gwt_binary(
name = name + '__gwt_application', name = name + '__gwt_application',
module_target = gwt_module, modules = [gwt_module],
compiler_opts = GWT_COMPILER_OPTS,
deps = [':%s__plugin' % name] + gwt_deps, deps = [':%s__plugin' % name] + gwt_deps,
local_workers = cpu_count(),
strict = True,
experimental_args = GWT_COMPILER_ARGS,
vm_args = GWT_JVM_ARGS,
) )
java_binary( java_binary(
name = name, name = name,

View File

@@ -1,7 +1,6 @@
GWT_COMPILER_OPTS = [ GWT_JVM_ARGS = ['-Xmx512m']
'-strict',
'-style', 'OBF', GWT_COMPILER_ARGS = [
'-optimize', '9',
'-XdisableClassMetadata', '-XdisableClassMetadata',
'-XdisableCastChecking', '-XdisableCastChecking',
] ]