Skip to content

Commit 36b7d5d

Browse files
FatmeFatme
Fatme
authored and
Fatme
committed
Merge pull request #714 from NativeScript/fatme/remove-plugin-platforms-folder
Remove plugin platforms folder
2 parents 1a42e47 + 5e9a6ff commit 36b7d5d

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

lib/services/ios-project-service.ts

+13-2
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
188188
shell.cp("-R", libraryPath, fullTargetPath);
189189

190190
let project = this.createPbxProj();
191-
let frameworkPath = path.relative("platforms/ios", path.join(targetPath, frameworkName + ".framework"));
191+
let frameworkPath = this.getFrameworkRelativePath(libraryPath);
192192
project.addFramework(frameworkPath, { customFramework: true, embed: true });
193193
project.updateBuildProperty("IPHONEOS_DEPLOYMENT_TARGET", "8.0");
194194
this.savePbxProj(project).wait();
@@ -271,6 +271,13 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
271271
return name.replace(/\\\"/g, "\"");
272272
}
273273

274+
private getFrameworkRelativePath(libraryPath: string): string {
275+
let frameworkName = path.basename(libraryPath, path.extname(libraryPath));
276+
let targetPath = path.join("lib", this.platformData.normalizedPlatformName, frameworkName);
277+
let frameworkPath = path.relative("platforms/ios", path.join(targetPath, frameworkName + ".framework"));
278+
return frameworkPath;
279+
}
280+
274281
private get pbxProjPath(): string {
275282
return path.join(this.platformData.projectRoot, this.$projectData.projectName + ".xcodeproj", "project.pbxproj");
276283
}
@@ -298,7 +305,11 @@ class IOSProjectService extends projectServiceBaseLib.PlatformProjectServiceBase
298305
let pluginPlatformsFolderPath = pluginData.pluginPlatformsFolderPath(IOSProjectService.IOS_PLATFORM_NAME);
299306
let project = this.createPbxProj();
300307

301-
_.each(this.getAllDynamicFrameworksForPlugin(pluginData).wait(), fileName => project.removeFramework(path.join(pluginPlatformsFolderPath, fileName + ".framework"), { customFramework: true, embed: true }));
308+
_.each(this.getAllDynamicFrameworksForPlugin(pluginData).wait(), fileName => {
309+
let fullFrameworkPath = path.join(pluginPlatformsFolderPath, fileName);
310+
let relativeFrameworkPath = this.getFrameworkRelativePath(fullFrameworkPath);
311+
project.removeFramework(relativeFrameworkPath, { customFramework: true, embed: true })
312+
});
302313

303314
this.savePbxProj(project).wait();
304315
}).future<void>()();

lib/services/plugins-service.ts

+2
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ export class PluginsService implements IPluginsService {
118118
pluginData.pluginPlatformsFolderPath = (platform: string) => path.join(pluginData.fullPath, "platforms", platform);
119119
platformData.platformProjectService.preparePluginNativeCode(pluginData).wait();
120120

121+
shelljs.rm("-rf", path.join(pluginDestinationPath, pluginData.name, "platforms"));
122+
121123
// Show message
122124
this.$logger.out(`Successfully prepared plugin ${pluginData.name} for ${platform}.`);
123125

lib/tools/broccoli/node-modules-dest-copy.ts

-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ export class DestCopy implements IBroccoliPlugin {
7474
let isPlugin = !!dependency.nativescript;
7575
if(isPlugin) {
7676
this.$pluginsService.prepare(dependency).wait();
77-
shelljs.rm("-rf", path.join(this.outputRoot, dependency.name, "platforms"));
7877
}
7978
});
8079
}

0 commit comments

Comments
 (0)