-
-
Notifications
You must be signed in to change notification settings - Fork 421
Android: Variant and Release Submodules #6126
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
base: main
Are you sure you want to change the base?
Android: Variant and Release Submodules #6126
Conversation
# Conflicts: # libs/androidlib/src/mill/androidlib/AndroidR8AppModule.scala
| * Never use these defaults in a production environment as they are not secure. | ||
| * This is just for testing purposes. | ||
| */ | ||
| def androidReleaseKeyName: Option[String] = Some("releaseKey.jks") |
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.
I think with this change, we should remove the defaults and avoid the comment above
|
Hi! I'm I would like to apply some automated changes to this pull request, but it looks like I don't have the necessary permissions to do so. To get this pull request into a mergeable state, please do one of the following two things:
|
|
@lefou what do you think about this approach? Looking at the build variants in general, I think the cross module might be a better fit and perhaps we give a trait to easily achieve the release targets. Just thinking out loud: For the variants in general the users are free to create a cross module themselves, but we should have something for release imo, but in this form a lot of the weight falls on us maintaining it while perhaps a different cross module approach than our first attempt would be better, for example having a |
|
Now that I got to play with spring boot under a similar concept, I'll give this another go |
|
From a quick glance, this approach looks good to me. I'm not sure what you refer to with "shared base trait approach". In general, I think the variant-sub-modules should be fully capable android modules that can produce results on their own. The |
|
I added to the docs in kotlin 1-hello-kotlin example, and from the user experience perspective, it feels nice. Let's go with this I think |
|
well, feels less nice when the build is more complex with hilt, R8 + kotlin something like that is needed |
|
this is a working release configuration with a complex setup https://github.com/vaslabs/Pokedex_Compose_Multi_Module/pull/1/files |
|
on the other hand, cross module is fairly straight forward to be plugged in and I don't think we need to do anything there to support it (vaslabs/Pokedex_Compose_Multi_Module#2) apart from maybe some minor indirect UX improvements like making the emulator port a task so it can be derived from androidIsDebug |
|
the question is, this approach has a lot of complexity, do we take the hit? I think we don't do anything and close this PR, the cross module should be more than enough for the android variant to work out of the box by purely using Mill's cross module features we can add some examples to aid any users and that's it imo |
This implements #6047 (comment).
Changes
androidIsDebugtofalse.Having a dedicated Variant for each module type (Android, AndroidKotlin, AndroidR8, AndroidNative) seems necessary to avoid missing configurations.
Users now need to create a
releaseobject that extends the correspondingReleasetrait, and then run:./mill app.release.compile, etcWhat's Next
Remove the
androidIsDebugflag and instead let theReleasetraits override the relevant tasks directly.Release configurations (keystore details) should be in the release variant too
Concerns
This approach utilizes shared resources and may provide a better user experience with the APIs. However in my opinion, manually overriding tasks to reference outer implementations may be error-prone, both in terms of development and potential unexpected behavior if users override unshared tasks.
Maybe the shared base trait approach is something safer and more scalable, but with the cost of not sharing resources. Perhaps we could use the
outerapproach —just as an exception— to share some resource-heavy tasks.