Skip to content

Commit 073f54b

Browse files
oquenchilcopybara-github
authored andcommitted
Allow pyd in extensions of dynamic libraries
Long term fix should be to read the extensions from the toolchain. RELNOTES:none PiperOrigin-RevId: 499418087 Change-Id: I710285966cec5eff937c2fb7be728e5e93503cc7
1 parent 087cb8b commit 073f54b

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

src/main/java/com/google/devtools/build/lib/rules/cpp/CppFileTypes.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,9 @@ public ImmutableList<String> getExtensions() {
204204
// Minimized bitcode file emitted by the ThinLTO compile step and used just for LTO indexing.
205205
public static final FileType LTO_INDEXING_OBJECT_FILE = FileType.of(".indexing.o");
206206

207-
public static final FileType SHARED_LIBRARY = FileType.of(".so", ".dylib", ".dll");
207+
// TODO(bazel-team): File types should not be read from this hard-coded list but should come from
208+
// the toolchain instead. See https://github.com/bazelbuild/bazel/issues/17117
209+
public static final FileType SHARED_LIBRARY = FileType.of(".so", ".dylib", ".dll", ".pyd");
208210
// Unix shared libraries can be passed to linker, but not .dll on Windows
209211
public static final FileType UNIX_SHARED_LIBRARY = FileType.of(".so", ".dylib");
210212
public static final FileType INTERFACE_SHARED_LIBRARY =

src/main/starlark/tests/builtins_bzl/cc/cc_shared_library/test_cc_shared_library/BUILD.builtin_test

+7
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,13 @@ cc_binary(
4949
deps = ["foo"],
5050
)
5151

52+
cc_shared_library(
53+
name = "python_module",
54+
features = ["windows_export_all_symbols"],
55+
roots = [":a_suffix"],
56+
shared_lib_name = "python_module.pyd",
57+
)
58+
5259
cc_shared_library(
5360
name = "a_so",
5461
features = ["windows_export_all_symbols"],

src/test/java/com/google/devtools/build/lib/rules/cpp/StarlarkCcCommonTest.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -5296,10 +5296,10 @@ public void testWrongExtensionThrowsError() throws Exception {
52965296
"'a.pic.o' does not have any of the allowed extensions .a, .lib, .pic.a or .rlib");
52975297
assertThat(e)
52985298
.hasMessageThat()
5299-
.contains("'a.ifso' does not have any of the allowed extensions .so, .dylib or .dll");
5299+
.contains("'a.ifso' does not have any of the allowed extensions .so, .dylib, .dll or .pyd");
53005300
assertThat(e)
53015301
.hasMessageThat()
5302-
.contains("'a.lib' does not have any of the allowed extensions .so, .dylib or .dll");
5302+
.contains("'a.lib' does not have any of the allowed extensions .so, .dylib, .dll or .pyd");
53035303
assertThat(e)
53045304
.hasMessageThat()
53055305
.contains(

0 commit comments

Comments
 (0)