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
/.buckconfig.local
/.buckd
/buck-cache
/buck-out
/local.properties

View File

@ -46,7 +46,7 @@ def genasciidoc(
)
genrule(
name = name,
cmd = '',
cmd = ':>$OUT',
srcs = [],
deps = [':' + o for o in outs],
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.
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
----------------------------------

View File

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

View File

@ -16,13 +16,25 @@ def genantlr(
name,
srcs,
outs):
tmp = name + '.srcjar'
genrule(
name = name,
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'],
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(
name,