Skip to content

Commit 8650894

Browse files
authored
fix(ios): correctly link non dynamic frameworks
Right now all frameworks were embedded and sign even though it should only happen with dynamic framework The code was there but the test was non working and thus all frameworks were embedded and signed. This is a better PR than NativeScript#5743 where we were supposing the framework name was the name of xcframework file. Now we use the info.plist
1 parent eb91801 commit 8650894

File tree

1 file changed

+17
-16
lines changed

1 file changed

+17
-16
lines changed

lib/services/ios-project-service.ts

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -468,11 +468,8 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
468468
}
469469

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

478475
const fileResult = (
@@ -488,25 +485,29 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ
488485

489486
if (path.extname(frameworkPath) === ".xcframework") {
490487
let isDynamic = true;
491-
const subDirs = this.$fs
492-
.readDirectory(frameworkPath)
493-
.filter((entry) =>
494-
this.$fs.getFsStats(path.join(frameworkPath, entry)).isDirectory()
495-
);
496-
for (const subDir of subDirs) {
488+
const plistJson = this.$plistParser.parseFileSync(path.join(frameworkPath, 'Info.plist'));
489+
for (const library of plistJson.AvailableLibraries) {
497490
const singlePlatformFramework = path.join(
498-
subDir,
499-
frameworkName + ".framework"
491+
frameworkPath,
492+
library.LibraryIdentifier,
493+
library.LibraryPath
500494
);
501495
if (this.$fs.exists(singlePlatformFramework)) {
502-
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework);
496+
const frameworkName = path.basename(
497+
singlePlatformFramework,
498+
path.extname(singlePlatformFramework)
499+
);
500+
isDynamic = await isDynamicFrameworkBundle(singlePlatformFramework, frameworkName);
503501
break;
504502
}
505503
}
506-
507504
return isDynamic;
508505
} else {
509-
return await isDynamicFrameworkBundle(frameworkPath);
506+
const frameworkName = path.basename(
507+
frameworkPath,
508+
path.extname(frameworkPath)
509+
);
510+
return await isDynamicFrameworkBundle(frameworkPath, frameworkName);
510511
}
511512
}
512513

0 commit comments

Comments
 (0)