Created
January 5, 2022 18:03
-
-
Save nomisRev/dfa04f955798b0a8c107e2a564e46487 to your computer and use it in GitHub Desktop.
Gradle Kotlin MPP appleTest task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ./gradlew runs tests for all configured Apple targets | |
val appleTest = tasks.create("appleTest") | |
subprojects { | |
afterEvaluate { | |
val appleTargets = setOf("tvos", "watchos", "ios", "macos") | |
extensions.findByType<org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension>() | |
?.sourceSets | |
?.filter { appleTargets.any { target -> it.name.contains(target) } && it.name.contains("Test") } | |
?.forEach { | |
tasks.findByName(it.name)?.let { task -> | |
appleTest.dependsOn(task) | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment