From 7fc13dca826a413242036521398499997cceef29 Mon Sep 17 00:00:00 2001 From: David Ostrovsky Date: Fri, 24 Oct 2014 01:08:01 +0200 Subject: [PATCH] Buck: upgrade to recent version This version fixes a critical bug [1] that prevents us from simplifying bucklets intergration. In this version, Buck only allows defining new rule functions in files included with include_defs, not actually instantiating rules, so we need to reshuffle some rules. After this commit [2] "$(macro ...)" syntax is preserved for buck macros, we need to use a backslash to send commands directly to the shell: "\$(macro ...)". It turns out this doesn't work yet, shell backticks seem to work though [3]. [1] https://github.com/facebook/buck/issues/182 [2] https://github.com/facebook/buck/commit/d6f3252170abe7a6de8e7dec0cc90000147c5d10 [3] https://github.com/facebook/buck/issues/212 Change-Id: Ie99757bafc626d4ac2c5a75a2983d91b0c4f6d24 --- .buckversion | 2 +- gerrit-gwtui/BUCK | 2 +- gerrit-gwtui/gwt.defs | 2 +- lib/codemirror/BUCK | 32 ++++++++++++++++++++++++++++++++ lib/codemirror/closure.defs | 32 -------------------------------- tools/default.defs | 2 +- 6 files changed, 36 insertions(+), 36 deletions(-) diff --git a/.buckversion b/.buckversion index b23029ac78..7bcdf5ef4d 100644 --- a/.buckversion +++ b/.buckversion @@ -1 +1 @@ -7608e515c2355d2e799f4b404683433fea9cc024 +f0759b0bfff1368bc715371c383dfd8c873f9991 diff --git a/gerrit-gwtui/BUCK b/gerrit-gwtui/BUCK index f1c9e6b56d..bc67b52e71 100644 --- a/gerrit-gwtui/BUCK +++ b/gerrit-gwtui/BUCK @@ -15,7 +15,7 @@ genrule( ' gerrit_ui/gerrit_ui.nocache.js' + ' gerrit_ui/dbg_gerrit_ui.nocache.js;' + 'unzip -qo $(location :ui_opt);' + - 'mkdir -p $(dirname $OUT);' + + 'mkdir -p `dirname $OUT`;' + 'zip -qr $OUT .', deps = [ ':ui_dbg', diff --git a/gerrit-gwtui/gwt.defs b/gerrit-gwtui/gwt.defs index 0e10116bea..16a653e84c 100644 --- a/gerrit-gwtui/gwt.defs +++ b/gerrit-gwtui/gwt.defs @@ -56,7 +56,7 @@ def gwt_user_agent_permutations( genrule( name = '%s_gwtxml_gen' % gwt_name, cmd = 'cd $TMP;' + - ('mkdir -p $(dirname %s);' % gwt) + + ('mkdir -p `dirname %s`;' % gwt) + ('echo "%s">%s;' % (xml, gwt)) + 'zip -qr $OUT .', out = jar, diff --git a/lib/codemirror/BUCK b/lib/codemirror/BUCK index a18c761d25..e25b37208a 100644 --- a/lib/codemirror/BUCK +++ b/lib/codemirror/BUCK @@ -14,6 +14,12 @@ CLOSURE_COMPILER_ARGS = [ '--warning_level QUIET' ] +# https://code.google.com/p/closure-compiler/wiki/BinaryDownloads?tm=2 +CLOSURE_VERSION = '20140407' +CLOSURE_COMPILER_URL = 'http://dl.google.com/closure-compiler/compiler-%s.zip' % CLOSURE_VERSION +COMPILER = 'compiler.jar' +CLOSURE_COMPILER_SHA1 = 'eeb02bfd45eb4a080b66dd423eaee4bdd1d674e9' + genrule( name = 'css', cmd = ';'.join([ @@ -87,3 +93,29 @@ genrule( ' -v ' + SHA1, out = ZIP, ) + +java_binary( + name = 'js_minifier', + main_class = 'com.google.javascript.jscomp.CommandLineRunner', + deps = [':compiler-jar'] +) + +prebuilt_jar( + name = 'compiler-jar', + binary_jar = ':compiler', +) + +genrule( + name = 'compiler', + cmd = 'unzip -p $(location :closure-compiler-zip) %s >$OUT' % COMPILER, + out = COMPILER, +) + +genrule( + name = 'closure-compiler-zip', + cmd = '$(exe //tools:download_file)' + + ' -o $OUT' + + ' -u ' + CLOSURE_COMPILER_URL + + ' -v ' + CLOSURE_COMPILER_SHA1, + out = 'closure-compiler.zip', +) diff --git a/lib/codemirror/closure.defs b/lib/codemirror/closure.defs index e602b9fc53..08b6897eac 100644 --- a/lib/codemirror/closure.defs +++ b/lib/codemirror/closure.defs @@ -1,9 +1,3 @@ -# https://code.google.com/p/closure-compiler/wiki/BinaryDownloads?tm=2 -CLOSURE_VERSION = '20140407' -CLOSURE_COMPILER_URL = 'http://dl.google.com/closure-compiler/compiler-%s.zip' % CLOSURE_VERSION -COMPILER = 'compiler.jar' -CLOSURE_COMPILER_SHA1 = 'eeb02bfd45eb4a080b66dd423eaee4bdd1d674e9' - def js_minify( name, out, @@ -22,29 +16,3 @@ def js_minify( srcs = srcs, out = out, ) - -java_binary( - name = 'js_minifier', - main_class = 'com.google.javascript.jscomp.CommandLineRunner', - deps = [':compiler-jar'] -) - -prebuilt_jar( - name = 'compiler-jar', - binary_jar = ':compiler', -) - -genrule( - name = 'compiler', - cmd = 'unzip -p $(location :closure-compiler-zip) %s >$OUT' % COMPILER, - out = COMPILER, -) - -genrule( - name = 'closure-compiler-zip', - cmd = '$(exe //tools:download_file)' + - ' -o $OUT' + - ' -u ' + CLOSURE_COMPILER_URL + - ' -v ' + CLOSURE_COMPILER_SHA1, - out = 'closure-compiler.zip', -) diff --git a/tools/default.defs b/tools/default.defs index 2239026593..58760071a9 100644 --- a/tools/default.defs +++ b/tools/default.defs @@ -80,7 +80,7 @@ def gerrit_plugin( type = 'plugin', visibility = ['PUBLIC']): from multiprocessing import cpu_count - mf_cmd = 'v=$(git describe HEAD);' + mf_cmd = 'v=`git describe HEAD`;' if manifest_file: mf_src = [manifest_file] mf_cmd += 'sed "s:@VERSION@:$v:g" $SRCS >$OUT'