-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Improve Gradle Build Arguments #699
Conversation
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 looks pretty good to me, a few minor comments.
I think we should review what we do with compileSdkVersion
and how that interacts with targetSdkVersion
.
bin/templates/cordova/lib/build.js
Outdated
@@ -266,6 +270,8 @@ module.exports.help = function () { | |||
console.log(' \'--prepenv\': don\'t build, but copy in build scripts where necessary'); | |||
console.log(' \'--versionCode=#\': Override versionCode for this build. Useful for uploading multiple APKs.'); | |||
console.log(' \'--minSdkVersion=#\': Override minSdkVersion for this build. Useful for uploading multiple APKs.'); | |||
console.log(' \'--maxSdkVersion=#\': Override maxSdkVersion for this build. Useful for uploading multiple APKs.'); |
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.
Remove "Useful for uploading multiple APKs." from minSdkVersion
, maxSdkVersion
, andtargetSdkVersion
.
There's also probably no value in supporting maxSdkVersion
since they really really strongly discourage using it (your app will not be compatible with newer versions of Android)
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.
At best, we might only be able to add to the printout (Not Recommended)
.
We already supported the setting of the maxSdkVersion
property through config.xml
and in which sets it in AndroidManifest.xml
.
This PR moves the maxSdkVersion
definition into the Gradle's workflow and removes from AndroidManifest.xml
.
This does add a new command line option to exposes alternative ways for defining this value other than config.xml
. I thought it was a missed option because we supported min
and believe there was no harm to add.
If we want to remove maxSdkVersion
altogether, it then becomes a major
change. As for future planning, it would be best if I don't add the new command-line option then. We probably should just add warnings that the maxSdkVersion
setting will be deprecated in the next major.
Thoughts and Opinions?
ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget() | ||
//ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion | ||
} | ||
ext.cdvCompileSdkVersion = cdvCompileSdkVersion == null ? ( |
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.
compileSdkVersion
should probably default to targetSdkVersion
, unless it is explicitly set
Codecov Report
@@ Coverage Diff @@
## master #699 +/- ##
==========================================
- Coverage 64.38% 63.98% -0.41%
==========================================
Files 18 18
Lines 1828 1824 -4
==========================================
- Hits 1177 1167 -10
- Misses 651 657 +6
Continue to review full report at Codecov.
|
Test Case
|
@dpogue This should now be ready for a final review. |
For flexibility, `maxSdkVersion` is an available option to users but not recommended to set.
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 any problem.
All tests are green.
@drastik I'm pretty sure Google's now requiring that the compileSdkVersion is set to a minimum of 26 for submission to the Play Store, but the minSdkVersion should be able to point to any previous version of Android. |
Platforms affected
android
Motivation and Context
Description
<uses-sdk>
fromAndroidManifest.xml
(minSdkVersion
,maxSdkVersion
, andtargetSdkVersion
)AndroidManifest
setter and getters forminSdkVersion
,maxSdkVersion
, andtargetSdkVersion
compileSdkVersion
config.xml
<preference>
nameandroid-maxSdkVersion
(Updatesgradle.properties
)config.xml
<preference>
nameandroid-targetSdkVersion
(Updatesgradle.properties
)Testing
npm t
Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)