@@ -46,6 +46,20 @@ export class PlatformService extends EventEmitter implements IPlatformService {
46
46
super ( ) ;
47
47
}
48
48
49
+ public async cleanPlatforms ( platforms : string [ ] , platformTemplate : string , projectData : IProjectData , platformSpecificData : IPlatformSpecificData , framworkPath ?: string ) : Promise < void > {
50
+ for ( let platform of platforms ) {
51
+ let version : string = this . getCurrentPlatformVersion ( platform , projectData ) ;
52
+
53
+ let platformWithVersion : string = platform ;
54
+ if ( version !== undefined ) {
55
+ platformWithVersion += "@" + version ;
56
+ }
57
+
58
+ await this . removePlatforms ( [ platform ] , projectData ) ;
59
+ await this . addPlatforms ( [ platformWithVersion ] , platformTemplate , projectData , platformSpecificData ) ;
60
+ }
61
+ }
62
+
49
63
public async addPlatforms ( platforms : string [ ] , platformTemplate : string , projectData : IProjectData , platformSpecificData : IPlatformSpecificData , frameworkPath ?: string ) : Promise < void > {
50
64
let platformsDir = projectData . platformsDir ;
51
65
this . $fs . ensureDirectoryExists ( platformsDir ) ;
@@ -55,6 +69,17 @@ export class PlatformService extends EventEmitter implements IPlatformService {
55
69
}
56
70
}
57
71
72
+ private getCurrentPlatformVersion ( platform : string , projectData : IProjectData ) : string {
73
+ let platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
74
+ let currentPlatformData : any = this . $projectDataService . getNSValue ( projectData . projectDir , platformData . frameworkPackageName ) ;
75
+ let version : string ;
76
+ if ( currentPlatformData && currentPlatformData [ constants . VERSION_STRING ] ) {
77
+ version = currentPlatformData [ constants . VERSION_STRING ] ;
78
+ } ;
79
+
80
+ return version ;
81
+ }
82
+
58
83
private async addPlatform ( platformParam : string , platformTemplate : string , projectData : IProjectData , platformSpecificData : IPlatformSpecificData , frameworkPath ?: string ) : Promise < void > {
59
84
let data = platformParam . split ( "@" ) ,
60
85
platform = data [ 0 ] . toLowerCase ( ) ,
@@ -69,9 +94,9 @@ export class PlatformService extends EventEmitter implements IPlatformService {
69
94
}
70
95
71
96
let platformData = this . $platformsData . getPlatformData ( platform , projectData ) ;
72
- let currentPlatformData : any = this . $projectDataService . getNSValue ( projectData . projectDir , platformData . frameworkPackageName ) ;
73
- if ( currentPlatformData && currentPlatformData [ constants . VERSION_STRING ] ) {
74
- version = currentPlatformData [ constants . VERSION_STRING ] ;
97
+
98
+ if ( version === undefined ) {
99
+ version = this . getCurrentPlatformVersion ( platform , projectData ) ;
75
100
}
76
101
77
102
// Copy platform specific files in platforms dir
0 commit comments