Thanks, but I already looked at it, but as this is pure Kotlin project it does not seem to work... and overall is not very clear...
e
ephemient
10/22/2021, 11:57 PM
it should work for all JVM libraries, Kotlin or not, without special tweaks. it doesn't set up the hierarchy of sourceSets like Android does, though; that takes some more effort. what is unclear?
ephemient
10/23/2021, 12:03 AM
the attached example sets up the hierarchy for libraries, tests, and binaries, including for kotlin, which is somewhat tedious but straightforward
Copy code
$ ./gradlew check run{,V1,V2}
> Task :test
MainTest > variant has Main() PASSED
> Task :testVariant1
Variant1Test > test() PASSED
MainTest > variant has Main() PASSED
> Task :testVariant2
Variant2Test > test() PASSED
MainTest > variant has Main() PASSED
> Task :run
Hello from non-variant main
> Task :runVariant1
Hello from variant 1
> Task :runVariant2
Hello from variant 2
$ ./gradlew install{,V1,V2}Dist && echo build/install/example{,-variant{1,2}}/bin/example | xargs -n1 -t sh
sh build/install/example/bin/example
Hello from non-variant main
sh build/install/example-variant1/bin/example
Hello from variant 1
sh build/install/example-variant2/bin/example
Hello from variant 2