-
-
Notifications
You must be signed in to change notification settings - Fork 197
Pass correct parameters to gradle build #856
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
✅ |
|
||
<% if(isHtml) { %> | ||
### Attributes | ||
* `<API Level>` is a valid Android API level. For example: 17, 19, MNC.<% if(isHtml) { %> For a complete list of the Android API levels and their corresponding Android versions, click [here](http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#platform).<% } %> |
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.
We would not support MNC, perhaps it is best to avoid mentioning it?
33da0ad
to
cf3f6f6
Compare
✅ |
let newTarget = this.$options.sdk ? `${AndroidProjectService.ANDROID_TARGET_PREFIX}-${this.$options.sdk}` : targetFromAndroidManifest ? `${AndroidProjectService.ANDROID_TARGET_PREFIX}-${targetFromAndroidManifest}`: this.getLatestValidAndroidTarget().wait(); | ||
this.$logger.trace(`TargetSDK from AndroidManifest is ${targetFromAndroidManifest}. Selected target is: ${newTarget}.`); | ||
if(!_.contains(this.SUPPORTED_TARGETS, newTarget)) { | ||
let versionNumber = parseInt(_.last(newTarget.split("-"))); |
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.
use parseAndroidSdkString method
cf3f6f6
to
c428bc0
Compare
✅ |
c428bc0
to
a67862d
Compare
✅ |
a67862d
to
6f0d343
Compare
✅ |
"use strict"; | ||
|
||
import path = require("path"); | ||
import semver = require("semver"); |
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.
ES6 Imports can be used here
ping @ikoevska for the messages |
6f0d343
to
308b3f3
Compare
✅ |
👍 |
if(additionalMsg) { | ||
this.$logger.info(additionalMsg); | ||
} | ||
} |
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.
Perhaps
if (this.showWarningsAsErrors) {
this.$errors.failWithoutHelp(msg);
} else {
this.$logger.warn(msg);
}
if(additionalMsg) {
this.$logger.info(additionalMsg);
}
or I am missing something?
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.
you are correct :)
308b3f3
to
8e886a5
Compare
|
||
private getAndroidHome(): string { | ||
let androidHomeEnvVar = process.env["ANDROID_HOME"]; | ||
if(!androidHomeEnvVar) { |
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.
Wouldn't this message be printed twice?
✅ |
/** | ||
* The Android targetSdkVersion specified by the user. | ||
* In case it is not specified, compileSdkVersion will be used for targetSdkVersion. | ||
*/ |
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.
Comments are totally awesome!
let minSupportedVersion = this.parseAndroidSdkString(_.first(supportedVersions)); | ||
let maxSupportedVersion = this.parseAndroidSdkString(_.last(supportedVersions)); | ||
if(targetSdk && (targetSdk < minSupportedVersion)) { | ||
this.printMessage(`The selected target SDK ${newTarget} is not supported. You should target at least ${minSupportedVersion}.`); |
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.
Shouldn't this be errors.failWithoutHelp
?
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.
In one case yes - in other - not :D
Check the description of the PR
8e886a5
to
671802d
Compare
✅ |
private $logger: ILogger, | ||
private $options: IOptions) {} | ||
|
||
public getToolsInfo(options?: {showWarningsAsErrors: boolean}): IFuture<IAndroidToolsInfoData> { |
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.
no need of showWarningsAsErrors
, I'll remove it
👍 for the code |
if(targetSdk && (targetSdk < minSupportedVersion)) { | ||
this.printMessage(`The selected target SDK ${newTarget} is not supported. You should target at least ${minSupportedVersion}.`); | ||
} else if(!targetSdk || targetSdk > this.getMaxSupportedVersion()) { | ||
this.$logger.warn(`The selected Android target '${newTarget}' is not verified as supported. Some functionality may not work as expected.`); |
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.
Support for the selected Android target SDK ${newTarget} is not verified. Your Android app might not work as expected.
We should pass correct parameters to android build. We need: * Compile SDK - at least 21 * BuildTools version - at least 22 * AppCompat lib (Android Support) version - same as compile SDK * Target SDK - the selected target by user - there's no need to have it Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When `tns doctor` command is called, the checks will print warnings and when `tns platform add android` or `tns build/prepare... android` commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected. Fixes #840
671802d
to
23bdee0
Compare
✅ |
…param Pass correct parameters to gradle build
Pass correct parameters to gradle build
We should pass correct parameters to android build. We need:
Add AndroidToolsInfo class that calculates all required and installed versions of required Android tools. This class prints warnings when the public method getToolsInfo is called without parameters and prints errors when the showWarningsAsErrors parameter is set to true. When
tns doctor
command is called, the checks will print warnings and whentns platform add android
ortns build/prepare... android
commands are used, the AndroidToolsInfo will break the execution when incorrect Android setup is detected.Fixes #840