-
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.
Automated rollback of commit f7946d0.
*** Reason for rollback *** 17.k breakages because of too many combinations [] *** Original change description *** Propagate graph_node_aspect over a computed default attribute Set computed default to deps only when we need to propagate graph_node aspect. This change makes it possible to collapse cc_binary and cc_test into a single rule. PiperOrigin-RevId: 574422599 Change-Id: I5245d28fd6778591410d8027a6edfe742c764426
- Loading branch information
1 parent
98e1b30
commit c59739e
Showing
13 changed files
with
257 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.