Skip to content

fix: get framework name from Info.plist #5759

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 19 additions & 17 deletions lib/services/ios-project-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,11 +467,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
}

private async isDynamicFramework(frameworkPath: string): Promise<boolean> {
const frameworkName = path.basename(
frameworkPath,
path.extname(frameworkPath)
);
const isDynamicFrameworkBundle = async (bundlePath: string) => {

const isDynamicFrameworkBundle = async (bundlePath: string, frameworkName: string) => {
const frameworkBinaryPath = path.join(bundlePath, frameworkName);

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

if (path.extname(frameworkPath) === ".xcframework") {
let isDynamic = true;
const subDirs = this.$fs
.readDirectory(frameworkPath)
.filter((entry) =>
this.$fs.getFsStats(path.join(frameworkPath, entry)).isDirectory()
);
for (const subDir of subDirs) {
const plistJson = this.$plistParser.parseFileSync(path.join(frameworkPath, 'Info.plist'));
for (const library of plistJson.AvailableLibraries) {
const singlePlatformFramework = path.join(
subDir,
frameworkName + ".framework"
frameworkPath,
library.LibraryIdentifier,
library.LibraryPath
);
if (this.$fs.exists(singlePlatformFramework)) {
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework);
const frameworkName = path.basename(
singlePlatformFramework,
path.extname(singlePlatformFramework)
);
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework, frameworkName);
break;
}
}

return isDynamic;
} else {
return await isDynamicFrameworkBundle(frameworkPath);
const frameworkName = path.basename(
frameworkPath,
path.extname(frameworkPath)
);
return await isDynamicFrameworkBundle(frameworkPath, frameworkName);
}
}

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

const project = this.createPbxProj(projectData);
const frameworkAddOptions: IXcode.Options = { customFramework: true };
if (await this.isDynamicFramework(frameworkPath)) {
const dynamic = await this.isDynamicFramework(frameworkPath);
if (dynamic) {
frameworkAddOptions["embed"] = true;
frameworkAddOptions["sign"] = true;
}
Expand Down