-
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
Updated CLI scripts to support Android SDK Tools 25.3.1 #369
Conversation
Codecov Report
@@ Coverage Diff @@
## master #369 +/- ##
==========================================
+ Coverage 35.58% 43.42% +7.84%
==========================================
Files 12 14 +2
Lines 1037 1347 +310
Branches 173 247 +74
==========================================
+ Hits 369 585 +216
- Misses 668 762 +94
Continue to review full report at Codecov.
|
Linux with Android SDK 25.2.2✅ npm test Linux with Android SDK 25.3.1✅ npm test
✅ ./bin/create
✅ ./cordova/build It looks like the two failures are due to not having the For the record, my PATH contains |
@dpogue thanks for checking! So I think The other commands that are part of We could tweak the behaviour of The deeper question that rises out of this is: is Let me know what y'all think. |
Oh yes, and ping @alsorokin - not sure if the changes to the android CLI scripts affect the CI in any way? But in any case, probably worth getting your eyes on this change too :) |
I'll create a test job that uses this code when our slaves are back up (some Microsoft infra permutations are underway ATM). |
I have the same results as @dpogue. Tested macOS Sierra with Android SDK 25.3.1 and Windows 10 with Android SDK 25.3.1. For
Not sure how to downgrade (possible?) if not I would have tested that. |
@shazron I think that's expected and will happen if you also try it with the I can update it, though, to use |
@filmaj as usual, perhaps we need to keep it around, and set a deprecation period of three releases (we had a discussion in dev@) then remove. Thats assuming it was documented, if not, it's all up for grabs to remove |
I've posted a DISCUSS for removal of the Any opposition to me merging it in? I am hesitant to do so without an explicit +1 from some other committers. |
The |
LGTM! |
useful, which happens in Android SDK Tools 25.3.1. explicitly set the CWD of the spawned emulator process to workaround a recent google android sdk bug. rename android_sdk_version.js to android_sdk.js, to better reflect its contents. have create.js copy over the android_sdk_version batch file.
… set from location of either of `adb`, `android` or `avdmanager` commands. slightly rework logic of infering ANDROID_HOME + setting up PATH to hopefully separate the logic into clearer sections. check_reqs.check_android now validates SDK Tools 25.3.1 binaries/structure. added specs for check_reqs.check_android. move android sdk version script. expose some helper functions as module methods to help with mocking.
…lly try to invoke `avdmanager` to list out AVD images. tweak relevant test to match behaviour. small tweak to use exposed methods for checking platform (for easier future stubbing).
…k android sdk module to work with new sdk.
…or sdk targets. refactored target listing.
…st recent version of android sdk target installed.
…es as directory structure differs. big ol TODO dropped as it _is_ kinda weird.
Rebased on latest master, will wait for appveyor to pass before merging. |
Platforms affected
Android
What does this PR do?
Adds support for using the Android SDK Tools version 25.3.1.
Relevant issues are CB-12546 and CB-12554.
In general, the CLI scripts will now attempt to use the old tools first (specifically the
android
command), and if that command fails with a specific exit code and message (tested on Windows 10 and Mac OS 10.12), it will then try to use the new tools (specifically theavdmanager
andsdkmanager
commands).I have also renamed a bunch of methods in an attempt to try to make it clearer what they are doing.
I have added a bunch of jasmine unit tests to all of this as well. Hoping the coverage report reflects that!
What testing has been done on this change?
I tested on two OSes: Mac OS 10.12 and Windows 10. For each OS, I tested four environment setups:
ANDROID_HOME
environment variable to point to a new installation of the Android SDK.PATH
environment variable to contain thetools
,tools/bin
andplatform-tools
Android SDK subdirectories.For each environment, I then ran the following test scenarios:
npm test
from the repo. In all eight environments, this passed.bin/check_reqs
from the repo. If neither environment variables are set, you would receive an error telling you to setANDROID_HOME
. In the other 6 cases,check_reqs
tells you you are all good.bin/android_sdk_version
from the repo. In the four environments I tested where you didn't have theandroid
command on yourPATH
, you would get a "android
cannot be found" error. In the other four, it would return the id of the latest android target you have installed on your system.bin/create
from the repo. This passed in all eight environments.cordova/android_sdk_version
: same behaviour as test scenario 3 above (as expected).cordova/check_reqs
: same behaviour as test scenario 2 above (as expected).cordova/build
: it would error out if you didn't have yourANDROID_HOME
set and tell you to set it. Otherwise, passed fine.cordova/clean
: same asbuild
above ✅cordova/run --emulator
: same asbuild
above ✅NOTE: This has not been tested on an Android SDK installation with SDK Tools older than 25.3.1! I would love for someone with SDK Tools 25.2.x to give this a go.
Other Notes
These are extensive changes! I would love a bunch of people to review this, so pinging @infil00p, @purplecabbage, @shazron, @stevengill, @timkim, @macdonst, @dpogue. Review party!
Checklist