Commit 21904a9 1 parent 801e01c commit 21904a9 Copy full SHA for 21904a9
File tree 7 files changed +56
-4
lines changed
java/com/google/devtools/build/lib/rules/cpp
starlark/tests/builtins_bzl
cc/cc_shared_library/test_cc_shared_library
7 files changed +56
-4
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,8 @@ public AspectParameters apply(Rule rule) {
50
50
: null ;
51
51
}
52
52
};
53
+ private static final ImmutableList <String > CC_DEPS_ATTRIBUTES =
54
+ ImmutableList .of ("deps" , "implementation_deps" );
53
55
54
56
@ Override
55
57
public AspectDefinition getDefinition (AspectParameters aspectParameters ) {
@@ -67,9 +69,12 @@ public ConfiguredAspect create(
67
69
RepositoryName toolsRepository )
68
70
throws ActionConflictException , InterruptedException {
69
71
ImmutableList .Builder <GraphNodeInfo > children = ImmutableList .builder ();
70
- if (ruleContext .attributes ().has ("deps" )) {
71
- children .addAll (
72
- AnalysisUtils .getProviders (ruleContext .getPrerequisites ("deps" ), GraphNodeInfo .class ));
72
+ for (String depsAttribute : CC_DEPS_ATTRIBUTES ) {
73
+ if (ruleContext .attributes ().has (depsAttribute )) {
74
+ children .addAll (
75
+ AnalysisUtils .getProviders (
76
+ ruleContext .getPrerequisites (depsAttribute ), GraphNodeInfo .class ));
77
+ }
73
78
}
74
79
return new ConfiguredAspect .Builder (ruleContext )
75
80
.addProvider (
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ cc_shared_library(
90
90
"a_suffix",
91
91
],
92
92
static_deps = [
93
+ "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:implementation_dep",
93
94
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux",
94
95
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux2",
95
96
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:prebuilt",
@@ -110,6 +111,12 @@ cc_library(
110
111
hdrs = ["preloaded_dep.h"],
111
112
)
112
113
114
+ cc_library(
115
+ name = "implementation_dep",
116
+ srcs = ["implementation_dep.cc"],
117
+ hdrs = ["implementation_dep.h"],
118
+ )
119
+
113
120
cc_library(
114
121
name = "foo",
115
122
srcs = [
@@ -124,6 +131,7 @@ cc_library(
124
131
"//src/conditions:linux": ["IS_LINUX"],
125
132
"//conditions:default": [],
126
133
}),
134
+ implementation_deps = ["implementation_dep"],
127
135
deps = [
128
136
"preloaded_dep",
129
137
"bar",
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ function test_shared_library_symbols() {
48
48
check_symbol_absent " $symbols " " _Z3quxv"
49
49
check_symbol_absent " $symbols " " _Z4bar3v"
50
50
check_symbol_absent " $symbols " " _Z4bar4v"
51
+ check_symbol_absent " $symbols " " _Z18implementation_depv"
51
52
}
52
53
53
54
function test_shared_library_user_link_flags() {
Original file line number Diff line number Diff line change 15
15
#include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/baz.h"
16
16
#include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/direct_so_file_cc_lib.h"
17
17
#include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/direct_so_file_cc_lib2.h"
18
+ #include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/implementation_dep.h"
18
19
#include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/preloaded_dep.h"
19
20
#include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/qux.h"
20
21
21
22
int foo () {
22
23
bar ();
23
24
baz ();
25
+ implementation_dep ();
24
26
qux ();
25
27
#ifdef IS_LINUX
26
28
direct_so_file_cc_lib ();
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Bazel Authors. All rights reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ #include " src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/implementation_dep.h"
15
+
16
+ int implementation_dep () { return 43 ; }
Original file line number Diff line number Diff line change
1
+ // Copyright 2016 The Bazel Authors. All rights reserved.
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+ #ifndef EXAMPLES_TEST_CC_SHARED_LIBRARY_IMPLEMENTATION_DEP_H_
15
+ #define EXAMPLES_TEST_CC_SHARED_LIBRARY_IMPLEMENTATION_DEP_H_
16
+
17
+ int implementation_dep ();
18
+
19
+ #endif // EXAMPLES_TEST_CC_SHARED_LIBRARY_IMPLEMENTATION_DEP_H_
Original file line number Diff line number Diff line change 73
73
--experimental_link_static_libraries_once \
74
74
--experimental_enable_target_export_check --experimental_cc_shared_library \
75
75
--experimental_builtins_injection_override=+cc_binary \
76
+ --experimental_cc_implementation_deps \
76
77
//src/main/starlark/tests/builtins_bzl/cc/... || fail " expected success"
77
78
}
78
79
79
- run_suite " cc_* built starlark test"
80
+ run_suite " cc_* built starlark test"
You can’t perform that action at this time.
0 commit comments