File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
react-native-node-api-cmake/src
react-native-node-api-modules/src/node/cli Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -135,9 +135,16 @@ export async function createAndroidLibsDirectory({
135135 const arch = ANDROID_ARCHITECTURES [ triplet as AndroidTriplet ] ;
136136 const archOutputPath = path . join ( outputPath , arch ) ;
137137 await fs . promises . mkdir ( archOutputPath , { recursive : true } ) ;
138- const libraryName = path . basename ( libraryPath ) ;
139- const libraryOutputPath = path . join ( archOutputPath , libraryName ) ;
138+ // Strip the ".node" extension from the library name
139+ const libraryName = path . basename ( libraryPath , ".node" ) ;
140+ const soSuffixedName =
141+ path . extname ( libraryName ) === ".so" ? libraryName : `${ libraryName } .so` ;
142+ const finalLibraryName = libraryName . startsWith ( "lib" )
143+ ? soSuffixedName
144+ : `lib${ soSuffixedName } ` ;
145+ const libraryOutputPath = path . join ( archOutputPath , finalLibraryName ) ;
140146 await fs . promises . copyFile ( libraryPath , libraryOutputPath ) ;
147+ // TODO: Update the install path in the library file
141148 }
142149 if ( autoLink ) {
143150 // Write a file to mark the Android libs directory is a Node-API module
Original file line number Diff line number Diff line change 88 getLibraryName ,
99 logModulePaths ,
1010 NamingStrategy ,
11- PLATFORM_EXTENSIONS ,
1211 PlatformName ,
1312 prettyPath ,
1413} from "../path-utils" ;
@@ -152,6 +151,11 @@ export function getLinkedModuleOutputPath(
152151 naming : NamingStrategy
153152) : string {
154153 const libraryName = getLibraryName ( modulePath , naming ) ;
155- const extension = PLATFORM_EXTENSIONS [ platform ] ;
156- return path . join ( getAutolinkPath ( platform ) , `${ libraryName } ${ extension } ` ) ;
154+ if ( platform === "android" ) {
155+ return path . join ( getAutolinkPath ( platform ) , libraryName ) ;
156+ } else if ( platform === "apple" ) {
157+ return path . join ( getAutolinkPath ( platform ) , libraryName + ".xcframework" ) ;
158+ } else {
159+ throw new Error ( `Unsupported platform: ${ platform } ` ) ;
160+ }
157161}
You can’t perform that action at this time.
0 commit comments