gradle-plugin: generate build task only for supported platforms
This commit is contained in:
@@ -60,7 +60,8 @@ open class KonanInteropConfig(
|
||||
}
|
||||
|
||||
fun target(value: String) = with(generateStubsTask) {
|
||||
target = value
|
||||
generateStubsTask.target = value
|
||||
compileStubsTask.target = value
|
||||
}
|
||||
|
||||
fun compilerOpts(vararg values: String) = with(generateStubsTask) {
|
||||
|
||||
@@ -112,6 +112,15 @@ class KonanPlugin: Plugin<ProjectInternal> {
|
||||
}
|
||||
}
|
||||
|
||||
private fun String.isSupported(): Boolean {
|
||||
val os = CompilerDownloadTask.simpleOsName()
|
||||
return when (os) {
|
||||
"macos" -> this == "macbook" || this == "iphone"
|
||||
"linux" -> this == "linux" || this == "raspberrypi"
|
||||
else -> false
|
||||
}
|
||||
}
|
||||
|
||||
// TODO: Create default config? what about test sources?
|
||||
override fun apply(project: ProjectInternal?) {
|
||||
if (project == null) { return }
|
||||
@@ -122,8 +131,8 @@ class KonanPlugin: Plugin<ProjectInternal> {
|
||||
project.delete(project.konanBuildRoot)
|
||||
}
|
||||
getTask(project, "build").apply {
|
||||
dependsOn(project.tasks.withType(KonanCompileTask::class.java))
|
||||
dependsOn(project.tasks.withType(KonanInteropTask::class.java))
|
||||
dependsOn(project.tasks.withType(KonanCompileTask::class.java).matching { it.target?.isSupported() ?: true })
|
||||
dependsOn(project.tasks.withType(KonanInteropTask::class.java).matching { it.target?.isSupported() ?: true })
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user