Skip to content

Commit 527b4f0

Browse files
committed
fix: migrate android App_Resources on tns migrate
1 parent 5a74db5 commit 527b4f0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

lib/controllers/migrate-controller.ts

+15
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
1212
protected $platformsDataService: IPlatformsDataService,
1313
protected $packageInstallationManager: IPackageInstallationManager,
1414
protected $packageManager: IPackageManager,
15+
private $androidResourcesMigrationService: IAndroidResourcesMigrationService,
1516
private $devicePlatformsConstants: Mobile.IDevicePlatformsConstants,
1617
private $logger: ILogger,
1718
private $errors: IErrors,
@@ -103,6 +104,8 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
103104
this.$logger.trace(`Error during auto-generated files handling. ${(error && error.message) || error}`);
104105
}
105106

107+
await this.migrateOldAndroidAppResources(projectData);
108+
106109
try {
107110
await this.cleanUpProject(projectData);
108111
await this.migrateDependencies(projectData);
@@ -112,6 +115,14 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
112115
}
113116
}
114117

118+
private async migrateOldAndroidAppResources(projectData: IProjectData) {
119+
const appResourcesPath = projectData.getAppResourcesDirectoryPath();
120+
if (!this.$androidResourcesMigrationService.hasMigrated(appResourcesPath)) {
121+
this.$logger.info("Migrate old Android App_Resources structure.");
122+
await this.$androidResourcesMigrationService.migrate(appResourcesPath);
123+
}
124+
}
125+
115126
public async shouldMigrate({ projectDir }: IProjectDir): Promise<boolean> {
116127
const projectData = this.$projectDataService.getProjectData(projectDir);
117128

@@ -134,6 +145,10 @@ export class MigrateController extends UpdateControllerBase implements IMigrateC
134145
if (!hasDependency && dependency.shouldAddIfMissing) {
135146
return true;
136147
}
148+
149+
if (!this.$androidResourcesMigrationService.hasMigrated(projectData.getAppResourcesDirectoryPath())) {
150+
return true;
151+
}
137152
}
138153

139154
for (const platform in this.$devicePlatformsConstants) {

0 commit comments

Comments
 (0)