Hello, can anyone point me to documentation on how...
# gradle
e
Hello, can anyone point me to documentation on how can I create something similar to flavours, but in pure Kotlin library, so NOT Android? Thanks
e
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
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?
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