@@ -149,41 +149,37 @@ export class PluginsService implements IPluginsService {
149
149
} ) . future < void > ( ) ( ) ;
150
150
}
151
151
152
- public prepare ( dependencyData : IDependencyData ) : IFuture < void > {
152
+ public prepare ( dependencyData : IDependencyData , platform : string ) : IFuture < void > {
153
153
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" ) ;
154
157
let pluginData = this . convertToPluginData ( dependencyData ) ;
155
158
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
+ }
167
162
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 ) ;
171
166
172
- this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
167
+ let pluginConfigurationFilePath = this . getPluginConfigurationFilePath ( pluginData , platformData ) ;
173
168
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
+ }
176
172
177
- shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
173
+ this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
178
174
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 ( ) ;
182
177
183
- } ) . future < void > ( ) ( ) ;
184
- } ;
178
+ shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
185
179
186
- this . executeForAllInstalledPlatforms ( action ) . wait ( ) ;
180
+ // Show message
181
+ this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
182
+ }
187
183
} ) . future < void > ( ) ( ) ;
188
184
}
189
185
0 commit comments