Skip to content

Commit 6bc6ca9

Browse files
authored
fix: get framework name from Info.plist (#5759)
1 parent ecf1959 commit 6bc6ca9

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

lib/services/ios-project-service.ts

+19-17
Original file line numberDiff line numberDiff line change
@@ -467,11 +467,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
467467
}
468468

469469
private async isDynamicFramework(frameworkPath: string): Promise<boolean> {
470-
const frameworkName = path.basename(
471-
frameworkPath,
472-
path.extname(frameworkPath)
473-
);
474-
const isDynamicFrameworkBundle = async (bundlePath: string) => {
470+
471+
const isDynamicFrameworkBundle = async (bundlePath: string, frameworkName: string) => {
475472
const frameworkBinaryPath = path.join(bundlePath, frameworkName);
476473

477474
const fileResult = (
@@ -487,25 +484,29 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
487484

488485
if (path.extname(frameworkPath) === ".xcframework") {
489486
let isDynamic = true;
490-
const subDirs = this.$fs
491-
.readDirectory(frameworkPath)
492-
.filter((entry) =>
493-
this.$fs.getFsStats(path.join(frameworkPath, entry)).isDirectory()
494-
);
495-
for (const subDir of subDirs) {
487+
const plistJson = this.$plistParser.parseFileSync(path.join(frameworkPath, 'Info.plist'));
488+
for (const library of plistJson.AvailableLibraries) {
496489
const singlePlatformFramework = path.join(
497-
subDir,
498-
frameworkName + ".framework"
490+
frameworkPath,
491+
library.LibraryIdentifier,
492+
library.LibraryPath
499493
);
500494
if (this.$fs.exists(singlePlatformFramework)) {
501-
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework);
495+
const frameworkName = path.basename(
496+
singlePlatformFramework,
497+
path.extname(singlePlatformFramework)
498+
);
499+
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework, frameworkName);
502500
break;
503501
}
504502
}
505-
506503
return isDynamic;
507504
} else {
508-
return await isDynamicFrameworkBundle(frameworkPath);
505+
const frameworkName = path.basename(
506+
frameworkPath,
507+
path.extname(frameworkPath)
508+
);
509+
return await isDynamicFrameworkBundle(frameworkPath, frameworkName);
509510
}
510511
}
511512

@@ -518,7 +519,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
518519

519520
const project = this.createPbxProj(projectData);
520521
const frameworkAddOptions: IXcode.Options = { customFramework: true };
521-
if (await this.isDynamicFramework(frameworkPath)) {
522+
const dynamic = await this.isDynamicFramework(frameworkPath);
523+
if (dynamic) {
522524
frameworkAddOptions["embed"] = true;
523525
frameworkAddOptions["sign"] = true;
524526
}

0 commit comments

Comments
 (0)