@@ -122,40 +122,37 @@ export class PluginsService implements IPluginsService {
122
122
} ) . future < void > ( ) ( ) ;
123
123
}
124
124
125
- public prepare ( dependencyData : IDependencyData ) : IFuture < void > {
125
+ public prepare ( dependencyData : IDependencyData , platform : string ) : IFuture < void > {
126
126
return ( ( ) => {
127
+ platform = platform . toLowerCase ( ) ;
128
+ let platformData = this . $platformsData . getPlatformData ( platform ) ;
129
+ let pluginDestinationPath = path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME , "tns_modules" ) ;
127
130
let pluginData = this . convertToPluginData ( dependencyData ) ;
128
131
129
- let action = ( pluginDestinationPath : string , platform : string , platformData : IPlatformData ) => {
130
- return ( ( ) => {
131
- if ( ! this . isPluginDataValidForPlatform ( pluginData , platform ) . wait ( ) ) {
132
- return ;
133
- }
132
+ if ( ! this . isPluginDataValidForPlatform ( pluginData , platform ) . wait ( ) ) {
133
+ return ;
134
+ }
134
135
135
- if ( this . $fs . exists ( path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ) . wait ( ) ) {
136
- this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
137
- shelljs . cp ( "-Rf" , pluginData . fullPath , pluginDestinationPath ) ;
136
+ if ( this . $fs . exists ( path . join ( platformData . appDestinationDirectoryPath , constants . APP_FOLDER_NAME ) ) . wait ( ) ) {
137
+ this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
138
+ shelljs . cp ( "-Rf" , pluginData . fullPath , pluginDestinationPath ) ;
138
139
139
- let pluginConfigurationFilePath = this . getPluginConfigurationFilePath ( pluginData , platformData ) ;
140
- if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
141
- this . merge ( pluginData , platformData ) . wait ( ) ;
142
- }
140
+ let pluginConfigurationFilePath = this . getPluginConfigurationFilePath ( pluginData , platformData ) ;
143
141
144
- this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
142
+ if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
143
+ this . merge ( pluginData , platformData ) . wait ( ) ;
144
+ }
145
145
146
- pluginData . pluginPlatformsFolderPath = ( _platform : string ) => path . join ( pluginData . fullPath , "platforms" , _platform ) ;
147
- platformData . platformProjectService . preparePluginNativeCode ( pluginData ) . wait ( ) ;
146
+ this . $projectFilesManager . processPlatformSpecificFiles ( pluginDestinationPath , platform ) . wait ( ) ;
148
147
149
- shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
148
+ pluginData . pluginPlatformsFolderPath = ( _platform : string ) => path . join ( pluginData . fullPath , "platforms" , _platform ) ;
149
+ platformData . platformProjectService . preparePluginNativeCode ( pluginData ) . wait ( ) ;
150
150
151
- // Show message
152
- this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
153
- }
151
+ shelljs . rm ( "-rf" , path . join ( pluginDestinationPath , pluginData . name , "platforms" ) ) ;
154
152
155
- } ) . future < void > ( ) ( ) ;
156
- } ;
157
-
158
- this . executeForAllInstalledPlatforms ( action ) . wait ( ) ;
153
+ // Show message
154
+ this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
155
+ }
159
156
} ) . future < void > ( ) ( ) ;
160
157
}
161
158
0 commit comments