Skip to content

Commit d8e90a8

Browse files
authored
Filter CMake targets by target name when passed (#264)
1 parent b91415b commit d8e90a8

File tree

3 files changed

+16
-4
lines changed

3 files changed

+16
-4
lines changed

.changeset/cold-showers-arrive.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"cmake-rn": patch
3+
---
4+
5+
Filter CMake targets by target name when passed

packages/cmake-rn/src/platforms/android.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,10 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
121121
const { ANDROID_HOME } = process.env;
122122
return typeof ANDROID_HOME === "string" && fs.existsSync(ANDROID_HOME);
123123
},
124-
async postBuild({ outputPath, triplets }, { autoLink, configuration }) {
124+
async postBuild(
125+
{ outputPath, triplets },
126+
{ autoLink, configuration, target },
127+
) {
125128
const prebuilds: Record<
126129
string,
127130
{ triplet: Triplet; libraryPath: string }[]
@@ -135,7 +138,9 @@ export const platform: Platform<Triplet[], AndroidOpts> = {
135138
"2.0",
136139
);
137140
const sharedLibraries = targets.filter(
138-
(target) => target.type === "SHARED_LIBRARY",
141+
({ type, name }) =>
142+
type === "SHARED_LIBRARY" &&
143+
(target.length === 0 || target.includes(name)),
139144
);
140145
assert.equal(
141146
sharedLibraries.length,

packages/cmake-rn/src/platforms/apple.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ export const platform: Platform<Triplet[], AppleOpts> = {
133133
},
134134
async postBuild(
135135
{ outputPath, triplets },
136-
{ configuration, autoLink, xcframeworkExtension },
136+
{ configuration, autoLink, xcframeworkExtension, target },
137137
) {
138138
const prebuilds: Record<string, string[]> = {};
139139
for (const { buildPath } of triplets) {
@@ -144,7 +144,9 @@ export const platform: Platform<Triplet[], AppleOpts> = {
144144
"2.0",
145145
);
146146
const sharedLibraries = targets.filter(
147-
(target) => target.type === "SHARED_LIBRARY",
147+
({ type, name }) =>
148+
type === "SHARED_LIBRARY" &&
149+
(target.length === 0 || target.includes(name)),
148150
);
149151
assert.equal(
150152
sharedLibraries.length,

0 commit comments

Comments
 (0)