-
-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Android SDK handling (#3913)
This PR seeks to improve Android SDK handling approach. The current issues are: * Android SDK setup is [limited only to Linux](https://github.com/com-lihaoyi/mill/blob/9d11962eaf529474dd66e095620a97cff66ebcd3/scalalib/src/mill/javalib/android/AndroidSdkModule.scala#L24) and is also using [tooling which may be not available on other platforms](https://github.com/com-lihaoyi/mill/blob/9d11962eaf529474dd66e095620a97cff66ebcd3/scalalib/src/mill/javalib/android/AndroidSdkModule.scala#L102-L109). * Each module [will have its own copy of SDK](https://github.com/com-lihaoyi/mill/blob/9d11962eaf529474dd66e095620a97cff66ebcd3/scalalib/src/mill/javalib/android/AndroidSdkModule.scala#L114). Imagine a project with 20 Android modules (19 lib modules + 1 app module), it will be 20x space usage than it should be. This is quite significant, considering that the basic setup (`platforms:android-35`, `platform-tools` and `build-tools;35.0.0`) is taking ~300 MB. * Licenses are [accepted on the end-user behalf](https://github.com/com-lihaoyi/mill/blob/9d11962eaf529474dd66e095620a97cff66ebcd3/scalalib/src/mill/javalib/android/AndroidSdkModule.scala#L108), without the consent. This PR: * Aligns the SDK setup experience with AGP (Android Gradle Plugin): * Expects Android SDK (at least command line tools) to be present on the end-user machine and registered with the env variable (`ANDROID_HOME`). * Expects command line tools to be present there to utilize [sdkmanager](https://developer.android.com/tools/sdkmanager) to setup the necessary SDK components. * Expects user to accept the necessary licenses by themselves. If they are not accepted, `sdkmanager` will block `stdin` waiting for the user input before proceeding with installation. **Note**: when downloading [Android Studio](https://developer.android.com/studio), it will come with the necessary basic license already accepted + some basic SDK components. If downloading command line tools, it is necessary to accept the main license (`android-sdk-license`) manually. * Installs all the necessary components to the location pointed by the `ANDROID_HOME` env variable, so that they are shared by all modules. * Adds the necessary step on the CI to install Android SDK for the jobs where it is needed. **Note**: I was also thinking about extracting Android-related examples into a dedicated job, but then for the existing jobs doing something like `example.kotlinlib[__].local.testCached` ->`example.kotlinlib[__:^AndroidAppKotlinModule].local.testCached` doesn't work (at least `mill resolve` still shows Android module), all cross-segments should be listed manually. Speaking of `sdkmanager`: it is also possible to utilize directly the [following artifact](https://mvnrepository.com/artifact/com.android.tools/sdklib) and put it in a worker, but for this one it is impossible to find a version on the Android Developers website, so end-user will have troubles updating it and anyway it is one-shot action normally, so keeping it even in the separate classpath looks like an overkill. [Command line tools](https://developer.android.com/tools) will be needed anyway further for the other tools it provides. Co-authored-by: 0xnm <0xnm@users.noreply.github.com>
- Loading branch information
Showing
3 changed files
with
149 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters