-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[7.0.0] 'required_providers' for an aspect does not always work toget…
…her with the 'aspects' requirement on rule attributes (#19986) Fixes: #19609 Commit b1d3441 PiperOrigin-RevId: 576924920 Change-Id: I7ab0c13539f729a80a08e264d35aed7dafe78cc0 --------- Co-authored-by: Googler <ilist@google.com> Co-authored-by: Googler <messa@google.com>
- Loading branch information
1 parent
b3d0760
commit a492528
Showing
13 changed files
with
258 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
src/main/starlark/builtins_bzl/common/cc/cc_binary_with_aspects.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2022 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. | ||
|
||
"""Exports cc_binary variant with aspects. | ||
If dynamic_deps attribute is specified we need to propagate | ||
aspects. | ||
""" | ||
|
||
load(":common/cc/cc_binary.bzl", "make_cc_binary") | ||
load(":common/cc/cc_binary_attrs.bzl", "cc_binary_attrs_with_aspects") | ||
|
||
cc_binary = make_cc_binary(cc_binary_attrs_with_aspects) |
24 changes: 24 additions & 0 deletions
24
src/main/starlark/builtins_bzl/common/cc/cc_binary_without_aspects.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# Copyright 2022 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. | ||
|
||
"""Exports cc_binary variant without aspects. | ||
If dynamic_deps attribute is not specified we do not propagate | ||
aspects. | ||
""" | ||
|
||
load(":common/cc/cc_binary.bzl", "make_cc_binary") | ||
load(":common/cc/cc_binary_attrs.bzl", "cc_binary_attrs_without_aspects") | ||
|
||
cc_binary = make_cc_binary(cc_binary_attrs_without_aspects) |
30 changes: 30 additions & 0 deletions
30
src/main/starlark/builtins_bzl/common/cc/cc_binary_wrapper.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Copyright 2022 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. | ||
|
||
"""Macro encapsulating cc_binary rule implementation. | ||
This is to avoid propagating aspect on certain attributes in case | ||
dynamic_deps attribute is not specified. | ||
""" | ||
|
||
load(":common/cc/cc_binary_with_aspects.bzl", cc_binary_with_aspects = "cc_binary") | ||
load(":common/cc/cc_binary_without_aspects.bzl", cc_binary_without_aspects = "cc_binary") | ||
load(":common/cc/cc_helper.bzl", "cc_helper") | ||
|
||
def cc_binary(**kwargs): | ||
# Propagate an aspect if dynamic_deps attribute is specified. | ||
if "dynamic_deps" in kwargs and cc_helper.is_non_empty_list_or_select(kwargs["dynamic_deps"], "dynamic_deps"): | ||
cc_binary_with_aspects(**kwargs) | ||
else: | ||
cc_binary_without_aspects(**kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/starlark/builtins_bzl/common/cc/cc_test_with_aspects.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Copyright 2022 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. | ||
|
||
"""cc_test Starlark implementation.""" | ||
|
||
load(":common/cc/cc_test.bzl", "make_cc_test") | ||
|
||
cc_test = make_cc_test(with_aspects = True) |
Oops, something went wrong.