Skip to content

Commit

Permalink
Allow pyd in extensions of dynamic libraries
Browse files Browse the repository at this point in the history
Long term fix should be to read the extensions from the toolchain.

RELNOTES:none
PiperOrigin-RevId: 499418087
Change-Id: I710285966cec5eff937c2fb7be728e5e93503cc7
  • Loading branch information
oquenchil authored and copybara-github committed Jan 4, 2023
1 parent 087cb8b commit 073f54b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,9 @@ public ImmutableList<String> getExtensions() {
// Minimized bitcode file emitted by the ThinLTO compile step and used just for LTO indexing.
public static final FileType LTO_INDEXING_OBJECT_FILE = FileType.of(".indexing.o");

public static final FileType SHARED_LIBRARY = FileType.of(".so", ".dylib", ".dll");
// TODO(bazel-team): File types should not be read from this hard-coded list but should come from
// the toolchain instead. See https://github.com/bazelbuild/bazel/issues/17117
public static final FileType SHARED_LIBRARY = FileType.of(".so", ".dylib", ".dll", ".pyd");
// Unix shared libraries can be passed to linker, but not .dll on Windows
public static final FileType UNIX_SHARED_LIBRARY = FileType.of(".so", ".dylib");
public static final FileType INTERFACE_SHARED_LIBRARY =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,13 @@ cc_binary(
deps = ["foo"],
)

cc_shared_library(
name = "python_module",
features = ["windows_export_all_symbols"],
roots = [":a_suffix"],
shared_lib_name = "python_module.pyd",
)

cc_shared_library(
name = "a_so",
features = ["windows_export_all_symbols"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5296,10 +5296,10 @@ public void testWrongExtensionThrowsError() throws Exception {
"'a.pic.o' does not have any of the allowed extensions .a, .lib, .pic.a or .rlib");
assertThat(e)
.hasMessageThat()
.contains("'a.ifso' does not have any of the allowed extensions .so, .dylib or .dll");
.contains("'a.ifso' does not have any of the allowed extensions .so, .dylib, .dll or .pyd");
assertThat(e)
.hasMessageThat()
.contains("'a.lib' does not have any of the allowed extensions .so, .dylib or .dll");
.contains("'a.lib' does not have any of the allowed extensions .so, .dylib, .dll or .pyd");
assertThat(e)
.hasMessageThat()
.contains(
Expand Down

0 comments on commit 073f54b

Please sign in to comment.