Adapt to latest bazel release
Bazel 0.6.0 deprecates set() [1], advising for it to be replaced with
depset(). Also and more important, all the augmented assignments of a
list are now reported as errors.
[1] https://github.com/bazelbuild/bazel/releases
Change-Id: I7ce041f7d57e35a47a599e700e4bf1cf31f550c9
diff --git a/tools/classpath.bzl b/tools/classpath.bzl
index 5b9242e..fa7d9e2 100644
--- a/tools/classpath.bzl
+++ b/tools/classpath.bzl
@@ -1,11 +1,11 @@
def _classpath_collector(ctx):
- all = set()
+ all = depset()
for d in ctx.attr.deps:
if hasattr(d, 'java'):
- all += d.java.transitive_runtime_deps
- all += d.java.compilation_info.runtime_classpath
+ all = all + d.java.transitive_runtime_deps
+ all = all + d.java.compilation_info.runtime_classpath
elif hasattr(d, 'files'):
- all += d.files
+ all = all + d.files
as_strs = [c.path for c in all]
ctx.file_action(output= ctx.outputs.runtime,
diff --git a/tools/download_file.py b/tools/download_file.py
index c9736bf..5b92ee4 100755
--- a/tools/download_file.py
+++ b/tools/download_file.py
@@ -127,7 +127,7 @@
exclude = []
if args.x:
- exclude += args.x
+ exclude = exclude + args.x
if args.exclude_java_sources:
try:
with ZipFile(cache_ent, 'r') as zf:
diff --git a/tools/gwt.bzl b/tools/gwt.bzl
index fd131af..16edcb6 100644
--- a/tools/gwt.bzl
+++ b/tools/gwt.bzl
@@ -90,7 +90,7 @@
def gwt_module(gwt_xml=None, resources=[], srcs=[], **kwargs):
if gwt_xml:
- resources += [gwt_xml]
+ resources = resources + [gwt_xml]
java_library2(
srcs = srcs,
@@ -162,7 +162,7 @@
deploy_dir,
)
# TODO(davido): clean up command concatenation
- cmd += " ".join([
+ cmd = cmd + " ".join([
"-style %s" % ctx.attr.style,
"-optimize %s" % ctx.attr.optimize,
"-strict",
@@ -186,15 +186,15 @@
)
def _get_transitive_closure(ctx):
- deps = set()
+ deps = depset()
for dep in ctx.attr.module_deps:
- deps += dep.java.transitive_runtime_deps
- deps += dep.java.transitive_source_jars
+ deps = deps + dep.java.transitive_runtime_deps
+ deps = deps + dep.java.transitive_source_jars
for dep in ctx.attr.deps:
if hasattr(dep, 'java'):
- deps += dep.java.transitive_runtime_deps
+ deps = deps + dep.java.transitive_runtime_deps
elif hasattr(dep, 'files'):
- deps += dep.files
+ deps = deps + dep.files
return deps
diff --git a/tools/java.bzl b/tools/java.bzl
index b0c3619..5fca724 100644
--- a/tools/java.bzl
+++ b/tools/java.bzl
@@ -17,8 +17,8 @@
def java_library2(deps=[], exported_deps=[], exports=[], **kwargs):
if exported_deps:
- deps += exported_deps
- exports += exported_deps
+ deps = deps + exported_deps
+ exports = exports + exported_deps
native.java_library(
deps = deps,
exports = exports,
diff --git a/tools/javadoc.bzl b/tools/javadoc.bzl
index 341b9c1..a09f40b 100644
--- a/tools/javadoc.bzl
+++ b/tools/javadoc.bzl
@@ -20,8 +20,8 @@
transitive_jar_set = set()
source_jars = set()
for l in ctx.attr.libs:
- source_jars += l.java.source_jars
- transitive_jar_set += l.java.transitive_deps
+ source_jars = source_jars + l.java.source_jars
+ transitive_jar_set = transitive_jar_set + l.java.transitive_deps
transitive_jar_paths = [j.path for j in transitive_jar_set]
dir = ctx.outputs.zip.path + ".dir"
diff --git a/tools/maven_jar.bzl b/tools/maven_jar.bzl
index e0f4237..8947893 100644
--- a/tools/maven_jar.bzl
+++ b/tools/maven_jar.bzl
@@ -73,12 +73,12 @@
formatted_deps = ""
if deps:
if len(deps) == 1:
- formatted_deps += "%s = [\'%s\']," % (attr, deps[0])
+ formatted_deps = formatted_deps + "%s = [\'%s\']," % (attr, deps[0])
else:
- formatted_deps += "%s = [\n" % attr
+ formatted_deps = formatted_deps + "%s = [\n" % attr
for dep in deps:
- formatted_deps += " \'%s\',\n" % dep
- formatted_deps += " ],"
+ formatted_deps = formatted_deps + " \'%s\',\n" % dep
+ formatted_deps = formatted_deps + " ],"
return formatted_deps
# Provides the syntax "@jar_name//jar" for bin classifier
diff --git a/tools/pkg_war.bzl b/tools/pkg_war.bzl
index b2f0452..171173f 100644
--- a/tools/pkg_war.bzl
+++ b/tools/pkg_war.bzl
@@ -31,7 +31,7 @@
if n != 'web.xml' and short_path.startswith('%s-' % name):
n = short_path.split('/')[0] + '-' + n
- output_path += n
+ output_path = output_path + n
return [
'test -L %s || ln -s $(pwd)/%s %s' % (output_path, input_path, output_path)
@@ -56,31 +56,31 @@
'mkdir -p %s/WEB-INF/lib' % build_output,
]
- transitive_lib_deps = set()
+ transitive_lib_deps = depset()
for l in ctx.attr.libs:
if hasattr(l, 'java'):
- transitive_lib_deps += l.java.transitive_runtime_deps
+ transitive_lib_deps = transitive_lib_deps + l.java.transitive_runtime_deps
elif hasattr(l, 'files'):
- transitive_lib_deps += l.files
+ transitive_lib_deps = transitive_lib_deps + l.files
for dep in transitive_lib_deps:
- cmd += _add_file(ctx.attr.name, dep, build_output + '/WEB-INF/lib/')
+ cmd = cmd + _add_file(ctx.attr.name, dep, build_output + '/WEB-INF/lib/')
inputs.append(dep)
if ctx.attr.web_xml:
for web_xml in ctx.attr.web_xml.files:
inputs.append(web_xml)
- cmd += _add_file(ctx.attr.name, web_xml, build_output + '/WEB-INF/')
+ cmd = cmd + _add_file(ctx.attr.name, web_xml, build_output + '/WEB-INF/')
- transitive_context_deps = set()
+ transitive_context_deps = depset()
if ctx.attr.context:
for jar in ctx.attr.context:
if hasattr(jar, 'java'):
- transitive_context_deps += jar.java.transitive_runtime_deps
+ transitive_context_deps = transitive_context_deps + jar.java.transitive_runtime_deps
elif hasattr(jar, 'files'):
- transitive_context_deps += jar.files
+ transitive_context_deps = transitive_context_deps + jar.files
for dep in transitive_context_deps:
- cmd += _add_context(dep, build_output)
+ cmd = cmd + _add_context(dep, build_output)
inputs.append(dep)
# Add zip war
diff --git a/tools/py_binary_path.bzl b/tools/py_binary_path.bzl
index 6bd3bfe..8b7384e 100644
--- a/tools/py_binary_path.bzl
+++ b/tools/py_binary_path.bzl
@@ -17,7 +17,7 @@
content = ""
for f in ctx.attr.py_binary_label.py.transitive_sources:
if ctx.attr.name in f.path:
- content += f.path
+ content = content + f.path
ctx.file_action(output = ctx.outputs.output, content=content)
py_binary_path = rule(