https://kotlinlang.org logo
#multiplatform
Title
# multiplatform
s

Sam

07/27/2022, 11:22 AM
Has anyone managed to get a concept of build variants working within the shared code? Specifically my usecase is wanting to define instances of data classes populated with dummy data (for a mock variant of the app) in shared code, but I don't want those to be used in production. Any ideas anyone? 🙏
d

deviant

07/27/2022, 11:26 AM
maybe this could cover your use case https://github.com/yshrsmz/BuildKonfig
s

Sam

07/27/2022, 11:29 AM
Not really to be honest, unless I'm missunderstanding. I think that solves the problem of wanting configuration in one place , but doesn't solve the problem of wanting multiple source sets within the shared code
l

leandro

07/27/2022, 11:59 AM
I don’t have a good solution other than providing the data from the leaf/app module. This way every other module isn’t aware of variants
x

xxfast

07/27/2022, 12:14 PM
I created a you track issue to address lack of debug variants in common code, but that got immediately shot down
s

Sam

07/27/2022, 12:19 PM
@xxfast Do you have a link to the issue? I'd be interested in the response
I am moving this to 'Declined', not because the proposal is bad, but because we will not implement something like this in "the current multiplatform".
We're working together with Google to provide a better mpp+Android integration in the future. This implementation will have source sets completely re-designed and will hopefully satisfy your needs fully!
@Sebastian Sellmair [JB]
my current workaround for this is to extract this to a standalone nested module and include that for android debug variant like
Copy code
debugImplementation(project(":app:debug"))
s

Sebastian Sellmair [JB]

07/28/2022, 7:13 AM
Just to get a better understanding, why is the.
androidDebug
source set not an option for your use case?
s

Sam

07/28/2022, 7:14 AM
Because the
androidDebug
source set cannot be accessed from iOS. @xxfast how do you use that module in your iOS / other platforms?
x

xxfast

07/28/2022, 7:16 AM
that i'm yet to figure out 😅
right now im consuming the debug library in my release build as well - which is generally no go
s

Sam

07/28/2022, 7:20 AM
Ah fair enough, my current thinking is trying to do some kind of clever symlinking but it's probably asking for trouble
2 Views