From 0a79f35422c8f9f083910772197f576e83ed789a Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Mon, 2 Nov 2015 08:40:38 +0100 Subject: [PATCH] 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] https://github.com/facebook/buck/commit/d2c6edbf7b41ee5662902c1f06f570fa4bc8e005 Change-Id: Iab403cd964d09aff652662cd18b020db8e07a0d9 --- .buckconfig | 1 - .buckversion | 2 +- BUCK | 16 ++-------------- Documentation/BUCK | 15 +++++++++------ Documentation/dev-buck.txt | 9 --------- Documentation/gen_licenses.py | 2 ++ README.md | 2 +- gerrit-gwtui-common/BUCK | 1 - gerrit-war/BUCK | 1 - tools/BUCK | 1 - 10 files changed, 15 insertions(+), 35 deletions(-) diff --git a/.buckconfig b/.buckconfig index 7b75225156..51318f3d63 100644 --- a/.buckconfig +++ b/.buckconfig @@ -1,5 +1,4 @@ [alias] - all = //:all api = //:api api_deploy = //tools/maven:api_deploy api_install = //tools/maven:api_install diff --git a/.buckversion b/.buckversion index ab18d5d77d..9daac2cea3 100644 --- a/.buckversion +++ b/.buckversion @@ -1 +1 @@ -7e153d4a69044d059288d353fc1a442e07cbea58 +1b03b4313b91b634bd604fc3487a05f877e59dee diff --git a/BUCK b/BUCK index 82f1d722be..c9868743d3 100644 --- a/BUCK +++ b/BUCK @@ -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, ) diff --git a/Documentation/BUCK b/Documentation/BUCK index dfac6174fe..126bf1f30d 100644 --- a/Documentation/BUCK +++ b/Documentation/BUCK @@ -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', ) diff --git a/Documentation/dev-buck.txt b/Documentation/dev-buck.txt index 7d30a91e0c..10f331949a 100644 --- a/Documentation/dev-buck.txt +++ b/Documentation/dev-buck.txt @@ -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 diff --git a/Documentation/gen_licenses.py b/Documentation/gen_licenses.py index 8b2d096888..db3480bdac 100755 --- a/Documentation/gen_licenses.py +++ b/Documentation/gen_licenses.py @@ -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) diff --git a/README.md b/README.md index 573042d1bc..f5b929d125 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/gerrit-gwtui-common/BUCK b/gerrit-gwtui-common/BUCK index ef4de8251a..436714a758 100644 --- a/gerrit-gwtui-common/BUCK +++ b/gerrit-gwtui-common/BUCK @@ -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', ) diff --git a/gerrit-war/BUCK b/gerrit-war/BUCK index 27b1f4a84f..d5c85ad2fa 100644 --- a/gerrit-war/BUCK +++ b/gerrit-war/BUCK @@ -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 = ['//:'], ) diff --git a/tools/BUCK b/tools/BUCK index e311ff88b4..489dffc8e8 100644 --- a/tools/BUCK +++ b/tools/BUCK @@ -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'], )