From 353a18d27814e77ff02ce743b1ef14b9db7a6f85 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 19 Aug 2019 08:41:51 +0300 Subject: [PATCH 1/2] fix: add missing await for isDynamicFramework check There's a missing await in the check if an iOS Framework is dynamic. Linter rule (no-floating-promises) does not catch it, as it is not a pure call, i.e. linter will fail in case the code is: ``` this.isDynamicFramework(frameworkPath); ``` But it will not fail in case the method is called inside if statement (as it is in our code) or when you assing the value to a variable and do not await it anywhere: ``` const isDynamic = this.isDynamicFramework(frameworkPath); ``` --- lib/services/ios-project-service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index fd8e888719..c2f724a4c2 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -259,7 +259,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ const project = this.createPbxProj(projectData); const frameworkAddOptions: IXcode.Options = { customFramework: true }; - if (this.isDynamicFramework(frameworkPath)) { + if (await this.isDynamicFramework(frameworkPath)) { frameworkAddOptions["embed"] = true; } From 6d0d77f337e3bf77859c7179436b11f7fd8183d5 Mon Sep 17 00:00:00 2001 From: rosen-vladimirov Date: Mon, 19 Aug 2019 11:32:38 +0300 Subject: [PATCH 2/2] fix: check correctly .framework files The current check if `.framework` files are dynamically linked frameworks is not working as we pass only the framework name. This breaks all projects as tns-core-modules-widgets have `.framework`, CLI decides it is not dynamically linked and the application cannot run on device. Fix the check to pass the full path to the framework. --- lib/services/ios-project-service.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index c2f724a4c2..a7d93a4f5d 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -233,7 +233,9 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ const isDynamicFrameworkBundle = async (bundlePath: string) => { const frameworkBinaryPath = path.join(bundlePath, frameworkName); - return _.includes((await this.$childProcess.spawnFromEvent("file", [frameworkBinaryPath], "close")).stdout, "dynamically linked"); + const fileResult = (await this.$childProcess.spawnFromEvent("file", [frameworkBinaryPath], "close")).stdout; + const isDynamicallyLinked = _.includes(fileResult, "dynamically linked"); + return isDynamicallyLinked; }; if (path.extname(frameworkPath) === ".xcframework") { @@ -249,7 +251,7 @@ export class IOSProjectService extends projectServiceBaseLib.PlatformProjectServ return isDynamic; } else { - return await isDynamicFrameworkBundle(frameworkName); + return await isDynamicFrameworkBundle(frameworkPath); } }