Closed nrobi144 closed 3 years ago
@nrobi144 i think we can use all with name.startWith:
val nonAndroidPrefixes = listOf("ios", "macos", "linux", ...)
sourceSets.matching { sourceSet ->
nonAndroidPrefixes.any { sourceSet.name.startWith(it) }
}.all {
...
}
@nrobi144 i think we can use all with name.startWith:
val nonAndroidPrefixes = listOf("ios", "macos", "linux", ...) sourceSets.matching { sourceSet -> nonAndroidPrefixes.any { sourceSet.name.startWith(it) } }.all { ... }
(@Alex009 that's right, but I was thinking of reusing the created targets.
For ex the ios()
, windows()
& linux()
could return a listOf<KotlinNativeTarget>
, would be cool to tie the configuration to that list)
nvm, looks like this does the job
val intermediateSourceSets = listOf(commonMain, notAndroidMain)
matching { sourceSet ->
!sourceSet.name.startsWith("android") && sourceSet !in intermediateSourceSets
}.all {
dependsOn(notAndroidMain)
}
@Alex009 , yepp, unfortunately I didn't find a way to avoid explicitly configuring every sourceSet Any ideas?