File tree Expand file tree Collapse file tree
SwiftJavaConfigurationShared Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -505,7 +505,7 @@ extension FFMSwift2JavaGenerator {
505505 func printClassConstants( printer: inout CodePrinter ) {
506506 printer. print (
507507 """
508- static final String LIB_NAME = " \( swiftModuleName) " ;
508+ static final String LIB_NAME = " \( config . nativeLibraryName ?? swiftModuleName) " ;
509509 static final Arena LIBRARY_ARENA = Arena.ofAuto();
510510 """
511511 )
Original file line number Diff line number Diff line change @@ -100,7 +100,7 @@ extension JNISwift2JavaGenerator {
100100 printModuleClass ( & printer) { printer in
101101 printer. print (
102102 """
103- static final String LIB_NAME = " \( swiftModuleName) " ;
103+ static final String LIB_NAME = " \( config . nativeLibraryName ?? swiftModuleName) " ;
104104
105105 static {
106106 System.loadLibrary(SwiftLibraries.LIB_NAME_SWIFT_JAVA);
@@ -189,7 +189,7 @@ extension JNISwift2JavaGenerator {
189189 printNominal ( & printer, decl) { printer in
190190 printer. print (
191191 """
192- static final String LIB_NAME = " \( swiftModuleName) " ;
192+ static final String LIB_NAME = " \( config . nativeLibraryName ?? swiftModuleName) " ;
193193
194194 @SuppressWarnings( " unused " )
195195 private static final boolean INITIALIZED_LIBS = initializeLibs();
Original file line number Diff line number Diff line change @@ -32,6 +32,12 @@ public struct Configuration: Codable {
3232
3333 public var swiftModule : String ?
3434
35+ /// The name of the native library to load at runtime via `System.loadLibrary()`.
36+ /// Defaults to the Swift module name when not set. Use this when the dynamic
37+ /// library product has a different name than the module being exported
38+ /// (e.g. the module is `MyLibrary` but the dylib is `MyLibrarySwiftJava` or something else).
39+ public var nativeLibraryName : String ?
40+
3541 public var inputSwiftDirectory : String ?
3642
3743 public var outputSwiftDirectory : String ?
You can’t perform that action at this time.
0 commit comments