-
-
Notifications
You must be signed in to change notification settings - Fork 32
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
Support config inheritance #64
Comments
copied from #61 (comment) That's a good question. That's because you can only have one actual declaration in sourceset hierarchy. If you want targetConfig in androidMain, then you can't have it in jvmMain. 2 actual declarations in a hierarchy simply throws a compile error. Which we should prefer is something I couldn't find a good answer. What is your desired behavior? |
copied from #61 (comment), by @TobiasPr Thanks for replying so quickly :) In our case we build our application for jvmMain, androidMain (which is currently 100% identical source sets wise but we would like to set some differnent value on buildkonfig) and iosMain. Here is a part of our build.gradle.kts:
if we build for android the generated buildkonfig is the same as for jvm and it would be cool to have them differently. I am not that experienced in KMM so I am not sure if it is just a use case of ours and whether we actually need to make the distinction between jvm and android. I was just thinking whether this inheritance like behavior could also solve the limitations mentioned in the ticket #38 for Desktop systems, which seem a similar use case - but maybe I did not understand the technical limitations correctly |
Your jvmMain is an intermediate SourceSet, but also a "terminal" SourceSet. Assuming that your
|
Whoops, timing. Generally, BuildKonfig currently assumes that "intermediate" SourceSet is just "intermediate", as Kotlin does not allow having multiple |
I tried that, but my build is failing. I think it is because we did not see that it is currently not supported/ we are not supopsed to share code between android and jvm according to the documentation:
Unfortunately I cannot really say something if creating a common source set works, because when I tried I ran into compilation errors which are probably caused by missing support |
Yeah, above suggestion is before-your-previous-comment, so I didn't know about the current KMP limitation you said. So it's a general suggestion rather than your usecase specific, unfortunately :( |
Okay, thank you for taking the time :) |
#61
copied from #61 (comment), by @TobiasPr
Why did you decide that the hierarchical higher source set always has precedence? I think this is counter intuitive. I think about as inheritance in which lower hierarchical source set inherits the props from the higher source set, but it should still be able to set a more specific value
right now we have a sourceset hierarchy like this:
for androidMain the buildkonfig is not generated - only for the jvmMain
The text was updated successfully, but these errors were encountered: