diff --git a/.bazelci/presubmit.yml b/.bazelci/presubmit.yml index 6422631d39..ea43970407 100644 --- a/.bazelci/presubmit.yml +++ b/.bazelci/presubmit.yml @@ -13,6 +13,7 @@ all_targets: &all_targets - "//experimental/..." - "//packaging/..." - "//python/..." + - "//tests/..." - "//tools/..." # As a regression test for #225, check that wheel targets still build when # their package path is qualified with the repo name. diff --git a/python/defs.bzl b/python/defs.bzl index 1e36de3a72..890c221e72 100644 --- a/python/defs.bzl +++ b/python/defs.bzl @@ -36,7 +36,7 @@ _MIGRATION_TAG = "__PYTHON_RULES_MIGRATION_DO_NOT_USE_WILL_BREAK__" def _add_tags(attrs): if "tags" in attrs and attrs["tags"] != None: - attrs["tags"] += [_MIGRATION_TAG] + attrs["tags"] = attrs["tags"] + [_MIGRATION_TAG] else: attrs["tags"] = [_MIGRATION_TAG] return attrs diff --git a/tests/load_from_macro/BUILD b/tests/load_from_macro/BUILD new file mode 100644 index 0000000000..2102e4d08a --- /dev/null +++ b/tests/load_from_macro/BUILD @@ -0,0 +1,24 @@ +# Copyright 2019 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +load("//python:defs.bzl", "py_library") +load(":tags.bzl", "TAGS") + +licenses(["notice"]) + +py_library( + name = "foo", + srcs = ["foo.py"], + tags = TAGS, +) diff --git a/tests/load_from_macro/foo.py b/tests/load_from_macro/foo.py new file mode 100644 index 0000000000..724cdcb69a --- /dev/null +++ b/tests/load_from_macro/foo.py @@ -0,0 +1,13 @@ +# Copyright 2019 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. diff --git a/tests/load_from_macro/tags.bzl b/tests/load_from_macro/tags.bzl new file mode 100644 index 0000000000..18c10e0f3c --- /dev/null +++ b/tests/load_from_macro/tags.bzl @@ -0,0 +1,18 @@ +# Copyright 2019 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +""" +Example tags defined in a separate file. +""" +TAGS = ["first_tag", "second_tag"]