How much of a bad idea would passing -Xmulti-platform, -Xcommon-source and -Xexpect-actual-classes manually to the compiler to have expect/actual behavior with android variants be ?
• This is not a multiplatform project. It's a regular, com.android.library/application project.
• Variants are, for the vast majority of it, used to isolate environments (different APIs, package IDs to avoid sending debug builds to prod, debugging tools enabled in dev & qa, but not in preproduction or production, etc). Pure code isolation offers more guarantees than just build time parameters that turn things on or off.
• Having to maintain exact API shape across variants and only discovering you made a mistake when building that particular variant (or even better, crashing at runtime) isn't a pleasant experience
• API/Noop gradle modules suffer from the same problem, except that now you're also introducing gradle module resolution into it.
expect/actual however is very pleasant, and I'd love to make use of it across variants. src/main (or src/expect, or anything else) carries the expect fun component(...), src/debug has actual fun component() { DebugBehavior() } and src/main has a noop implementation. These compiler arguments are currently used across KGP, so I'm not too worried about them disappearing, altough you never know.
Tests show that it works quite well on 2.4.20! At the very least, it resolves the things I want, complains when APIs don't match, etc. If someone at JB wants to scream really loudly "oh god please don't do that" , I'd love to hear why (for any reason aside from me abusing the compiler, doing unsupported things, etc.)