Merge "Fix genantlr() to support buck caching"

This commit is contained in:
Shawn Pearce 2013-05-30 21:29:02 +00:00 committed by Gerrit Code Review
commit 7d1adf840b
5 changed files with 34 additions and 5 deletions

1
.gitignore vendored
View File

@ -9,5 +9,6 @@
/gerrit-package-plugins /gerrit-package-plugins
/.buckconfig.local /.buckconfig.local
/.buckd /.buckd
/buck-cache
/buck-out /buck-out
/local.properties /local.properties

View File

@ -46,7 +46,7 @@ def genasciidoc(
) )
genrule( genrule(
name = name, name = name,
cmd = '', cmd = ':>$OUT',
srcs = [], srcs = [],
deps = [':' + o for o in outs], deps = [':' + o for o in outs],
out = name + '__done', out = name + '__done',

View File

@ -216,6 +216,23 @@ being built, or in `~/.gerritcodereview/`. The file in the root of the gerrit
repository has precedence. repository has precedence.
Caching Build Results
~~~~~~~~~~~~~~~~~~~~~
Build results can be locally cached, saving rebuild time when
switching between Git branches. Buck's documentation covers
caching in link:http://facebook.github.io/buck/concept/buckconfig.html[buckconfig].
The trivial case using a local directory is:
----
cat >.buckconfig.local <<EOF
[cache]
mode = dir
dir = buck-cache
EOF
----
Build Process Switch Exit Criteria Build Process Switch Exit Criteria
---------------------------------- ----------------------------------

View File

@ -3,7 +3,6 @@ ANTLR_OUTS = [
'QueryParser.java', 'QueryParser.java',
] ]
PARSER_DEPS = [ PARSER_DEPS = [
':query_antlr',
':query_exception', ':query_exception',
'//lib/antlr:java_runtime', '//lib/antlr:java_runtime',
] ]
@ -24,7 +23,7 @@ genantlr(
java_library( java_library(
name = 'lib', name = 'lib',
srcs = [genfile(f) for f in ANTLR_OUTS], srcs = [genfile(f) for f in ANTLR_OUTS],
deps = PARSER_DEPS, deps = PARSER_DEPS + [':' + f for f in ANTLR_OUTS],
) )
genrule( genrule(

View File

@ -16,13 +16,25 @@ def genantlr(
name, name,
srcs, srcs,
outs): outs):
tmp = name + '.srcjar'
genrule( genrule(
name = name, name = name,
srcs = srcs, srcs = srcs,
cmd = '${//lib/antlr:antlr-tool} -o $(dirname $OUT) $SRCS', cmd = '${//lib/antlr:antlr-tool} -o $TMP $SRCS;' +
'cd $TMP;' +
'zip -qr $OUT .',
deps = ['//lib/antlr:antlr-tool'], deps = ['//lib/antlr:antlr-tool'],
out = outs[0], out = tmp,
) )
for o in outs:
genrule(
name = o,
cmd = 'unzip -qp $SRCS %s >$OUT' % o,
srcs = [genfile(tmp)],
deps = [':' + name],
out = o,
)
def gwt_module( def gwt_module(
name, name,