Is it possible to create compilation based source ...
# multiplatform
k
Is it possible to create compilation based source sets? I want to have some common
expect
function that has different implementation based on compilation type (debug vs release basically), how would I set that up?
👍 1
b
I doubt it, but would be glad to be proven wrong here.
k
What I’m looking for is a setup like this:
Copy code
// commonMain
expect fun foo(): String

// commonRelease
actual fun foo(): String = "release"

// commonDebug
actual fun foo(): String = "debug"
It looks like I might need to create
debug
and
release
compilations and wire them up to each target; along with new
commonRelease
and
commonDebug
source sets?
Setting this up seems pretty painful 😕
One option I’m considering is to use generated build flavor: https://github.com/yshrsmz/BuildKonfig.
x
Even with BuildKonfig - there's no real way to do this. This is because common sources doesn't distinguish between release and debug sources