Buck: Upgrade to the latest version

Since [1] genrule() target doesn't accept deps parameters any more.
As replacement, cmd should use $(location :foo) macro. Reshuffle some
rules to fix existing genrule targets. Remove all rule, as it cannot
depend any more on api and release. Moreover create all.zip with both
api.zip and release.war included doesn't make really sense. Adjust the
documentation correspondingly.

gen_licences.py is accepting first order dependencies and computes the
classpath on its own. Make it work for now by passing the classpath for
the dependencies.  Add a TODO to clean this up and accept the classpath
from the Buck side, similar to what was done in Ifd2dcf69aa.

[1] d2c6edbf7b

Change-Id: Iab403cd964d09aff652662cd18b020db8e07a0d9
This commit is contained in:
David Ostrovsky 2015-11-02 08:40:38 +01:00
parent 9e9bc6ca31
commit 0a79f35422
10 changed files with 15 additions and 35 deletions

View File

@ -1,5 +1,4 @@
[alias]
all = //:all
api = //:api
api_deploy = //tools/maven:api_deploy
api_install = //tools/maven:api_install

View File

@ -1 +1 @@
7e153d4a69044d059288d353fc1a442e07cbea58
1b03b4313b91b634bd604fc3487a05f877e59dee

16
BUCK
View File

@ -23,19 +23,7 @@ API_DEPS = [
'//gerrit-plugin-gwtui:gwtui-api-javadoc',
]
genrule(
zip_file(
name = 'api',
cmd = 'echo done >$OUT',
deps = API_DEPS,
out = '__fake.api__',
)
genrule(
name = 'all',
cmd = 'echo done >$OUT',
deps = [
':api',
':release',
],
out = '__fake.all__',
srcs = API_DEPS,
)

View File

@ -3,8 +3,8 @@ include_defs('//Documentation/config.defs')
include_defs('//tools/git.defs')
DOC_DIR = 'Documentation'
JSUI = ['//gerrit-gwtui:ui_module']
MAIN = ['//gerrit-pgm:pgm'] + JSUI
JSUI = '//gerrit-gwtui:ui_module'
MAIN = '//gerrit-pgm:pgm'
SRCS = glob(['*.txt'], excludes = ['licenses.txt'])
genasciidoc(
@ -30,16 +30,19 @@ genasciidoc(
genrule(
name = 'licenses.txt',
cmd = '$(exe :gen_licenses) --asciidoc ' + ' '.join(MAIN) + ' >$OUT',
deps = MAIN,
cmd = '$(exe :gen_licenses) --asciidoc '
+ '--classpath $(classpath %s) ' % MAIN
+ '--classpath $(classpath %s) ' % JSUI
+ MAIN + ' ' + JSUI + ' >$OUT',
out = 'licenses.txt',
)
# Required by Google for gerrit-review.
genrule(
name = 'js_licenses.txt',
cmd = '$(exe :gen_licenses) --partial ' + ' '.join(JSUI) + ' >$OUT',
deps = JSUI,
cmd = '$(exe :gen_licenses) --partial '
+ '--classpath $(classpath %s) ' % JSUI
+ JSUI + ' >$OUT',
out = 'js_licenses.txt',
)

View File

@ -275,15 +275,6 @@ The output release WAR will be placed in:
buck-out/gen/release/release.war
----
[[all]]
=== Combined build target
To build release and api targets, a combined build target is provided:
----
buck build all
----
[[tests]]
== Running Unit Tests

View File

@ -28,6 +28,7 @@ from sys import stdout, stderr
parser = argparse.ArgumentParser()
parser.add_argument('--asciidoc', action='store_true')
parser.add_argument('--partial', action='store_true')
parser.add_argument('--classpath', action='append')
parser.add_argument('targets', nargs='+')
args = parser.parse_args()
@ -41,6 +42,7 @@ def parse_graph():
graph = defaultdict(list)
while not path.isfile('.buckconfig'):
chdir('..')
# TODO(davido): use passed in classpath from Buck instead
p = Popen(
['buck', 'audit', 'classpath', '--dot'] + args.targets,
stdout = PIPE)

View File

@ -51,7 +51,7 @@ Gerrit is provided under the Apache License 2.0.
Install [Buck](http://facebook.github.io/buck/setup/install.html) and run the following:
git clone --recursive https://gerrit.googlesource.com/gerrit
cd gerrit && buck build all
cd gerrit && buck build release
## Install binary packages (Deb/Rpm)

View File

@ -49,7 +49,6 @@ prebuilt_jar(
genrule(
name = 'diffy_image_files_ln',
cmd = 'ln -s $(location :diffy_image_files) $OUT',
deps = [':diffy_image_files'],
out = 'diffy_images.jar',
)

View File

@ -38,7 +38,6 @@ genrule(
name = 'webapp_assets',
cmd = 'cd src/main/webapp; zip -qr $OUT .',
srcs = glob(['src/main/webapp/**/*']),
deps = [],
out = 'webapp_assets.zip',
visibility = ['//:'],
)

View File

@ -45,7 +45,6 @@ genrule(
name = 'buck',
cmd = 'echo buck=`which buck`>$OUT;' +
("echo PATH=\''%s'\' >>$OUT;" % shquote(os_path())),
deps = [],
out = 'buck.properties',
visibility = ['PUBLIC'],
)