diff --git a/lib/services/ios-project-service.ts b/lib/services/ios-project-service.ts index 429f8bb263..081c78130e 100644 --- a/lib/services/ios-project-service.ts +++ b/lib/services/ios-project-service.ts @@ -188,7 +188,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase shell.cp("-R", libraryPath, fullTargetPath); let project = this.createPbxProj(); - let frameworkPath = path.relative("platforms/ios", path.join(targetPath, frameworkName + ".framework")); + let frameworkPath = this.getFrameworkRelativePath(libraryPath); project.addFramework(frameworkPath, { customFramework: true, embed: true }); project.updateBuildProperty("IPHONEOS_DEPLOYMENT_TARGET", "8.0"); this.savePbxProj(project).wait(); @@ -271,6 +271,13 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase return name.replace(/\\\"/g, "\""); } + private getFrameworkRelativePath(libraryPath: string): string { + let frameworkName = path.basename(libraryPath, path.extname(libraryPath)); + let targetPath = path.join("lib", this.platformData.normalizedPlatformName, frameworkName); + let frameworkPath = path.relative("platforms/ios", path.join(targetPath, frameworkName + ".framework")); + return frameworkPath; + } + private get pbxProjPath(): string { return path.join(this.platformData.projectRoot, this.$projectData.projectName + ".xcodeproj", "project.pbxproj"); } @@ -298,7 +305,11 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase let pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME); let project = this.createPbxProj(); - _.each(this.getAllDynamicFrameworksForPlugin(pluginData).wait(), fileName => project.removeFramework(path.join(pluginPlatformsFolderPath, fileName + ".framework"), { customFramework: true, embed: true })); + _.each(this.getAllDynamicFrameworksForPlugin(pluginData).wait(), fileName => { + let fullFrameworkPath = path.join(pluginPlatformsFolderPath, fileName); + let relativeFrameworkPath = this.getFrameworkRelativePath(fullFrameworkPath); + project.removeFramework(relativeFrameworkPath, { customFramework: true, embed: true }) + }); this.savePbxProj(project).wait(); }).future()(); diff --git a/lib/services/plugins-service.ts b/lib/services/plugins-service.ts index c622291a2a..c87af0d611 100644 --- a/lib/services/plugins-service.ts +++ b/lib/services/plugins-service.ts @@ -118,6 +118,8 @@ export class PluginsService implements IPluginsService { pluginData.pluginPlatformsFolderPath = (platform: string) => path.join(pluginData.fullPath, "platforms", platform); platformData.platformProjectService.preparePluginNativeCode(pluginData).wait(); + shelljs.rm("-rf", path.join(pluginDestinationPath, pluginData.name, "platforms")); + // Show message this.$logger.out(`Successfully prepared plugin ${pluginData.name} for ${platform}.`); diff --git a/lib/tools/broccoli/node-modules-dest-copy.ts b/lib/tools/broccoli/node-modules-dest-copy.ts index 9dc481aefa..7fd2ea8634 100644 --- a/lib/tools/broccoli/node-modules-dest-copy.ts +++ b/lib/tools/broccoli/node-modules-dest-copy.ts @@ -74,7 +74,6 @@ export class DestCopy implements IBroccoliPlugin { let isPlugin = !!dependency.nativescript; if(isPlugin) { this.$pluginsService.prepare(dependency).wait(); - shelljs.rm("-rf", path.join(this.outputRoot, dependency.name, "platforms")); } }); }