-
-
Notifications
You must be signed in to change notification settings - Fork 197
refactor: add logic for finding apk name #3367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
456c2dd
to
4a9c49d
Compare
@@ -104,6 +105,24 @@ export class AndroidProjectService extends projectServiceBaseLib.PlatformProject | |||
return this._platformData; | |||
} | |||
|
|||
private getDeviceBuildOutputPath(currentPath: string, projectData: IProjectData): string { | |||
const currentPlatformData: IDictionary<any> = this.$projectDataService.getNSValue(projectData.projectDir, constants.TNS_ANDROID_RUNTIME_NAME), | |||
platformVersion = currentPlatformData && currentPlatformData[constants.VERSION_STRING], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer each const
be on a separate line here - this way each variable declaration is a separate statement and debugging is easier and overall it seams neater to me
if (semver.valid(platformVersion)) { | ||
const gradleAndroidPluginVersion3xx = "4.0.0"; | ||
const normalizedPlatformVersion = `${semver.major(platformVersion)}.${semver.minor(platformVersion)}.0`; | ||
if (semver.gte(normalizedPlatformVersion, gradleAndroidPluginVersion3xx)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic can be simplified to
if (semver.lt(normalizedPlatformVersion, gradleAndroidPluginVersion3xx)) {
return currentPath;
}
by inverting the logic you can skip the second return
statement and just reuse the one on line 123
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks all right to me, splendid work!
…-logic refactor: add logic for finding apk name
With the update of the android plugin for gradle to
3.0.1
there's a breaking change in the folder structure where the CLI searches for the application file:old search path:
<project_name>/platforms/android/app/build/outputs/apk/
new search path:
<project_name>/platforms/android/app/build/outputs/apk/debug/
Another change will also be introduced in the
tns-android@4.0.0
project template which will stop renaming the final application file:old default name:
<project-name>-<build-version>[-abi].apk
new default name:
app-<build-version>.apk
This PR handles both scenarios and is backward compatible.
related issue: NativeScript/android#950