Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ extension FFMSwift2JavaGenerator {
func printClassConstants(printer: inout CodePrinter) {
printer.print(
"""
static final String LIB_NAME = "\(swiftModuleName)";
static final String LIB_NAME = "\(config.nativeLibraryName ?? swiftModuleName)";
static final Arena LIBRARY_ARENA = Arena.ofAuto();
"""
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ extension JNISwift2JavaGenerator {
printModuleClass(&printer) { printer in
printer.print(
"""
static final String LIB_NAME = "\(swiftModuleName)";
static final String LIB_NAME = "\(config.nativeLibraryName ?? swiftModuleName)";

static {
System.loadLibrary(SwiftLibraries.LIB_NAME_SWIFT_JAVA);
Expand Down Expand Up @@ -189,7 +189,7 @@ extension JNISwift2JavaGenerator {
printNominal(&printer, decl) { printer in
printer.print(
"""
static final String LIB_NAME = "\(swiftModuleName)";
static final String LIB_NAME = "\(config.nativeLibraryName ?? swiftModuleName)";

@SuppressWarnings("unused")
private static final boolean INITIALIZED_LIBS = initializeLibs();
Expand Down
6 changes: 6 additions & 0 deletions Sources/SwiftJavaConfigurationShared/Configuration.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ public struct Configuration: Codable {

public var swiftModule: String?

/// The name of the native library to load at runtime via `System.loadLibrary()`.
/// Defaults to the Swift module name when not set. Use this when the dynamic
/// library product has a different name than the module being exported
/// (e.g. the module is `MyLibrary` but the dylib is `MyLibrarySwiftJava` or something else).
public var nativeLibraryName: String?

public var inputSwiftDirectory: String?

public var outputSwiftDirectory: String?
Expand Down
Loading