Make bzl files compatible with mutating behavior of += on lists

In the future versions of Bazel (starting with 0.7 or 0.8) += on lists
will behave like in Python, by mutating the left hand side list. If this
list is frozen it will cause a runtime error. To preserve the previous
behavior such lists should be either copied or the `a = a + b` syntax
should be used (which is completely equivalent with the old behavior of
+= on lists).

Change-Id: I3ef62e0c1f3b5ceca705ed4fa331122c3190991e
This commit is contained in:
Vladimir Moskva 2017-09-26 16:31:08 +02:00 committed by David Pursehouse
parent 9df753e05e
commit 8f5ca5abf9
2 changed files with 3 additions and 3 deletions

View File

@ -98,7 +98,7 @@ USER_AGENT_XML = """<module rename-to='gerrit_ui'>
def gwt_module(gwt_xml=None, resources=[], srcs=[], **kwargs):
if gwt_xml:
resources += [gwt_xml]
resources = resources + [gwt_xml]
java_library2(
srcs = srcs,

View File

@ -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,