Skip to content

Commit 8fb0c0d

Browse files
Fatme HavaluovaFatme Havaluova
Fatme Havaluova
authored and
Fatme Havaluova
committed
Fixes #1027
1 parent 0b42cc9 commit 8fb0c0d

File tree

3 files changed

+23
-27
lines changed

3 files changed

+23
-27
lines changed

lib/definitions/plugins.d.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
interface IPluginsService {
22
add(plugin: string): IFuture<void>; // adds plugin by name, github url, local path and et.
33
remove(pluginName: string): IFuture<void>; // removes plugin only by name
4-
prepare(pluginData: IDependencyData): IFuture<void>;
4+
prepare(pluginData: IDependencyData, platform: string): IFuture<void>;
55
getAllInstalledPlugins(): IFuture<IPluginData[]>;
66
ensureAllDependenciesAreInstalled(): IFuture<void>;
77
afterPrepareAllPlugins(): IFuture<void>;

lib/services/plugins-service.ts

+21-25
Original file line numberDiff line numberDiff line change
@@ -149,41 +149,37 @@ export class PluginsService implements IPluginsService {
149149
}).future<void>()();
150150
}
151151

152-
public prepare(dependencyData: IDependencyData): IFuture<void> {
152+
public prepare(dependencyData: IDependencyData, platform: string): IFuture<void> {
153153
return (() => {
154+
platform = platform.toLowerCase();
155+
let platformData = this.$platformsData.getPlatformData(platform);
156+
let pluginDestinationPath = path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME, "tns_modules");
154157
let pluginData = this.convertToPluginData(dependencyData);
155158

156-
let action = (pluginDestinationPath: string, platform: string, platformData: IPlatformData) => {
157-
return (() => {
158-
if(!this.isPluginDataValidForPlatform(pluginData, platform).wait()) {
159-
return;
160-
}
161-
162-
if(this.$fs.exists(path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME)).wait()) {
163-
this.$fs.ensureDirectoryExists(pluginDestinationPath).wait();
164-
shelljs.cp("-Rf", pluginData.fullPath, pluginDestinationPath);
165-
166-
let pluginConfigurationFilePath = this.getPluginConfigurationFilePath(pluginData, platformData);
159+
if(!this.isPluginDataValidForPlatform(pluginData, platform).wait()) {
160+
return;
161+
}
167162

168-
if(this.$fs.exists(pluginConfigurationFilePath).wait()) {
169-
this.merge(pluginData, platformData).wait();
170-
}
163+
if(this.$fs.exists(path.join(platformData.appDestinationDirectoryPath, constants.APP_FOLDER_NAME)).wait()) {
164+
this.$fs.ensureDirectoryExists(pluginDestinationPath).wait();
165+
shelljs.cp("-Rf", pluginData.fullPath, pluginDestinationPath);
171166

172-
this.$projectFilesManager.processPlatformSpecificFiles(pluginDestinationPath, platform).wait();
167+
let pluginConfigurationFilePath = this.getPluginConfigurationFilePath(pluginData, platformData);
173168

174-
pluginData.pluginPlatformsFolderPath = (_platform: string) => path.join(pluginData.fullPath, "platforms", _platform);
175-
platformData.platformProjectService.preparePluginNativeCode(pluginData).wait();
169+
if(this.$fs.exists(pluginConfigurationFilePath).wait()) {
170+
this.merge(pluginData, platformData).wait();
171+
}
176172

177-
shelljs.rm("-rf", path.join(pluginDestinationPath, pluginData.name, "platforms"));
173+
this.$projectFilesManager.processPlatformSpecificFiles(pluginDestinationPath, platform).wait();
178174

179-
// Show message
180-
this.$logger.out(`Successfully prepared plugin ${pluginData.name} for ${platform}.`);
181-
}
175+
pluginData.pluginPlatformsFolderPath = (_platform: string) => path.join(pluginData.fullPath, "platforms", _platform);
176+
platformData.platformProjectService.preparePluginNativeCode(pluginData).wait();
182177

183-
}).future<void>()();
184-
};
178+
shelljs.rm("-rf", path.join(pluginDestinationPath, pluginData.name, "platforms"));
185179

186-
this.executeForAllInstalledPlatforms(action).wait();
180+
// Show message
181+
this.$logger.out(`Successfully prepared plugin ${pluginData.name} for ${platform}.`);
182+
}
187183
}).future<void>()();
188184
}
189185

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export class DestCopy implements IBroccoliPlugin {
7474

7575
let isPlugin = !!dependency.nativescript;
7676
if(isPlugin) {
77-
this.$pluginsService.prepare(dependency).wait();
77+
this.$pluginsService.prepare(dependency, platform).wait();
7878
}
7979

8080
if (dependency.name === constants.TNS_CORE_MODULES_NAME) {

0 commit comments

Comments
 (0)