Merge branch 'stable-2.14' into stable-2.15
* stable-2.14: js.bzl: Avoid using deprecated depset union gwt.bzl: Avoid using deprecated depset union classpath.bzl: Avoid using deprecated depset union javadoc.bzl: Avoid using deprecated depset union pkg_war.bzl: Avoid using deprecated depset union Update rules_closure to make it forward compatible Change-Id: I97762abb1544ac0b2d77ab6ecb088abc444233fe
This commit is contained in:
@@ -14,9 +14,9 @@ http_archive(
|
||||
|
||||
http_archive(
|
||||
name = "io_bazel_rules_closure",
|
||||
sha256 = "4f2c173ebf95e94d98a0d5cb799e734536eaf3eca280eb15e124f5e5ef8b6e39",
|
||||
strip_prefix = "rules_closure-6fd76e645b5c622221c9920f41a4d0bc578a3046",
|
||||
urls = ["https://github.com/bazelbuild/rules_closure/archive/6fd76e645b5c622221c9920f41a4d0bc578a3046.tar.gz"],
|
||||
sha256 = "0e6de40666f2ebb2b30dc0339745a274d9999334a249b05a3b1f46462e489adf",
|
||||
strip_prefix = "rules_closure-87d24b1df8b62405de8dd059cb604fd9d4b1e395",
|
||||
urls = ["https://github.com/bazelbuild/rules_closure/archive/87d24b1df8b62405de8dd059cb604fd9d4b1e395.tar.gz"],
|
||||
)
|
||||
|
||||
# File is specific to Polymer and copied from the Closure Github -- should be
|
||||
|
@@ -1,13 +1,13 @@
|
||||
def _classpath_collector(ctx):
|
||||
all = depset()
|
||||
all = []
|
||||
for d in ctx.attr.deps:
|
||||
if hasattr(d, "java"):
|
||||
all += d.java.transitive_runtime_deps
|
||||
all += d.java.compilation_info.runtime_classpath
|
||||
all.append(d.java.transitive_runtime_deps)
|
||||
all.append(d.java.compilation_info.runtime_classpath)
|
||||
elif hasattr(d, "files"):
|
||||
all += d.files
|
||||
all.append(d.files)
|
||||
|
||||
as_strs = [c.path for c in all.to_list()]
|
||||
as_strs = [c.path for c in depset(transitive = all).to_list()]
|
||||
ctx.actions.write(
|
||||
output = ctx.outputs.runtime,
|
||||
content = "\n".join(sorted(as_strs)),
|
||||
|
@@ -196,17 +196,17 @@ def _gwt_binary_impl(ctx):
|
||||
)
|
||||
|
||||
def _get_transitive_closure(ctx):
|
||||
deps = depset()
|
||||
deps = []
|
||||
for dep in ctx.attr.module_deps:
|
||||
deps += dep.java.transitive_runtime_deps
|
||||
deps += dep.java.transitive_source_jars
|
||||
deps.append(dep.java.transitive_runtime_deps)
|
||||
deps.append(dep.java.transitive_source_jars)
|
||||
for dep in ctx.attr.deps:
|
||||
if hasattr(dep, "java"):
|
||||
deps += dep.java.transitive_runtime_deps
|
||||
deps.append(dep.java.transitive_runtime_deps)
|
||||
elif hasattr(dep, "files"):
|
||||
deps += dep.files
|
||||
deps.append(dep.files)
|
||||
|
||||
return deps
|
||||
return depset(transitive = deps)
|
||||
|
||||
gwt_binary = rule(
|
||||
attrs = {
|
||||
|
@@ -17,13 +17,10 @@
|
||||
def _impl(ctx):
|
||||
zip_output = ctx.outputs.zip
|
||||
|
||||
transitive_jar_set = depset()
|
||||
source_jars = depset()
|
||||
for l in ctx.attr.libs:
|
||||
source_jars += l.java.source_jars
|
||||
transitive_jar_set += l.java.transitive_deps
|
||||
transitive_jars = depset(transitive = [l.java.transitive_deps for l in ctx.attr.libs])
|
||||
source_jars = depset(transitive = [l.java.source_jars for l in ctx.attr.libs])
|
||||
|
||||
transitive_jar_paths = [j.path for j in transitive_jar_set.to_list()]
|
||||
transitive_jar_paths = [j.path for j in transitive_jars.to_list()]
|
||||
dir = ctx.outputs.zip.path + ".dir"
|
||||
source = ctx.outputs.zip.path + ".source"
|
||||
external_docs = ["http://docs.oracle.com/javase/8/docs/api"] + ctx.attr.external_docs
|
||||
@@ -56,7 +53,7 @@ def _impl(ctx):
|
||||
"(cd %s && zip -Xqr ../%s *)" % (dir, ctx.outputs.zip.basename),
|
||||
]
|
||||
ctx.actions.run_shell(
|
||||
inputs = transitive_jar_set.to_list() + source_jars.to_list() + ctx.files._jdk,
|
||||
inputs = transitive_jars.to_list() + source_jars.to_list() + ctx.files._jdk,
|
||||
outputs = [zip_output],
|
||||
command = " && ".join(cmd),
|
||||
)
|
||||
|
@@ -130,20 +130,20 @@ bower_archive = repository_rule(
|
||||
)
|
||||
|
||||
def _bower_component_impl(ctx):
|
||||
transitive_zipfiles = depset([ctx.file.zipfile])
|
||||
for d in ctx.attr.deps:
|
||||
transitive_zipfiles += d.transitive_zipfiles
|
||||
transitive_zipfiles = depset(
|
||||
direct = [ctx.file.zipfile],
|
||||
transitive = [d.transitive_zipfiles for d in ctx.attr.deps],
|
||||
)
|
||||
|
||||
transitive_licenses = depset()
|
||||
if ctx.file.license:
|
||||
transitive_licenses += depset([ctx.file.license])
|
||||
transitive_licenses = depset(
|
||||
direct = [ctx.file.license],
|
||||
transitive = [d.transitive_licenses for d in ctx.attr.deps],
|
||||
)
|
||||
|
||||
for d in ctx.attr.deps:
|
||||
transitive_licenses += d.transitive_licenses
|
||||
|
||||
transitive_versions = depset(ctx.files.version_json)
|
||||
for d in ctx.attr.deps:
|
||||
transitive_versions += d.transitive_versions
|
||||
transitive_versions = depset(
|
||||
direct = ctx.files.version_json,
|
||||
transitive = [d.transitive_versions for d in ctx.attr.deps],
|
||||
)
|
||||
|
||||
return struct(
|
||||
transitive_zipfiles = transitive_zipfiles,
|
||||
@@ -182,14 +182,14 @@ def _js_component(ctx):
|
||||
mnemonic = "GenBowerZip",
|
||||
)
|
||||
|
||||
licenses = depset()
|
||||
licenses = []
|
||||
if ctx.file.license:
|
||||
licenses += depset([ctx.file.license])
|
||||
licenses.append(ctx.file.license)
|
||||
|
||||
return struct(
|
||||
transitive_zipfiles = list([ctx.outputs.zip]),
|
||||
transitive_versions = depset(),
|
||||
transitive_licenses = licenses,
|
||||
transitive_licenses = depset(licenses),
|
||||
)
|
||||
|
||||
js_component = rule(
|
||||
@@ -232,15 +232,16 @@ def _bower_component_bundle_impl(ctx):
|
||||
"""A bunch of bower components zipped up."""
|
||||
zips = depset()
|
||||
for d in ctx.attr.deps:
|
||||
zips += d.transitive_zipfiles
|
||||
files = d.transitive_zipfiles
|
||||
|
||||
versions = depset()
|
||||
for d in ctx.attr.deps:
|
||||
versions += d.transitive_versions
|
||||
# TODO(davido): Make sure the field always contains a depset
|
||||
if type(files) == "list":
|
||||
files = depset(files)
|
||||
zips = depset(transitive = [zips, files])
|
||||
|
||||
licenses = depset()
|
||||
for d in ctx.attr.deps:
|
||||
licenses += d.transitive_versions
|
||||
versions = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
|
||||
|
||||
licenses = depset(transitive = [d.transitive_versions for d in ctx.attr.deps])
|
||||
|
||||
out_zip = ctx.outputs.zip
|
||||
out_versions = ctx.outputs.version_json
|
||||
|
@@ -75,35 +75,39 @@ def _war_impl(ctx):
|
||||
]
|
||||
|
||||
# Add lib
|
||||
transitive_lib_deps = depset()
|
||||
transitive_libs = []
|
||||
for l in ctx.attr.libs:
|
||||
if hasattr(l, "java"):
|
||||
transitive_lib_deps += l.java.transitive_runtime_deps
|
||||
transitive_libs.append(l.java.transitive_runtime_deps)
|
||||
elif hasattr(l, "files"):
|
||||
transitive_lib_deps += l.files
|
||||
transitive_libs.append(l.files)
|
||||
|
||||
transitive_lib_deps = depset(transitive = transitive_libs)
|
||||
for dep in transitive_lib_deps.to_list():
|
||||
cmd += _add_file(dep, build_output + "/WEB-INF/lib/")
|
||||
inputs.append(dep)
|
||||
|
||||
# Add pgm lib
|
||||
transitive_pgmlib_deps = depset()
|
||||
transitive_pgmlibs = []
|
||||
for l in ctx.attr.pgmlibs:
|
||||
transitive_pgmlib_deps += l.java.transitive_runtime_deps
|
||||
transitive_pgmlibs.append(l.java.transitive_runtime_deps)
|
||||
|
||||
transitive_pgmlib_deps = depset(transitive = transitive_pgmlibs)
|
||||
for dep in transitive_pgmlib_deps.to_list():
|
||||
if dep not in inputs:
|
||||
cmd += _add_file(dep, build_output + "/WEB-INF/pgm-lib/")
|
||||
inputs.append(dep)
|
||||
|
||||
# Add context
|
||||
transitive_context_deps = depset()
|
||||
transitive_context_libs = []
|
||||
if ctx.attr.context:
|
||||
for jar in ctx.attr.context:
|
||||
if hasattr(jar, "java"):
|
||||
transitive_context_deps += jar.java.transitive_runtime_deps
|
||||
transitive_context_libs.append(jar.java.transitive_runtime_deps)
|
||||
elif hasattr(jar, "files"):
|
||||
transitive_context_deps += jar.files
|
||||
transitive_context_libs.append(jar.files)
|
||||
|
||||
transitive_context_deps = depset(transitive = transitive_context_libs)
|
||||
for dep in transitive_context_deps.to_list():
|
||||
cmd += _add_context(dep, build_output)
|
||||
inputs.append(dep)
|
||||
|
Reference in New Issue
Block a user