Would it be a completely crazy idea to allow for one file to contribute to multiple source-sets? E.g.
Copy code
fun myProductionFun(){ ... }
@TestSource
fun testMyProductionFun(){ ... }
plus1 1
stantronic
02/12/2024, 12:03 PM
while compiling main, compiler would simply ignore anything with @TestSource annotation, but when compiling test target, it would only compile @TestSource annotated elements.
stantronic
02/12/2024, 12:04 PM
Could make e.g. multiplatform development much nicer experience, to cut out the folder-hopping etc.
j
Javier
02/13/2024, 6:58 PM
You are looking for test fixtures but they are not working with Kotlin Multiplatform yet
s
stantronic
02/15/2024, 4:20 PM
I think test fixtures are something else. Test source was just one example, but I'm asking about the principle of different source-sets referencing the same code file. Another example would be to have JVM, JS and Native actual functions in the same file as their expect function, but distinguished by annotations rather than what directory they live in.