Skip to content

Commit c512bf6

Browse files
committed
Strip lib from xcframework and android library directories
1 parent 676682c commit c512bf6

File tree

4 files changed

+9
-15
lines changed

4 files changed

+9
-15
lines changed

packages/ferric-example/.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ Cargo.lock
55
/*.android.node/
66

77
# Generated files
8-
/libferric_example.d.ts
9-
/libferric_example.js
8+
/ferric_example.d.ts
9+
/ferric_example.js

packages/ferric-example/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "ferric-example",
33
"version": "0.1.0",
4-
"main": "libferric_example.js",
5-
"types": "libferric_example.d.ts",
4+
"main": "ferric_example.js",
5+
"types": "ferric_example.d.ts",
66
"scripts": {
77
"build": "ferric build --android --apple"
88
},

packages/react-native-node-api-modules/src/node/path-utils.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,8 @@ export function findNodeApiModulePathsByDependency({
313313
*/
314314
export function determineLibraryFilename(libraryPaths: string[]) {
315315
const libraryNames = libraryPaths.map((p) =>
316-
path.basename(p, path.extname(p))
316+
// Strip the "lib" prefix and any file extension
317+
path.basename(p, path.extname(p)).replace(/^lib/, "")
317318
);
318319
const candidates = new Set<string>(libraryNames);
319320
assert(candidates.size === 1, "Expected all libraries to have the same name");

packages/react-native-node-api-modules/src/node/prebuilds/apple.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import cp from "node:child_process";
66

77
import { spawn } from "bufout";
88

9-
import { AppleTriplet } from "react-native-node-api-modules";
9+
import { AppleTriplet } from "./triplets.js";
10+
import { determineLibraryFilename } from "../path-utils.js";
1011

1112
type AppleArchitecture = "arm64" | "x86_64" | "arm64;x86_64";
1213

@@ -122,15 +123,7 @@ export async function createXCframework({
122123
* Ensuring that all framework paths have the same base name.
123124
*/
124125
export function determineXCFrameworkFilename(frameworkPaths: string[]) {
125-
const frameworkNames = frameworkPaths.map((p) =>
126-
path.basename(p, path.extname(p))
127-
);
128-
const candidates = new Set<string>(frameworkNames);
129-
assert(
130-
candidates.size === 1,
131-
"Expected all frameworks to have the same name"
132-
);
133-
const [name] = candidates;
126+
const name = determineLibraryFilename(frameworkPaths);
134127
return `${name}.xcframework`;
135128
}
136129

0 commit comments

Comments
 (0)