Flip cc_library to Starlark version for Bazel 6.0
No downstream breakages detected caused by this change:
https://buildkite.com/bazel/bazel-at-head-plus-downstream/builds/2507#01815d6b-85a2-4db0-8554-3cdf1afe995e
RELNOTES:none
PiperOrigin-RevId: 454895663
Change-Id: I382619870a8b744ebadfd5fb9ddbe989b79b5491
diff --git a/src/main/starlark/builtins_bzl/common/exports.bzl b/src/main/starlark/builtins_bzl/common/exports.bzl
index 4265806..ec87f67 100755
--- a/src/main/starlark/builtins_bzl/common/exports.bzl
+++ b/src/main/starlark/builtins_bzl/common/exports.bzl
@@ -55,7 +55,7 @@
"+cc_shared_library_permissions": cc_shared_library_permissions,
"+cc_binary": cc_binary,
"+cc_test": cc_test,
- "-cc_library": cc_library,
+ "+cc_library": cc_library,
"+proto_lang_toolchain": proto_lang_toolchain,
}
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
index d9657b4..103add4 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcLibraryConfiguredTargetTest.java
@@ -497,7 +497,7 @@
assertThat(
artifactsToStrings(getOutputGroup(hello, CcLibrary.DYNAMIC_LIBRARY_OUTPUT_GROUP_NAME)))
- .containsExactly("bin hello/hello_9a9972c34e.dll", "bin hello/hello.if.lib");
+ .containsExactly("bin hello/hello_5e918d2.dll", "bin hello/hello.if.lib");
}
@Test
diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java
index 130edb8..c6f04fb 100755
--- a/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java
@@ -1365,7 +1365,7 @@
ImmutableList.of("a.pic.a", "b.rlib", "c.pic.a", "e.pic.a"),
// The suffix of dynamic library is caculated based on repository name and package path
// to avoid conflicts with dynamic library from other packages.
- ImmutableList.of("a.so", "libdep2_c092dd9ce2.so", "b.so", "e.so", "libdep1_c092dd9ce2.so"));
+ ImmutableList.of("a.so", "libdep2_61.so", "b.so", "e.so", "libdep1_61.so"));
}
@Test
diff --git a/src/test/py/bazel/bazel_windows_cpp_test.py b/src/test/py/bazel/bazel_windows_cpp_test.py
index 95f1280..3020017 100644
--- a/src/test/py/bazel/bazel_windows_cpp_test.py
+++ b/src/test/py/bazel/bazel_windows_cpp_test.py
@@ -141,7 +141,7 @@
# TODO(pcloudy): change suffixes to .lib and .dll after making DLL
# extensions correct on Windows.
import_library = os.path.join(bazel_bin, 'A.if.lib')
- shared_library = os.path.join(bazel_bin, 'A_6f2d5ec56a.dll')
+ shared_library = os.path.join(bazel_bin, 'A_0.dll')
empty_def_file = os.path.join(bazel_bin, 'A.gen.empty.def')
self.assertTrue(os.path.exists(import_library))
@@ -162,7 +162,7 @@
# TODO(pcloudy): change suffixes to .lib and .dll after making DLL
# extensions correct on Windows.
import_library = os.path.join(bazel_bin, 'B.if.lib')
- shared_library = os.path.join(bazel_bin, 'B_6f2d5ec56a.dll')
+ shared_library = os.path.join(bazel_bin, 'B_0.dll')
def_file = os.path.join(bazel_bin, 'B.gen.def')
self.assertTrue(os.path.exists(import_library))
self.assertTrue(os.path.exists(shared_library))
@@ -177,7 +177,7 @@
])
self.AssertExitCode(exit_code, 0, stderr)
import_library = os.path.join(bazel_bin, 'B.if.lib')
- shared_library = os.path.join(bazel_bin, 'B_6f2d5ec56a.dll')
+ shared_library = os.path.join(bazel_bin, 'B_0.dll')
empty_def_file = os.path.join(bazel_bin, 'B.gen.empty.def')
self.assertTrue(os.path.exists(import_library))
self.assertTrue(os.path.exists(shared_library))
@@ -200,13 +200,13 @@
# a_import_library
self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A.if.lib')))
# a_shared_library
- self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_6f2d5ec56a.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_0.dll')))
# a_def_file
self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A.gen.empty.def')))
# b_import_library
self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'B.if.lib')))
# b_shared_library
- self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'B_6f2d5ec56a.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'B_0.dll')))
# b_def_file
self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'B.gen.def')))
# c_exe
@@ -230,10 +230,8 @@
# Test if A.dll and B.dll are copied to the directory of main.exe
main_bin = os.path.join(bazel_bin, 'main/main.exe')
self.assertTrue(os.path.exists(main_bin))
- self.assertTrue(
- os.path.exists(os.path.join(bazel_bin, 'main/A_6f2d5ec56a.dll')))
- self.assertTrue(
- os.path.exists(os.path.join(bazel_bin, 'main/B_6f2d5ec56a.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'main/A_0.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'main/B_0.dll')))
# Run the binary to see if it runs successfully
exit_code, stdout, stderr = self.RunProgram([main_bin])
@@ -374,7 +372,7 @@
# Test if A.dll is copied to the directory of main.exe
main_bin = os.path.join(bazel_bin, 'main.exe')
self.assertTrue(os.path.exists(main_bin))
- self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_128f2c79c3.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'A_9324b6d0.dll')))
# Run the binary to see if it runs successfully
exit_code, stdout, stderr = self.RunProgram([main_bin])
@@ -388,8 +386,8 @@
# By default, it should link to msvcrt dynamically.
exit_code, _, stderr = self.RunBazel(
['build', '//:A', '--output_groups=dynamic_library', '-s'])
- paramfile = os.path.join(
- bazel_output, 'x64_windows-fastbuild/bin/A_6f2d5ec56a.dll-2.params')
+ paramfile = os.path.join(bazel_output,
+ 'x64_windows-fastbuild/bin/A_0.dll-2.params')
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('/MD', ''.join(stderr))
self.AssertFileContentContains(paramfile, '/DEFAULTLIB:msvcrt.lib')
@@ -400,7 +398,7 @@
exit_code, _, stderr = self.RunBazel(
['build', '-c', 'dbg', '//:A', '--output_groups=dynamic_library', '-s'])
paramfile = os.path.join(bazel_output,
- 'x64_windows-dbg/bin/A_6f2d5ec56a.dll-2.params')
+ 'x64_windows-dbg/bin/A_0.dll-2.params')
self.AssertExitCode(exit_code, 0, stderr)
self.assertIn('/MDd', ''.join(stderr))
self.AssertFileContentContains(paramfile, '/DEFAULTLIB:msvcrtd.lib')
@@ -416,8 +414,8 @@
'build', '//:A', '--output_groups=dynamic_library',
'--features=static_link_msvcrt', '-s'
])
- paramfile = os.path.join(
- bazel_output, 'x64_windows-fastbuild/bin/A_6f2d5ec56a.dll-2.params')
+ paramfile = os.path.join(bazel_output,
+ 'x64_windows-fastbuild/bin/A_0.dll-2.params')
self.AssertExitCode(exit_code, 0, stderr)
self.assertNotIn('/MD', ''.join(stderr))
self.AssertFileContentNotContains(paramfile, '/DEFAULTLIB:msvcrt.lib')
@@ -430,7 +428,7 @@
'--features=static_link_msvcrt', '-s'
])
paramfile = os.path.join(bazel_output,
- 'x64_windows-dbg/bin/A_6f2d5ec56a.dll-2.params')
+ 'x64_windows-dbg/bin/A_0.dll-2.params')
self.AssertExitCode(exit_code, 0, stderr)
self.assertNotIn('/MDd', ''.join(stderr))
self.AssertFileContentNotContains(paramfile, '/DEFAULTLIB:msvcrtd.lib')
@@ -509,10 +507,8 @@
self.assertTrue(os.path.exists(def_file))
# A.dll and B.dll should be built and copied because they belong to
# runtime_dynamic_libraries output group.
- self.assertTrue(
- os.path.exists(os.path.join(bazel_bin, 'main/A_6f2d5ec56a.dll')))
- self.assertTrue(
- os.path.exists(os.path.join(bazel_bin, 'main/B_6f2d5ec56a.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'main/A_0.dll')))
+ self.assertTrue(os.path.exists(os.path.join(bazel_bin, 'main/B_0.dll')))
# hello_A and hello_B should not be exported.
self.AssertFileContentNotContains(def_file, 'hello_A')
self.AssertFileContentNotContains(def_file, 'hello_B')
diff --git a/src/test/shell/bazel/bazel_windows_example_test.sh b/src/test/shell/bazel/bazel_windows_example_test.sh
index e504ab7..8942318 100755
--- a/src/test/shell/bazel/bazel_windows_example_test.sh
+++ b/src/test/shell/bazel/bazel_windows_example_test.sh
@@ -119,7 +119,7 @@
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
--compiler=msys-gcc
assert_build_output \
- ./bazel-bin/${cpp_pkg}/libhello-lib_922c518841.so ${cpp_pkg}:hello-lib\
+ ./bazel-bin/${cpp_pkg}/libhello-lib_fbaaaedd.so ${cpp_pkg}:hello-lib\
--compiler=msys-gcc --output_groups=dynamic_library
assert_build ${cpp_pkg}:hello-world --compiler=msys-gcc
./bazel-bin/${cpp_pkg}/hello-world foo >& $TEST_log \
@@ -138,7 +138,7 @@
./bazel-bin/${cpp_pkg}/libhello-lib.a ${cpp_pkg}:hello-world \
--compiler=mingw-gcc --experimental_strict_action_env
assert_build_output \
- ./bazel-bin/${cpp_pkg}/libhello-lib_922c518841.so ${cpp_pkg}:hello-lib\
+ ./bazel-bin/${cpp_pkg}/libhello-lib_fbaaaedd.so ${cpp_pkg}:hello-lib\
--compiler=mingw-gcc --output_groups=dynamic_library \
--experimental_strict_action_env
assert_build ${cpp_pkg}:hello-world --compiler=mingw-gcc \