1
- load(":starlark_tests.bzl", "additional_inputs_test", "build_failure_test", "debug_files_test", "interface_library_output_group_test", "linking_suffix_test", "paths_test", "runfiles_test")
1
+ load(
2
+ ":starlark_tests.bzl",
3
+ "additional_inputs_test",
4
+ "build_failure_test",
5
+ "debug_files_test",
6
+ "interface_library_output_group_test",
7
+ "linking_suffix_test",
8
+ "paths_test",
9
+ "runfiles_test",
10
+ "no_exporting_static_lib_test",
11
+ )
2
12
3
13
LINKABLE_MORE_THAN_ONCE = "LINKABLE_MORE_THAN_ONCE"
4
14
@@ -42,28 +52,28 @@ cc_binary(
42
52
cc_shared_library(
43
53
name = "python_module",
44
54
features = ["windows_export_all_symbols"],
45
- roots = [":a_suffix"],
55
+ deps = [":a_suffix"],
46
56
shared_lib_name = "python_module.pyd",
47
57
)
48
58
49
59
cc_shared_library(
50
60
name = "a_so",
51
61
features = ["windows_export_all_symbols"],
52
- roots = [":a_suffix"],
62
+ deps = [":a_suffix"],
53
63
)
54
64
55
65
cc_shared_library(
56
66
name = "diamond_so",
57
67
dynamic_deps = [":a_so"],
58
68
features = ["windows_export_all_symbols"],
59
- roots = [":qux"],
69
+ deps = [":qux"],
60
70
)
61
71
62
72
cc_shared_library(
63
73
name = "diamond2_so",
64
74
dynamic_deps = [":a_so"],
65
75
features = ["windows_export_all_symbols"],
66
- roots = [":qux2"],
76
+ deps = [":qux2"],
67
77
)
68
78
69
79
cc_binary(
@@ -88,19 +98,17 @@ cc_shared_library(
88
98
],
89
99
"//conditions:default": [],
90
100
}),
91
- dynamic_deps = ["bar_so"],
101
+ dynamic_deps = [
102
+ "bar_so",
103
+ "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library3:diff_pkg_so"
104
+ ],
92
105
features = ["windows_export_all_symbols"],
93
106
preloaded_deps = ["preloaded_dep"],
94
- roots = [
107
+ deps = [
95
108
"baz",
96
109
"foo",
97
110
"a_suffix",
98
111
],
99
- static_deps = [
100
- "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux",
101
- "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux2",
102
- "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:prebuilt",
103
- ],
104
112
user_link_flags = select({
105
113
"//src/conditions:linux": [
106
114
"-Wl,-rpath,kittens",
@@ -139,6 +147,7 @@ cc_library(
139
147
"qux",
140
148
"qux2",
141
149
"prebuilt",
150
+ "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library3:diff_pkg"
142
151
],
143
152
)
144
153
@@ -190,18 +199,13 @@ cc_shared_library(
190
199
permissions = [
191
200
"//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library3:permissions",
192
201
],
193
- roots = [
202
+ deps = [
194
203
"bar",
195
204
"bar2",
196
205
] + select({
197
206
":is_bazel": ["@test_repo//:bar"],
198
207
"//conditions:default": [],
199
208
}),
200
- static_deps = [
201
- "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:barX",
202
- "@test_repo//:bar",
203
- "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library:qux2",
204
- ],
205
209
user_link_flags = select({
206
210
"//src/conditions:linux": [
207
211
"-Wl,--version-script=$(location :bar.lds)",
@@ -346,7 +350,7 @@ filegroup(
346
350
cc_shared_library(
347
351
name = "direct_so_file",
348
352
features = ["windows_export_all_symbols"],
349
- roots = [
353
+ deps = [
350
354
":direct_so_file_cc_lib",
351
355
],
352
356
)
@@ -367,7 +371,7 @@ filegroup(
367
371
cc_shared_library(
368
372
name = "renamed_so_file",
369
373
features = ["windows_export_all_symbols"],
370
- roots = [
374
+ deps = [
371
375
":direct_so_file_cc_lib2",
372
376
],
373
377
shared_lib_name = "renamed_so_file.so",
@@ -398,6 +402,51 @@ cc_shared_library_permissions(
398
402
],
399
403
)
400
404
405
+ cc_library(
406
+ name = "static_lib_no_exporting",
407
+ srcs = [
408
+ "bar.cc",
409
+ "bar.h",
410
+ ],
411
+ tags = ["NO_EXPORTING"],
412
+ )
413
+
414
+ cc_library(
415
+ name = "static_lib_exporting",
416
+ srcs = [
417
+ "bar2.cc",
418
+ "bar2.h",
419
+ ],
420
+ )
421
+
422
+ cc_shared_library(
423
+ name = "lib_with_no_exporting_roots_1",
424
+ deps = [":static_lib_no_exporting"],
425
+ )
426
+
427
+ cc_shared_library(
428
+ name = "lib_with_no_exporting_roots_2",
429
+ deps = [":static_lib_no_exporting"],
430
+ dynamic_deps = [":lib_with_no_exporting_roots_3"],
431
+ )
432
+
433
+ cc_shared_library(
434
+ name = "lib_with_no_exporting_roots_3",
435
+ deps = [":static_lib_no_exporting"],
436
+ )
437
+
438
+ cc_shared_library(
439
+ name = "lib_with_no_exporting_roots",
440
+ deps = [
441
+ ":static_lib_no_exporting",
442
+ ":static_lib_exporting",
443
+ ],
444
+ dynamic_deps = [
445
+ ":lib_with_no_exporting_roots_1",
446
+ ":lib_with_no_exporting_roots_2",
447
+ ],
448
+ )
449
+
401
450
build_failure_test(
402
451
name = "two_dynamic_deps_same_export_in_so_test",
403
452
message = "Two shared libraries in dependencies export the same symbols",
@@ -433,16 +482,7 @@ runfiles_test(
433
482
target_under_test = ":python_test",
434
483
)
435
484
436
- build_failure_test(
437
- name = "static_deps_error_test",
438
- messages = select({
439
- ":is_bazel": [
440
- "@//:__subpackages__",
441
- "@test_repo//:__subpackages__",
442
- ],
443
- "//conditions:default": [
444
- "@//:__subpackages__",
445
- ],
446
- }),
447
- target_under_test = "//src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/failing_targets:unaccounted_for_libs_so",
485
+ no_exporting_static_lib_test(
486
+ name = "no_exporting_static_lib_test",
487
+ target_under_test = ":lib_with_no_exporting_roots",
448
488
)
0 commit comments