bazel: remove 'out' attribute from genrule2, and use throughout.
This centralizes the OSX mktemp solution. Change-Id: Iaab18450146b649245b36865bedc5d7b50d1aa07
This commit is contained in:
parent
e624bc00f5
commit
29cced5e29
@ -18,7 +18,7 @@ genrule2(
|
||||
'@bazel_tools//tools/zip:zipper',
|
||||
'//lib/antlr:antlr-tool',
|
||||
],
|
||||
out = 'query_antlr.srcjar',
|
||||
outs = [ 'query_antlr.srcjar' ],
|
||||
)
|
||||
|
||||
java_library(
|
||||
|
@ -1,4 +1,3 @@
|
||||
load('//tools/bzl:genrule2.bzl', 'genrule2')
|
||||
load('//tools/bzl:java.bzl', 'java_library2')
|
||||
load('//tools/bzl:junit.bzl', 'junit_tests')
|
||||
load('//tools/bzl:gwt.bzl', 'gwt_module')
|
||||
|
@ -1,5 +1,4 @@
|
||||
load('//tools/bzl:gwt.bzl', 'gwt_module')
|
||||
load('//tools/bzl:genrule2.bzl', 'genrule2')
|
||||
load('//tools/bzl:license.bzl', 'license_test')
|
||||
load(':gwt.bzl', 'gwt_binary', 'gwt_genrule', 'gen_ui_module')
|
||||
|
||||
|
@ -33,7 +33,7 @@ genrule2(
|
||||
'zip -Dq $$ROOT/$@ org/eclipse/jgit/diff/Edit.java',
|
||||
]),
|
||||
tools = ['@jgit_src//file'],
|
||||
out = 'edit.srcjar',
|
||||
outs = [ 'edit.srcjar' ],
|
||||
)
|
||||
|
||||
java_library(
|
||||
|
@ -35,7 +35,7 @@ genrule2(
|
||||
name = 'webapp_assets',
|
||||
cmd = 'cd gerrit-war/src/main/webapp; zip -qr $$ROOT/$@ .',
|
||||
srcs = glob(['src/main/webapp/**/*']),
|
||||
out = 'webapp_assets.zip',
|
||||
outs = [ 'webapp_assets.zip' ],
|
||||
visibility = ['//visibility:public'],
|
||||
)
|
||||
|
||||
@ -49,7 +49,7 @@ genrule2(
|
||||
name = 'log4j-config__jar',
|
||||
cmd = 'cd gerrit-war/src/main/resources && zip -9Dqr $$ROOT/$@ .',
|
||||
srcs = ['src/main/resources/log4j.properties'],
|
||||
out = 'log4j-config.jar',
|
||||
outs = [ 'log4j-config.jar' ],
|
||||
)
|
||||
|
||||
java_import(
|
||||
@ -67,5 +67,5 @@ genrule2(
|
||||
'zip -9Dqr $$ROOT/$@ .',
|
||||
]),
|
||||
tools = ['//:version.txt'],
|
||||
out = 'gen_version.jar',
|
||||
outs = [ 'gen_version.jar' ],
|
||||
)
|
||||
|
@ -347,7 +347,7 @@ def pkg_cm():
|
||||
] + [
|
||||
':theme_%s%s' % (n, suffix) for n in CM_THEMES
|
||||
],
|
||||
out = 'codemirror%s.jar' % suffix,
|
||||
outs = [ 'codemirror%s.jar' % suffix ],
|
||||
)
|
||||
|
||||
native.java_import(
|
||||
|
@ -24,7 +24,7 @@ genrule2(
|
||||
'OpenSans-Regular.woff',
|
||||
'OpenSans-Regular.woff2'
|
||||
],
|
||||
out = 'opensans.zip',
|
||||
outs = [ 'opensans.zip' ],
|
||||
# TODO(hanwen): license.
|
||||
# license = 'Apache2.0',
|
||||
visibility = ['//visibility:public'],
|
||||
|
@ -1,5 +1,4 @@
|
||||
package(default_visibility = [ "//visibility:public" ])
|
||||
load('//tools/bzl:genrule2.bzl', 'genrule2')
|
||||
load("//tools/bzl:js.bzl", "bower_component", "js_component")
|
||||
|
||||
# For updating the bower versions, run
|
||||
|
@ -26,7 +26,7 @@ def prolog_cafe_library(
|
||||
'$(SRCS)',
|
||||
srcs = srcs,
|
||||
tools = ['//lib/prolog:compiler_bin'],
|
||||
out = name + '.srcjar',
|
||||
outs = [ name + '.srcjar' ],
|
||||
)
|
||||
native.java_library(
|
||||
name = name,
|
||||
|
@ -17,6 +17,6 @@ genrule2(
|
||||
'ln -s $$ROOT/$$s $$TMP/WEB-INF/plugins;done;' +
|
||||
'cd $$TMP;' +
|
||||
'zip -qr $$ROOT/$@ .',
|
||||
out = 'core.zip',
|
||||
outs = [ 'core.zip' ],
|
||||
visibility = ['//visibility:public'],
|
||||
)
|
||||
|
@ -1,6 +1,7 @@
|
||||
package(
|
||||
default_visibility = ["//visibility:public"])
|
||||
|
||||
load('//tools/bzl:genrule2.bzl', 'genrule2')
|
||||
load("//tools/bzl:js.bzl", "bower_component_bundle", "vulcanize")
|
||||
|
||||
bower_component_bundle(
|
||||
@ -40,21 +41,19 @@ filegroup(
|
||||
srcs = glob(['styles/**/*.css'])
|
||||
)
|
||||
|
||||
genrule(
|
||||
genrule2(
|
||||
name = "polygerrit_ui",
|
||||
cmd = " && ".join([
|
||||
"t=$$(mktemp -d || mktemp -d -t bazel-tmp)",
|
||||
"p=$$PWD",
|
||||
"mkdir -p $$t/polygerrit_ui/{styles,fonts,bower_components/{highlightjs,webcomponentsjs},elements}",
|
||||
"cp $(locations :gr-app) $$t/polygerrit_ui/elements/",
|
||||
"cp $(locations //lib/fonts:sourcecodepro) $$t/polygerrit_ui/fonts/",
|
||||
"for f in $(locations :top_sources); do cp $$f $$t/polygerrit_ui/; done",
|
||||
"for f in $(locations :css_sources); do cp $$f $$t/polygerrit_ui/styles; done",
|
||||
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$t/polygerrit_ui/bower_components/highlightjs/ ; done",
|
||||
"unzip -qd $$t/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
|
||||
"cd $$t",
|
||||
"mkdir -p $$TMP/polygerrit_ui/{styles,fonts,bower_components/{highlightjs,webcomponentsjs},elements}",
|
||||
"cp $(locations :gr-app) $$TMP/polygerrit_ui/elements/",
|
||||
"cp $(locations //lib/fonts:sourcecodepro) $$TMP/polygerrit_ui/fonts/",
|
||||
"for f in $(locations :top_sources); do cp $$f $$TMP/polygerrit_ui/; done",
|
||||
"for f in $(locations :css_sources); do cp $$f $$TMP/polygerrit_ui/styles; done",
|
||||
"for f in $(locations //lib/js:highlightjs_files); do cp $$f $$TMP/polygerrit_ui/bower_components/highlightjs/ ; done",
|
||||
"unzip -qd $$TMP/polygerrit_ui/bower_components $(location @webcomponentsjs//:zipfile) webcomponentsjs/webcomponents-lite.js",
|
||||
"cd $$TMP",
|
||||
"find . -exec touch -t 198001010000 '{}' ';'",
|
||||
"zip -qr $$p/$@ *",
|
||||
"zip -qr $$ROOT/$@ *",
|
||||
]),
|
||||
srcs = [
|
||||
"//lib/fonts:sourcecodepro",
|
||||
|
@ -15,9 +15,8 @@
|
||||
# Syntactic sugar for native genrule() rule:
|
||||
# expose ROOT shell variable
|
||||
# expose TMP shell variable
|
||||
# accept single output
|
||||
|
||||
def genrule2(out, cmd, **kwargs):
|
||||
def genrule2(cmd, **kwargs):
|
||||
cmd = ' && '.join([
|
||||
'ROOT=$$PWD',
|
||||
'TMP=$$(mktemp -d || mktemp -d -t bazel-tmp)',
|
||||
@ -25,5 +24,4 @@ def genrule2(out, cmd, **kwargs):
|
||||
])
|
||||
native.genrule(
|
||||
cmd = cmd,
|
||||
outs = [out],
|
||||
**kwargs)
|
||||
|
Loading…
Reference in New Issue
Block a user