-
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
Fix: Cordova requirements consider the android-targetSdkVersion #849
Conversation
I won’t be able to review this until I get back Sunday. I do not have my computer available to easy review and test. One thing to note, the value can also be passed in via Command Line argument. There is also a possibility they set the |
The original code did look at a
I was not aware of this, and if this is the case, I'm fairly confident current master wouldn't work either as the original code never accepted any parameters nor looked at command line args. But if this is the case, I think it's probably best to address this in this PR as well and I'll add commits accordingly. |
I misunderstood originally. The documentation for gradle.properties is missing for target sdk? Does this mean you can still change the target sdk via this method? I also don't see any documentation on command line usage other than the |
Can this be included in the next release? Our users are having problems because of this issue (freescout-help-desk/freescout#362) |
There is a couple of things I still need to check actually regarding command line usage, that @erisu pointed out that I haven't found the time to get to yet. I can't really give a timeline when I will be able to take a look. With that being said, it may take awhile before PR lands in master, then it may take some time before it is actually released in NPM. But if things are urgent, you can fork |
I see in your comment listing bunch of tests using But when I run that command, it still expects (and installs sdk 28 if missing) even if the target sdk requested is not 28. Looks like I'll have to add that command line check somehow into the |
I just re-ran the test case and I get the same results.... Can you provide your steps? My Steps
Additional notes: I tested with the I guess we talking about the display of |
It's because you have So in my environment, the only API I have installed is android 29. If I override the cordova default and specify 29 for target sdk, cordova shouldn't require me to have android-28, nor should it install 28 automatically for me because having Currently, this is what it does:
This PR addresses this problem when specifying the target sdk from Simply passing the arguments down to |
Added comments. Added JSDoc block Reduced error exit point to one spot
6eb1fc2
to
8db57c5
Compare
303ee5d
to
be8ce35
Compare
be8ce35
to
cfc40e4
Compare
Platforms affected
Android
Motivation and Context
This PR fixes
cordova requirements android
to consider the desired target SDK as defined by theandroid-targetSdkVersion
preference in the project'sconfig.xml
.Fixes #846
Currently, while
cordova-android
can use a higher target... it fails thecordova requirements android
check if the hard-coded defined target is not installed on the system.Description
I've changed
check_reqs.js
get_target
to do the following:cordova-android
config.xml
exists in the repo.android-targetSdkVersion
preference.config.xml
, then fall back to default.Naturally, if
get_target
returns 29, then the user must have the android 29 SDK installed, otherwisecheck_android_target
will fail, as expected.Unit tests were added to thoroughly test
get_target
.Testing
Ran
npm test
, with newly added unit tests.Also tested the code in a real project and manually observing the results of
cordova requirements android
.Checklist
(platform)
if this change only applies to one platform (e.g.(android)
)