@@ -61,50 +61,52 @@ export class PluginsService implements IPluginsService {
6161 public prepare ( pluginData : IPluginData ) : IFuture < void > {
6262 return ( ( ) => {
6363 let action = ( pluginDestinationPath : string , platform : string , platformData : IPlatformData ) => {
64- let skipExecution = false ;
6564 // Process .js files
6665 let installedFrameworkVersion = this . getInstalledFrameworkVersion ( platform ) . wait ( ) ;
6766 let pluginPlatformsData = pluginData . platformsData ;
6867 if ( pluginPlatformsData ) {
6968 let pluginVersion = ( < any > pluginPlatformsData ) [ platform ] ;
69+ if ( ! pluginVersion ) {
70+ this . $logger . warn ( `${ pluginData . name } is not supported for ${ platform } .` ) ;
71+ return ;
72+ }
73+
7074 if ( semver . gt ( pluginVersion , installedFrameworkVersion ) ) {
7175 this . $logger . warn ( `${ pluginData . name } ${ pluginVersion } for ${ platform } is not compatible with the currently installed framework version ${ installedFrameworkVersion } .` ) ;
72- skipExecution = true ;
76+ return ;
7377 }
7478 }
79+
80+ this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
81+ shelljs . cp ( "-R" , pluginData . fullPath , pluginDestinationPath ) ;
82+
83+ let pluginPlatformsFolderPath = path . join ( pluginDestinationPath , pluginData . name , "platforms" , platform ) ;
84+ let pluginConfigurationFilePath = path . join ( pluginPlatformsFolderPath , platformData . configurationFileName ) ;
85+ let configurationFilePath = platformData . configurationFilePath ;
7586
76- if ( ! skipExecution ) {
77- this . $fs . ensureDirectoryExists ( pluginDestinationPath ) . wait ( ) ;
78- shelljs . cp ( "-R" , pluginData . fullPath , pluginDestinationPath ) ;
79-
80- let pluginPlatformsFolderPath = path . join ( pluginDestinationPath , pluginData . name , "platforms" , platform ) ;
81- let pluginConfigurationFilePath = path . join ( pluginPlatformsFolderPath , platformData . configurationFileName ) ;
82- let configurationFilePath = platformData . configurationFilePath ;
83-
84- if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
85- // Validate plugin configuration file
86- let pluginConfigurationFileContent = this . $fs . readText ( pluginConfigurationFilePath ) . wait ( ) ;
87- this . validateXml ( pluginConfigurationFileContent , pluginConfigurationFilePath ) ;
88-
89- // Validate configuration file
90- let configurationFileContent = this . $fs . readText ( configurationFilePath ) . wait ( ) ;
91- this . validateXml ( configurationFileContent , configurationFilePath ) ;
92-
93- // Merge xml
94- let resultXml = this . mergeXml ( configurationFileContent , pluginConfigurationFileContent , platformData . mergeXmlConfig || [ ] ) . wait ( ) ;
95- this . validateXml ( resultXml ) ;
96- this . $fs . writeFile ( configurationFilePath , resultXml ) . wait ( ) ;
97- }
98-
99- if ( this . $fs . exists ( pluginPlatformsFolderPath ) . wait ( ) ) {
100- shelljs . rm ( "-rf" , pluginPlatformsFolderPath ) ;
101- }
87+ if ( this . $fs . exists ( pluginConfigurationFilePath ) . wait ( ) ) {
88+ // Validate plugin configuration file
89+ let pluginConfigurationFileContent = this . $fs . readText ( pluginConfigurationFilePath ) . wait ( ) ;
90+ this . validateXml ( pluginConfigurationFileContent , pluginConfigurationFilePath ) ;
10291
103- // TODO: Add libraries
92+ // Validate configuration file
93+ let configurationFileContent = this . $fs . readText ( configurationFilePath ) . wait ( ) ;
94+ this . validateXml ( configurationFileContent , configurationFilePath ) ;
10495
105- // Show message
106- this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
96+ // Merge xml
97+ let resultXml = this . mergeXml ( configurationFileContent , pluginConfigurationFileContent , platformData . mergeXmlConfig || [ ] ) . wait ( ) ;
98+ this . validateXml ( resultXml ) ;
99+ this . $fs . writeFile ( configurationFilePath , resultXml ) . wait ( ) ;
107100 }
101+
102+ if ( this . $fs . exists ( pluginPlatformsFolderPath ) . wait ( ) ) {
103+ shelljs . rm ( "-rf" , pluginPlatformsFolderPath ) ;
104+ }
105+
106+ // TODO: Add libraries
107+
108+ // Show message
109+ this . $logger . out ( `Successfully prepared plugin ${ pluginData . name } for ${ platform } .` ) ;
108110 } ;
109111
110112 this . executeForAllInstalledPlatforms ( action ) ;
0 commit comments