@@ -34,7 +34,7 @@ private CcStarlarkApiProvider getApi(String label) throws Exception {
34
34
return (CcStarlarkApiProvider ) rule .get (CcStarlarkApiProvider .NAME );
35
35
}
36
36
37
- private CcStarlarkApiInfo getApiForCcBinary (String label ) throws Exception {
37
+ private CcStarlarkApiInfo getApiForBuiltin (String label ) throws Exception {
38
38
RuleConfiguredTarget rule = (RuleConfiguredTarget ) getConfiguredTarget (label );
39
39
return (CcStarlarkApiInfo ) rule .get (CcStarlarkApiProvider .NAME );
40
40
}
@@ -104,7 +104,9 @@ public void testDisableInCcProtoLibrary() throws Exception {
104
104
105
105
@ Test
106
106
public void testTransitiveHeaders () throws Exception {
107
- setBuildLanguageOptions ("--experimental_builtins_injection_override=+cc_binary" );
107
+ setBuildLanguageOptions (
108
+ "--experimental_builtins_injection_override=+cc_binary" ,
109
+ "--experimental_builtins_injection_override=+cc_library" );
108
110
useConfiguration ("--noincompatible_disable_legacy_cc_provider" );
109
111
scratch .file (
110
112
"pkg/BUILD" ,
@@ -119,15 +121,19 @@ public void testTransitiveHeaders() throws Exception {
119
121
")" );
120
122
assertThat (
121
123
ActionsTestUtil .baseArtifactNames (
122
- getApiForCcBinary ("//pkg:check" ).getTransitiveHeaders ()))
124
+ getApiForBuiltin ("//pkg:check" ).getTransitiveHeaders ()))
123
125
.containsAtLeast ("lib.h" , "bin.h" );
124
- assertThat (ActionsTestUtil .baseArtifactNames (getApi ("//pkg:check_lib" ).getTransitiveHeaders ()))
126
+ assertThat (
127
+ ActionsTestUtil .baseArtifactNames (
128
+ getApiForBuiltin ("//pkg:check_lib" ).getTransitiveHeaders ()))
125
129
.contains ("lib.h" );
126
130
}
127
131
128
132
@ Test
129
133
public void testLinkFlags () throws Exception {
130
- setBuildLanguageOptions ("--experimental_builtins_injection_override=+cc_binary" );
134
+ setBuildLanguageOptions (
135
+ "--experimental_builtins_injection_override=+cc_binary" ,
136
+ "--experimental_builtins_injection_override=+cc_library" );
131
137
useConfiguration ("--noincompatible_disable_legacy_cc_provider" );
132
138
scratch .file (
133
139
"pkg/BUILD" ,
@@ -152,18 +158,19 @@ public void testLinkFlags() throws Exception {
152
158
" defines = ['foo']," ,
153
159
" linkopts = ['-Wl,-M']," ,
154
160
")" );
155
- assertThat (getApi ("//pkg:check_lib" ).getLinkopts ())
156
- .contains ("-Wl,-M" );
157
- assertThat (getApi ("//pkg:dependent_lib" ).getLinkopts ())
161
+ assertThat (getApiForBuiltin ("//pkg:check_lib" ).getLinkopts ()).contains ("-Wl,-M" );
162
+ assertThat (getApiForBuiltin ("//pkg:dependent_lib" ).getLinkopts ())
158
163
.containsAtLeast ("-lz" , "-Wl,-M" )
159
164
.inOrder ();
160
- assertThat (getApiForCcBinary ("//pkg:check" ).getLinkopts ()).isEmpty ();
161
- assertThat (getApiForCcBinary ("//pkg:check_no_srcs" ).getLinkopts ()).isEmpty ();
165
+ assertThat (getApiForBuiltin ("//pkg:check" ).getLinkopts ()).isEmpty ();
166
+ assertThat (getApiForBuiltin ("//pkg:check_no_srcs" ).getLinkopts ()).isEmpty ();
162
167
}
163
168
164
169
@ Test
165
170
public void testLibraries () throws Exception {
166
- setBuildLanguageOptions ("--experimental_builtins_injection_override=+cc_binary" );
171
+ setBuildLanguageOptions (
172
+ "--experimental_builtins_injection_override=+cc_binary" ,
173
+ "--experimental_builtins_injection_override=+cc_library" );
167
174
useConfiguration ("--noincompatible_disable_legacy_cc_provider" );
168
175
scratch .file (
169
176
"pkg/BUILD" ,
@@ -180,13 +187,14 @@ public void testLibraries() throws Exception {
180
187
" name = 'check_lib'," ,
181
188
" srcs = ['lib.cc', 'lib.h']," ,
182
189
")" );
183
- assertThat (ActionsTestUtil .baseArtifactNames (getApi ("//pkg:check_lib" ).getLibraries ()))
190
+ assertThat (
191
+ ActionsTestUtil .baseArtifactNames (getApiForBuiltin ("//pkg:check_lib" ).getLibraries ()))
184
192
.containsExactly ("libcheck_lib.a" );
185
- assertThat (ActionsTestUtil .baseArtifactNames (getApiForCcBinary ("//pkg:check" ).getLibraries ()))
193
+ assertThat (ActionsTestUtil .baseArtifactNames (getApiForBuiltin ("//pkg:check" ).getLibraries ()))
186
194
.isEmpty ();
187
195
assertThat (
188
196
ActionsTestUtil .baseArtifactNames (
189
- getApiForCcBinary ("//pkg:check_no_srcs" ).getLibraries ()))
197
+ getApiForBuiltin ("//pkg:check_no_srcs" ).getLibraries ()))
190
198
.isEmpty ();
191
199
}
192
200
@@ -205,7 +213,7 @@ public void testCcFlags() throws Exception {
205
213
" name = 'check_lib'," ,
206
214
" defines = ['foo']," ,
207
215
")" );
208
- assertThat (getApiForCcBinary ("//pkg:check" ).getCcFlags ()).contains ("-Dfoo" );
216
+ assertThat (getApiForBuiltin ("//pkg:check" ).getCcFlags ()).contains ("-Dfoo" );
209
217
}
210
218
211
219
@ Test
0 commit comments