Skip to content

Commit ce3a823

Browse files
committed
refactor: update after review
1 parent 4a9c49d commit ce3a823

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

lib/services/android-project-service.ts

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,22 +106,21 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject
106106
}
107107

108108
private getDeviceBuildOutputPath(currentPath: string, projectData: IProjectData): string {
109-
const currentPlatformData: IDictionary<any> = this.$projectDataService.getNSValue(projectData.projectDir, constants.TNS_ANDROID_RUNTIME_NAME);
110-
const platformVersion = currentPlatformData && currentPlatformData[constants.VERSION_STRING];
111-
112-
if (!platformVersion ||
113-
platformVersion === constants.PackageVersion.NEXT ||
114-
platformVersion === constants.PackageVersion.LATEST) {
115-
return currentPath;
109+
const currentPlatformData: IDictionary<any> = this.$projectDataService.getNSValue(projectData.projectDir, constants.TNS_ANDROID_RUNTIME_NAME),
110+
platformVersion = currentPlatformData && currentPlatformData[constants.VERSION_STRING],
111+
normalizedPath = path.join(currentPath, "debug");
112+
113+
if (semver.valid(platformVersion)) {
114+
const gradleAndroidPluginVersion3xx = "4.0.0";
115+
const normalizedPlatformVersion = `${semver.major(platformVersion)}.${semver.minor(platformVersion)}.0`;
116+
if (semver.gte(normalizedPlatformVersion, gradleAndroidPluginVersion3xx)) {
117+
return normalizedPath;
118+
} else {
119+
return currentPath;
120+
}
116121
}
117122

118-
const gradleAndroidPluginVersion3xx = "4.0.0";
119-
const normalizedPlatformVersion = `${semver.major(platformVersion)}.${semver.minor(platformVersion)}.0`;
120-
121-
if (semver.gte(normalizedPlatformVersion, gradleAndroidPluginVersion3xx)) {
122-
return path.join(currentPath, "debug");
123-
}
124-
return currentPath;
123+
return normalizedPath;
125124
}
126125

127126
// TODO: Remove prior to the 4.0 CLI release @Pip3r4o @PanayotCankov

0 commit comments

Comments
 (0)