Merge "Merge branch 'stable-2.14' into stable-2.15" into stable-2.15

This commit is contained in:
Patrick Hiesel 2019-01-10 12:00:53 +00:00 committed by Gerrit Code Review
commit ab62c3dc28
30 changed files with 114 additions and 132 deletions

4
BUILD
View File

@ -1,8 +1,8 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:pkg_war.bzl", "pkg_war") load("//tools/bzl:pkg_war.bzl", "pkg_war")
package(default_visibility = ["//visibility:public"])
genrule( genrule(
name = "gen_version", name = "gen_version",
outs = ["version.txt"], outs = ["version.txt"],

View File

@ -1,10 +1,8 @@
package(default_visibility = ["//visibility:public"]) load("//tools/bzl:asciidoc.bzl", "documentation_attributes", "genasciidoc", "genasciidoc_zip")
load("//tools/bzl:asciidoc.bzl", "documentation_attributes")
load("//tools/bzl:asciidoc.bzl", "genasciidoc")
load("//tools/bzl:asciidoc.bzl", "genasciidoc_zip")
load("//tools/bzl:license.bzl", "license_map") load("//tools/bzl:license.bzl", "license_map")
package(default_visibility = ["//visibility:public"])
exports_files([ exports_files([
"replace_macros.py", "replace_macros.py",
]) ])

View File

@ -1,6 +1,4 @@
load("//tools/bzl:asciidoc.bzl", "release_notes_attributes") load("//tools/bzl:asciidoc.bzl", "genasciidoc", "genasciidoc_zip", "release_notes_attributes")
load("//tools/bzl:asciidoc.bzl", "genasciidoc")
load("//tools/bzl:asciidoc.bzl", "genasciidoc_zip")
SRCS = glob(["*.txt"]) SRCS = glob(["*.txt"])

View File

@ -1,4 +1,5 @@
load("//tools/bzl:java.bzl", "java_library2") load("//tools/bzl:java.bzl", "java_library2")
load("//tools/bzl:javadoc.bzl", "java_doc")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
TEST_SRCS = ["src/test/java/com/google/gerrit/acceptance/MergeableFileBasedConfigTest.java"] TEST_SRCS = ["src/test/java/com/google/gerrit/acceptance/MergeableFileBasedConfigTest.java"]
@ -74,8 +75,6 @@ java_library2(
], ],
) )
load("//tools/bzl:javadoc.bzl", "java_doc")
java_doc( java_doc(
name = "acceptance-framework-javadoc", name = "acceptance-framework-javadoc",
testonly = 1, testonly = 1,

View File

@ -1,3 +1,5 @@
load("//tools/bzl:junit.bzl", "junit_tests")
java_library( java_library(
name = "elasticsearch", name = "elasticsearch",
srcs = glob(["src/main/java/**/*.java"]), srcs = glob(["src/main/java/**/*.java"]),
@ -26,8 +28,6 @@ java_library(
], ],
) )
load("//tools/bzl:junit.bzl", "junit_tests")
java_library( java_library(
name = "elasticsearch_test_utils", name = "elasticsearch_test_utils",
testonly = 1, testonly = 1,

View File

@ -1,12 +1,11 @@
load("//lib:guava.bzl", "GUAVA_DOC_URL")
load("//lib/jgit:jgit.bzl", "JGIT_DOC_URL") load("//lib/jgit:jgit.bzl", "JGIT_DOC_URL")
load("//lib:guava.bzl", "GUAVA_DOC_URL")
load("//tools/bzl:gwt.bzl", "gwt_module") load("//tools/bzl:gwt.bzl", "gwt_module")
load("//tools/bzl:javadoc.bzl", "java_doc")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
SRC = "src/main/java/com/google/gerrit/extensions/" SRC = "src/main/java/com/google/gerrit/extensions/"
SRCS = glob([SRC + "**/*.java"])
EXT_API_SRCS = glob([SRC + "client/*.java"]) EXT_API_SRCS = glob([SRC + "client/*.java"])
gwt_module( gwt_module(
@ -60,8 +59,6 @@ junit_tests(
], ],
) )
load("//tools/bzl:javadoc.bzl", "java_doc")
java_doc( java_doc(
name = "extension-api-javadoc", name = "extension-api-javadoc",
external_docs = [ external_docs = [

View File

@ -1,6 +1,6 @@
load("//tools/bzl:gwt.bzl", "gwt_module")
load("//tools/bzl:java.bzl", "java_library2") load("//tools/bzl:java.bzl", "java_library2")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
load("//tools/bzl:gwt.bzl", "gwt_module")
EXPORTED_DEPS = [ EXPORTED_DEPS = [
"//gerrit-common:client", "//gerrit-common:client",

View File

@ -4,12 +4,12 @@ load(
"gwt_genrule", "gwt_genrule",
"gwt_user_agent_permutations", "gwt_user_agent_permutations",
) )
load("//tools/bzl:license.bzl", "license_test")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
load("//tools/bzl:license.bzl", "license_test")
gwt_genrule() gwt_genrule()
gwt_genrule("_r") gwt_genrule(suffix = "_r")
gen_ui_module(name = "ui_module") gen_ui_module(name = "ui_module")

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
package(default_visibility = ["//visibility:public"])
SRCS = glob( SRCS = glob(
["src/main/java/**/*.java"], ["src/main/java/**/*.java"],
) )

View File

@ -1,4 +1,3 @@
load("//tools/bzl:java.bzl", "java_library2")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
load("//tools/bzl:license.bzl", "license_test") load("//tools/bzl:license.bzl", "license_test")

View File

@ -1,3 +1,5 @@
load("//tools/bzl:javadoc.bzl", "java_doc")
PLUGIN_API = [ PLUGIN_API = [
"//gerrit-httpd:httpd", "//gerrit-httpd:httpd",
"//gerrit-pgm:init-api", "//gerrit-pgm:init-api",
@ -90,8 +92,6 @@ java_binary(
], ],
) )
load("//tools/bzl:javadoc.bzl", "java_doc")
java_doc( java_doc(
name = "plugin-api-javadoc", name = "plugin-api-javadoc",
libs = PLUGIN_API + [ libs = PLUGIN_API + [

View File

@ -1,6 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:java.bzl", "java_library2") load("//tools/bzl:java.bzl", "java_library2")
load("//tools/bzl:javadoc.bzl", "java_doc")
package(default_visibility = ["//visibility:public"])
SRCS = glob(["src/main/java/com/google/gerrit/**/*.java"]) SRCS = glob(["src/main/java/com/google/gerrit/**/*.java"])
@ -56,8 +57,6 @@ java_binary(
], ],
) )
load("//tools/bzl:javadoc.bzl", "java_doc")
java_doc( java_doc(
name = "gwtui-api-javadoc", name = "gwtui-api-javadoc",
libs = DEPS + [ libs = DEPS + [

View File

@ -1,8 +1,8 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:gwt.bzl", "gwt_module") load("//tools/bzl:gwt.bzl", "gwt_module")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
package(default_visibility = ["//visibility:public"])
SRC = "src/main/java/com/google/gerrit/reviewdb/" SRC = "src/main/java/com/google/gerrit/reviewdb/"
TESTS = "src/test/java/com/google/gerrit/reviewdb/" TESTS = "src/test/java/com/google/gerrit/reviewdb/"

View File

@ -1,4 +1,5 @@
load("//lib/prolog:prolog.bzl", "prolog_cafe_library") load("//lib/prolog:prolog.bzl", "prolog_cafe_library")
load("//tools/bzl:javadoc.bzl", "java_doc")
load("//tools/bzl:junit.bzl", "junit_tests") load("//tools/bzl:junit.bzl", "junit_tests")
CONSTANTS_SRC = [ CONSTANTS_SRC = [
@ -192,8 +193,9 @@ TESTUTIL_DEPS = [
TESTUTIL = glob([ TESTUTIL = glob([
"src/test/java/com/google/gerrit/testutil/**/*.java", "src/test/java/com/google/gerrit/testutil/**/*.java",
]) + [
"src/test/java/com/google/gerrit/server/project/Util.java", "src/test/java/com/google/gerrit/server/project/Util.java",
]) ]
java_library( java_library(
name = "testutil", name = "testutil",
@ -345,8 +347,6 @@ junit_tests(
], ],
) )
load("//tools/bzl:javadoc.bzl", "java_doc")
java_doc( java_doc(
name = "doc", name = "doc",
libs = [":server"], libs = [":server"],

View File

@ -1,7 +1,6 @@
load("//tools/bzl:genrule2.bzl", "genrule2")
# Roboto Mono. Version 2.136 # Roboto Mono. Version 2.136
# https://github.com/google/roboto/releases/tag/v2.136 # https://github.com/google/roboto/releases/tag/v2.136
filegroup( filegroup(
name = "robotofonts", name = "robotofonts",
srcs = [ srcs = [

View File

@ -1,4 +1,4 @@
load("//tools/bzl:maven_jar.bzl", "GERRIT", "MAVEN_CENTRAL", "MAVEN_LOCAL", "maven_jar") load("//tools/bzl:maven_jar.bzl", "MAVEN_CENTRAL", "maven_jar")
_JGIT_VERS = "4.9.7.201810191756-r" _JGIT_VERS = "4.9.7.201810191756-r"
@ -62,11 +62,11 @@ def jgit_maven_repos():
def jgit_dep(name): def jgit_dep(name):
mapping = { mapping = {
"@jgit-junit//jar": "@jgit//org.eclipse.jgit.junit:junit",
"@jgit-lib//jar:src": "@jgit//org.eclipse.jgit:libjgit-src.jar",
"@jgit-lib//jar": "@jgit//org.eclipse.jgit:jgit",
"@jgit-servlet//jar": "@jgit//org.eclipse.jgit.http.server:jgit-servlet",
"@jgit-archive//jar": "@jgit//org.eclipse.jgit.archive:jgit-archive", "@jgit-archive//jar": "@jgit//org.eclipse.jgit.archive:jgit-archive",
"@jgit-junit//jar": "@jgit//org.eclipse.jgit.junit:junit",
"@jgit-lib//jar": "@jgit//org.eclipse.jgit:jgit",
"@jgit-lib//jar:src": "@jgit//org.eclipse.jgit:libjgit-src.jar",
"@jgit-servlet//jar": "@jgit//org.eclipse.jgit.http.server:jgit-servlet",
} }
if LOCAL_JGIT_REPO: if LOCAL_JGIT_REPO:

View File

@ -1,6 +1,7 @@
package(default_visibility = ["//visibility:public"]) load("//lib/js:bower_components.bzl", "define_bower_components")
load("//tools/bzl:js.bzl", "js_component")
load("//tools/bzl:js.bzl", "bower_component", "js_component") package(default_visibility = ["//visibility:public"])
# For importing new versions of existing bower packages, # For importing new versions of existing bower packages,
# #
@ -20,8 +21,6 @@ load("//tools/bzl:js.bzl", "bower_component", "js_component")
# 4) remove bower_component(name="my_new_dependency", .. ) here # 4) remove bower_component(name="my_new_dependency", .. ) here
# #
load("//lib/js:bower_components.bzl", "define_bower_components")
define_bower_components() define_bower_components()
js_component( js_component(

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:maven.bzl", "merge_maven_jars") load("//tools/bzl:maven.bzl", "merge_maven_jars")
package(default_visibility = ["//visibility:public"])
# core and backward-codecs both provide # core and backward-codecs both provide
# META-INF/services/org.apache.lucene.codecs.Codec, so they must be merged. # META-INF/services/org.apache.lucene.codecs.Codec, so they must be merged.
merge_maven_jars( merge_maven_jars(

View File

@ -12,10 +12,10 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
package(default_visibility = ["//visibility:public"])
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library") load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_library")
package(default_visibility = ["//visibility:public"])
closure_js_library( closure_js_library(
name = "polymer_closure", name = "polymer_closure",
srcs = ["@polymer_closure//file"], srcs = ["@polymer_closure//file"],

View File

@ -1,7 +1,7 @@
package(default_visibility = ["//visibility:public"])
load("//tools/bzl:js.bzl", "bower_component_bundle")
load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:genrule2.bzl", "genrule2")
load("//tools/bzl:js.bzl", "bower_component_bundle")
package(default_visibility = ["//visibility:public"])
bower_component_bundle( bower_component_bundle(
name = "polygerrit_components.bower_components", name = "polygerrit_components.bower_components",

View File

@ -1,15 +1,11 @@
package(default_visibility = ["//visibility:public"])
load(":rules.bzl", "polygerrit_bundle")
load("//tools/bzl:genrule2.bzl", "genrule2") load("//tools/bzl:genrule2.bzl", "genrule2")
load("@io_bazel_rules_closure//closure:defs.bzl", "closure_js_binary", "closure_js_library")
load( load(
"//tools/bzl:js.bzl", "//tools/bzl:js.bzl",
"bower_component",
"bower_component_bundle", "bower_component_bundle",
"js_component",
"vulcanize",
) )
load(":rules.bzl", "polygerrit_bundle")
package(default_visibility = ["//visibility:public"])
polygerrit_bundle( polygerrit_bundle(
name = "polygerrit_ui", name = "polygerrit_ui",

View File

@ -56,17 +56,17 @@ def _replace_macros_impl(ctx):
_replace_macros = rule( _replace_macros = rule(
attrs = { attrs = {
"_exe": attr.label(
default = Label("//Documentation:replace_macros.py"),
allow_single_file = True,
),
"src": attr.label( "src": attr.label(
mandatory = True, mandatory = True,
allow_single_file = [".txt"], allow_single_file = [".txt"],
), ),
"suffix": attr.string(mandatory = True),
"searchbox": attr.bool(default = True),
"out": attr.output(mandatory = True), "out": attr.output(mandatory = True),
"searchbox": attr.bool(default = True),
"suffix": attr.string(mandatory = True),
"_exe": attr.label(
default = Label("//Documentation:replace_macros.py"),
allow_single_file = True,
),
}, },
implementation = _replace_macros_impl, implementation = _replace_macros_impl,
) )
@ -123,23 +123,23 @@ def _asciidoc_impl(ctx):
) )
_asciidoc_attrs = { _asciidoc_attrs = {
"srcs": attr.label_list(
mandatory = True,
allow_files = True,
),
"attributes": attr.string_list(),
"backend": attr.string(),
"suffix": attr.string(mandatory = True),
"version": attr.label(
default = Label("//:version.txt"),
allow_single_file = True,
),
"_exe": attr.label( "_exe": attr.label(
default = Label("//lib/asciidoctor:asciidoc"), default = Label("//lib/asciidoctor:asciidoc"),
cfg = "host", cfg = "host",
allow_files = True, allow_files = True,
executable = True, executable = True,
), ),
"srcs": attr.label_list(
mandatory = True,
allow_files = True,
),
"version": attr.label(
default = Label("//:version.txt"),
allow_single_file = True,
),
"suffix": attr.string(mandatory = True),
"backend": attr.string(),
"attributes": attr.string_list(),
} }
_asciidoc = rule( _asciidoc = rule(
@ -293,11 +293,11 @@ _asciidoc_zip = rule(
mandatory = True, mandatory = True,
allow_single_file = [".zip"], allow_single_file = [".zip"],
), ),
"directory": attr.string(mandatory = True),
"resources": attr.label_list( "resources": attr.label_list(
mandatory = True, mandatory = True,
allow_files = True, allow_files = True,
), ),
"directory": attr.string(mandatory = True),
}, },
outputs = { outputs = {
"out": "%{name}.zip", "out": "%{name}.zip",

View File

@ -7,8 +7,8 @@ def _classpath_collector(ctx):
elif hasattr(d, "files"): elif hasattr(d, "files"):
all += d.files all += d.files
as_strs = [c.path for c in all] as_strs = [c.path for c in all.to_list()]
ctx.file_action( ctx.actions.write(
output = ctx.outputs.runtime, output = ctx.outputs.runtime,
content = "\n".join(sorted(as_strs)), content = "\n".join(sorted(as_strs)),
) )

View File

@ -33,9 +33,9 @@ BROWSERS = [
ALIASES = { ALIASES = {
"chrome": "safari", "chrome": "safari",
"edge": "gecko1_8",
"firefox": "gecko1_8", "firefox": "gecko1_8",
"msie": "ie10", "msie": "ie10",
"edge": "gecko1_8",
} }
MODULE = "com.google.gerrit.GerritGwtUI" MODULE = "com.google.gerrit.GerritGwtUI"
@ -113,14 +113,14 @@ def _gwt_user_agent_module(ctx):
impl = ALIASES[ua] impl = ALIASES[ua]
# intermediate artifact: user agent speific GWT xml file # intermediate artifact: user agent speific GWT xml file
gwt_user_agent_xml = ctx.new_file(ctx.label.name + "_gwt.xml") gwt_user_agent_xml = ctx.actions.declare_file(ctx.label.name + "_gwt.xml")
ctx.file_action( ctx.actions.write(
output = gwt_user_agent_xml, output = gwt_user_agent_xml,
content = USER_AGENT_XML % (MODULE, impl), content = USER_AGENT_XML % (MODULE, impl),
) )
# intermediate artifact: user agent specific zip with GWT module # intermediate artifact: user agent specific zip with GWT module
gwt_user_agent_zip = ctx.new_file(ctx.label.name + "_gwt.zip") gwt_user_agent_zip = ctx.actions.declare_file(ctx.label.name + "_gwt.zip")
gwt = "%s_%s.gwt.xml" % (MODULE.replace(".", "/"), ua) gwt = "%s_%s.gwt.xml" % (MODULE.replace(".", "/"), ua)
dir = gwt_user_agent_zip.path + ".dir" dir = gwt_user_agent_zip.path + ".dir"
cmd = " && ".join([ cmd = " && ".join([
@ -209,14 +209,14 @@ def _get_transitive_closure(ctx):
gwt_binary = rule( gwt_binary = rule(
attrs = { attrs = {
"user_agent": attr.string(),
"style": attr.string(default = "OBF"),
"optimize": attr.string(default = "9"),
"deps": attr.label_list(allow_files = jar_filetype),
"module": attr.string_list(default = [MODULE]),
"module_deps": attr.label_list(allow_files = jar_filetype),
"compiler_args": attr.string_list(), "compiler_args": attr.string_list(),
"jvm_args": attr.string_list(), "jvm_args": attr.string_list(),
"module": attr.string_list(default = [MODULE]),
"module_deps": attr.label_list(allow_files = jar_filetype),
"optimize": attr.string(default = "9"),
"style": attr.string(default = "OBF"),
"user_agent": attr.string(),
"deps": attr.label_list(allow_files = jar_filetype),
"_jdk": attr.label( "_jdk": attr.label(
default = Label("//tools/defaults:jdk"), default = Label("//tools/defaults:jdk"),
), ),

View File

@ -23,7 +23,7 @@ def _impl(ctx):
source_jars += l.java.source_jars source_jars += l.java.source_jars
transitive_jar_set += l.java.transitive_deps transitive_jar_set += l.java.transitive_deps
transitive_jar_paths = [j.path for j in transitive_jar_set] transitive_jar_paths = [j.path for j in transitive_jar_set.to_list()]
dir = ctx.outputs.zip.path + ".dir" dir = ctx.outputs.zip.path + ".dir"
source = ctx.outputs.zip.path + ".source" source = ctx.outputs.zip.path + ".source"
external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
@ -32,7 +32,7 @@ def _impl(ctx):
"export TZ", "export TZ",
"rm -rf %s" % source, "rm -rf %s" % source,
"mkdir %s" % source, "mkdir %s" % source,
" && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars]), " && ".join(["unzip -qud %s %s" % (source, j.path) for j in source_jars.to_list()]),
"rm -rf %s" % dir, "rm -rf %s" % dir,
"mkdir %s" % dir, "mkdir %s" % dir,
" ".join([ " ".join([
@ -56,17 +56,17 @@ def _impl(ctx):
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename), "(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
] ]
ctx.actions.run_shell( ctx.actions.run_shell(
inputs = list(transitive_jar_set) + list(source_jars) + ctx.files._jdk, inputs = transitive_jar_set.to_list() + source_jars.to_list() + ctx.files._jdk,
outputs = [zip_output], outputs = [zip_output],
command = " && ".join(cmd), command = " && ".join(cmd),
) )
java_doc = rule( java_doc = rule(
attrs = { attrs = {
"external_docs": attr.string_list(),
"libs": attr.label_list(allow_files = False), "libs": attr.label_list(allow_files = False),
"pkgs": attr.string_list(), "pkgs": attr.string_list(),
"title": attr.string(), "title": attr.string(),
"external_docs": attr.string_list(),
"_jdk": attr.label( "_jdk": attr.label(
default = Label("@bazel_tools//tools/jdk:current_java_runtime"), default = Label("@bazel_tools//tools/jdk:current_java_runtime"),
allow_files = True, allow_files = True,

View File

@ -36,9 +36,9 @@ def _npm_binary_impl(ctx):
npm_binary = repository_rule( npm_binary = repository_rule(
attrs = { attrs = {
"repository": attr.string(default = NPMJS),
# Label resolves within repo of the .bzl file. # Label resolves within repo of the .bzl file.
"_download_script": attr.label(default = Label("//tools:download_file.py")), "_download_script": attr.label(default = Label("//tools:download_file.py")),
"repository": attr.string(default = NPMJS),
}, },
local = True, local = True,
implementation = _npm_binary_impl, implementation = _npm_binary_impl,
@ -119,13 +119,13 @@ def _bash(ctx, cmd):
bower_archive = repository_rule( bower_archive = repository_rule(
_bower_archive, _bower_archive,
attrs = { attrs = {
"_bower_archive": attr.label(default = Label("@bower//:%s" % _npm_tarball("bower"))),
"_run_npm": attr.label(default = Label("//tools/js:run_npm_binary.py")),
"_download_bower": attr.label(default = Label("//tools/js:download_bower.py")),
"sha1": attr.string(mandatory = True),
"version": attr.string(mandatory = True),
"package": attr.string(mandatory = True), "package": attr.string(mandatory = True),
"semver": attr.string(), "semver": attr.string(),
"sha1": attr.string(mandatory = True),
"version": attr.string(mandatory = True),
"_bower_archive": attr.label(default = Label("@bower//:%s" % _npm_tarball("bower"))),
"_download_bower": attr.label(default = Label("//tools/js:download_bower.py")),
"_run_npm": attr.label(default = Label("//tools/js:run_npm_binary.py")),
}, },
) )
@ -206,12 +206,12 @@ js_component = rule(
_bower_component = rule( _bower_component = rule(
_bower_component_impl, _bower_component_impl,
attrs = dict(_common_attrs.items() + { attrs = dict(_common_attrs.items() + {
"zipfile": attr.label(allow_single_file = [".zip"]),
"license": attr.label(allow_single_file = True), "license": attr.label(allow_single_file = True),
"version_json": attr.label(allow_files = [".json"]),
# If set, define by hand, and don't regenerate this entry in bower2bazel. # If set, define by hand, and don't regenerate this entry in bower2bazel.
"seed": attr.bool(default = False), "seed": attr.bool(default = False),
"version_json": attr.label(allow_files = [".json"]),
"zipfile": attr.label(allow_single_file = [".zip"]),
}.items()), }.items()),
) )
@ -246,7 +246,7 @@ def _bower_component_bundle_impl(ctx):
out_versions = ctx.outputs.version_json out_versions = ctx.outputs.version_json
ctx.actions.run_shell( ctx.actions.run_shell(
inputs = list(zips), inputs = zips.to_list(),
outputs = [out_zip], outputs = [out_zip],
command = " && ".join([ command = " && ".join([
"p=$PWD", "p=$PWD",
@ -255,7 +255,7 @@ def _bower_component_bundle_impl(ctx):
"rm -rf %s.dir" % out_zip.path, "rm -rf %s.dir" % out_zip.path,
"mkdir -p %s.dir/bower_components" % out_zip.path, "mkdir -p %s.dir/bower_components" % out_zip.path,
"cd %s.dir/bower_components" % out_zip.path, "cd %s.dir/bower_components" % out_zip.path,
"for z in %s; do unzip -q $p/$z ; done" % " ".join(sorted([z.path for z in zips])), "for z in %s; do unzip -q $p/$z ; done" % " ".join(sorted([z.path for z in zips.to_list()])),
"cd ..", "cd ..",
"find . -exec touch -t 198001010000 '{}' ';'", "find . -exec touch -t 198001010000 '{}' ';'",
"zip -Xqr $p/%s bower_components/*" % out_zip.path, "zip -Xqr $p/%s bower_components/*" % out_zip.path,
@ -264,10 +264,10 @@ def _bower_component_bundle_impl(ctx):
) )
ctx.actions.run_shell( ctx.actions.run_shell(
inputs = list(versions), inputs = versions.to_list(),
outputs = [out_versions], outputs = [out_versions],
mnemonic = "BowerVersions", mnemonic = "BowerVersions",
command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions]), out_versions.path), command = "(echo '{' ; for j in %s ; do cat $j; echo ',' ; done ; echo \\\"\\\":\\\"\\\"; echo '}') > %s" % (" ".join([v.path for v in versions.to_list()]), out_versions.path),
) )
return struct( return struct(
@ -280,8 +280,8 @@ bower_component_bundle = rule(
_bower_component_bundle_impl, _bower_component_bundle_impl,
attrs = _common_attrs, attrs = _common_attrs,
outputs = { outputs = {
"zip": "%{name}.zip",
"version_json": "%{name}-versions.json", "version_json": "%{name}-versions.json",
"zip": "%{name}.zip",
}, },
) )
"""Groups a set of bower components together in a zip file. """Groups a set of bower components together in a zip file.
@ -296,10 +296,8 @@ Outputs:
def _vulcanize_impl(ctx): def _vulcanize_impl(ctx):
# intermediate artifact. # intermediate artifact.
vulcanized = ctx.new_file( vulcanized = ctx.actions.declare_file(
ctx.configuration.genfiles_dir, ctx.outputs.html.path + ".vulcanized.html",
ctx.outputs.html,
".vulcanized.html",
) )
destdir = ctx.outputs.html.path + ".dir" destdir = ctx.outputs.html.path + ".dir"
zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles] zips = [z for d in ctx.attr.deps for z in d.transitive_zipfiles]
@ -381,11 +379,6 @@ def _vulcanize_impl(ctx):
_vulcanize_rule = rule( _vulcanize_rule = rule(
_vulcanize_impl, _vulcanize_impl,
attrs = { attrs = {
"deps": attr.label_list(providers = ["transitive_zipfiles"]),
"app": attr.label(
mandatory = True,
allow_single_file = True,
),
"srcs": attr.label_list(allow_files = [ "srcs": attr.label_list(allow_files = [
".js", ".js",
".html", ".html",
@ -393,7 +386,16 @@ _vulcanize_rule = rule(
".css", ".css",
".ico", ".ico",
]), ]),
"app": attr.label(
mandatory = True,
allow_single_file = True,
),
"pkg": attr.string(mandatory = True), "pkg": attr.string(mandatory = True),
"deps": attr.label_list(providers = ["transitive_zipfiles"]),
"_crisper_archive": attr.label(
default = Label("@crisper//:%s" % _npm_tarball("crisper")),
allow_single_file = True,
),
"_run_npm": attr.label( "_run_npm": attr.label(
default = Label("//tools/js:run_npm_binary.py"), default = Label("//tools/js:run_npm_binary.py"),
allow_single_file = True, allow_single_file = True,
@ -402,10 +404,6 @@ _vulcanize_rule = rule(
default = Label("@vulcanize//:%s" % _npm_tarball("vulcanize")), default = Label("@vulcanize//:%s" % _npm_tarball("vulcanize")),
allow_single_file = True, allow_single_file = True,
), ),
"_crisper_archive": attr.label(
default = Label("@crisper//:%s" % _npm_tarball("crisper")),
allow_single_file = True,
),
}, },
outputs = { outputs = {
"html": "%{name}.html", "html": "%{name}.html",
@ -415,4 +413,4 @@ _vulcanize_rule = rule(
def vulcanize(*args, **kwargs): def vulcanize(*args, **kwargs):
"""Vulcanize runs vulcanize and crisper on a set of sources.""" """Vulcanize runs vulcanize and crisper on a set of sources."""
_vulcanize_rule(*args, pkg = native.package_name(), **kwargs) _vulcanize_rule(pkg = native.package_name(), *args, **kwargs)

View File

@ -50,7 +50,7 @@ def _impl(ctx):
classes = ",".join( classes = ",".join(
[_AsClassName(x) for x in ctx.attr.srcs], [_AsClassName(x) for x in ctx.attr.srcs],
) )
ctx.file_action(output = ctx.outputs.out, content = _OUTPUT % ( ctx.actions.write(output = ctx.outputs.out, content = _OUTPUT % (
classes, classes,
ctx.attr.outname, ctx.attr.outname,
)) ))

View File

@ -164,15 +164,15 @@ def _maven_jar_impl(ctx):
maven_jar = repository_rule( maven_jar = repository_rule(
attrs = { attrs = {
"artifact": attr.string(mandatory = True), "artifact": attr.string(mandatory = True),
"attach_source": attr.bool(default = True),
"exclude": attr.string_list(),
"repository": attr.string(default = MAVEN_CENTRAL),
"sha1": attr.string(), "sha1": attr.string(),
"src_sha1": attr.string(), "src_sha1": attr.string(),
"_download_script": attr.label(default = Label("//tools:download_file.py")),
"repository": attr.string(default = MAVEN_CENTRAL),
"attach_source": attr.bool(default = True),
"unsign": attr.bool(default = False), "unsign": attr.bool(default = False),
"deps": attr.string_list(),
"exports": attr.string_list(), "exports": attr.string_list(),
"exclude": attr.string_list(), "deps": attr.string_list(),
"_download_script": attr.label(default = Label("//tools:download_file.py")),
}, },
local = True, local = True,
implementation = _maven_jar_impl, implementation = _maven_jar_impl,

View File

@ -82,7 +82,7 @@ def _war_impl(ctx):
elif hasattr(l, "files"): elif hasattr(l, "files"):
transitive_lib_deps += l.files transitive_lib_deps += l.files
for dep in transitive_lib_deps: for dep in transitive_lib_deps.to_list():
cmd += _add_file(dep, build_output + "/WEB-INF/lib/") cmd += _add_file(dep, build_output + "/WEB-INF/lib/")
inputs.append(dep) inputs.append(dep)
@ -91,7 +91,7 @@ def _war_impl(ctx):
for l in ctx.attr.pgmlibs: for l in ctx.attr.pgmlibs:
transitive_pgmlib_deps += l.java.transitive_runtime_deps transitive_pgmlib_deps += l.java.transitive_runtime_deps
for dep in transitive_pgmlib_deps: for dep in transitive_pgmlib_deps.to_list():
if dep not in inputs: if dep not in inputs:
cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/") cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/")
inputs.append(dep) inputs.append(dep)
@ -104,7 +104,7 @@ def _war_impl(ctx):
transitive_context_deps += jar.java.transitive_runtime_deps transitive_context_deps += jar.java.transitive_runtime_deps
elif hasattr(jar, "files"): elif hasattr(jar, "files"):
transitive_context_deps += jar.files transitive_context_deps += jar.files
for dep in transitive_context_deps: for dep in transitive_context_deps.to_list():
cmd += _add_context(dep, build_output) cmd += _add_context(dep, build_output)
inputs.append(dep) inputs.append(dep)

View File

@ -1,5 +1,5 @@
load("//tools/bzl:pkg_war.bzl", "LIBS", "PGMLIBS")
load("//tools/bzl:classpath.bzl", "classpath_collector") load("//tools/bzl:classpath.bzl", "classpath_collector")
load("//tools/bzl:pkg_war.bzl", "LIBS", "PGMLIBS")
load( load(
"//tools/bzl:plugins.bzl", "//tools/bzl:plugins.bzl",
"CORE_PLUGINS", "CORE_PLUGINS",