Skip to content

Commit

Permalink
Automated rollback of commit 21904a9.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Due to #16296 (comment)

*** Original change description ***

Collect implementation_deps in graph node aspect

This is needed for implementation_deps of cc_library targets to be linked into cc_binary targets with dynamic_deps and cc_shared_library targets.

Fixes #14731

Closes #14730.

PiperOrigin-RevId: 480360695
Change-Id: Ic1b9c17ce3af730fa0131f5d87e5ca99ae2740c5
  • Loading branch information
meteorcloudy authored and copybara-github committed Oct 11, 2022
1 parent 268be23 commit 512d9b5
Show file tree
Hide file tree
Showing 7 changed files with 4 additions and 56 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ public AspectParameters apply(Rule rule) {
: null;
}
};
private static final ImmutableList<String> CC_DEPS_ATTRIBUTES =
ImmutableList.of("deps", "implementation_deps");

@Override
public AspectDefinition getDefinition(AspectParameters aspectParameters) {
Expand All @@ -69,12 +67,9 @@ public ConfiguredAspect create(
RepositoryName toolsRepository)
throws ActionConflictException, InterruptedException {
ImmutableList.Builder<GraphNodeInfo> children = ImmutableList.builder();
for (String depsAttribute : CC_DEPS_ATTRIBUTES) {
if (ruleContext.attributes().has(depsAttribute)) {
children.addAll(
AnalysisUtils.getProviders(
ruleContext.getPrerequisites(depsAttribute), GraphNodeInfo.class));
}
if (ruleContext.attributes().has("deps")) {
children.addAll(
AnalysisUtils.getProviders(ruleContext.getPrerequisites("deps"), GraphNodeInfo.class));
}
return new ConfiguredAspect.Builder(ruleContext)
.addProvider(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ cc_shared_library(
"a_suffix",
],
static_deps = [
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:implementation_dep",
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux",
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux2",
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:prebuilt",
Expand All @@ -111,12 +110,6 @@ cc_library(
hdrs = ["preloaded_dep.h"],
)

cc_library(
name = "implementation_dep",
srcs = ["implementation_dep.cc"],
hdrs = ["implementation_dep.h"],
)

cc_library(
name = "foo",
srcs = [
Expand All @@ -131,7 +124,6 @@ cc_library(
"//src/conditions:linux": ["IS_LINUX"],
"//conditions:default": [],
}),
implementation_deps = ["implementation_dep"],
deps = [
"preloaded_dep",
"bar",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ function test_shared_library_symbols() {
check_symbol_absent "$symbols" "_Z3quxv"
check_symbol_absent "$symbols" "_Z4bar3v"
check_symbol_absent "$symbols" "_Z4bar4v"
check_symbol_absent "$symbols" "_Z18implementation_depv"
}

function test_shared_library_user_link_flags() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,12 @@
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/baz.h"
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/direct_so_file_cc_lib.h"
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/direct_so_file_cc_lib2.h"
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/implementation_dep.h"
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/preloaded_dep.h"
#include "src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/qux.h"

int foo() {
bar();
baz();
implementation_dep();
qux();
#ifdef IS_LINUX
direct_so_file_cc_lib();
Expand Down

This file was deleted.

This file was deleted.

3 changes: 1 addition & 2 deletions src/main/starlark/tests/builtins_bzl/cc_builtin_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ EOF
--experimental_link_static_libraries_once \
--experimental_enable_target_export_check --experimental_cc_shared_library \
--experimental_builtins_injection_override=+cc_binary \
--experimental_cc_implementation_deps \
//src/main/starlark/tests/builtins_bzl/cc/... || fail "expected success"
}

run_suite "cc_* built starlark test"
run_suite "cc_* built starlark test"

0 comments on commit 512d9b5

Please sign in to comment.