Gradle, native: Add separate classes for targets with different tests

This commit is contained in:
Ilya Matveev
2019-12-05 17:15:30 +07:00
parent e6ab70c18d
commit cc3438f20c
5 changed files with 64 additions and 57 deletions
@@ -7,7 +7,6 @@ package org.jetbrains.kotlin.generators.gradle.dsl
import org.jetbrains.kotlin.generators.gradle.dsl.NativeFQNames.Presets
import org.jetbrains.kotlin.generators.gradle.dsl.NativeFQNames.Targets
import org.jetbrains.kotlin.generators.gradle.dsl.NativeFQNames.TestRuns
import org.jetbrains.kotlin.konan.target.HostManager
import org.jetbrains.kotlin.konan.target.KonanTarget
import org.jetbrains.kotlin.konan.target.presetName
@@ -23,11 +22,10 @@ internal fun KotlinPresetEntry.typeNames(): Set<TypeName> = setOf(presetType, ta
internal const val MPP_PACKAGE = "org.jetbrains.kotlin.gradle.plugin.mpp"
internal object NativeFQNames {
const val nativePackage = "org.jetbrains.kotlin.gradle.targets.native"
object Targets {
const val base = "$MPP_PACKAGE.KotlinNativeTarget"
const val withTests = "$MPP_PACKAGE.KotlinNativeTargetWithTests"
const val withHostTests = "$MPP_PACKAGE.KotlinNativeTargetWithHostTests"
const val withSimulatorTests = "$MPP_PACKAGE.KotlinNativeTargetWithSimulatorTests"
}
object Presets {
@@ -35,11 +33,6 @@ internal object NativeFQNames {
const val withHostTests = "$MPP_PACKAGE.KotlinNativeTargetWithHostTestsPreset"
const val withSimulatorTests = "$MPP_PACKAGE.KotlinNativeTargetWithSimulatorTestsPreset"
}
object TestRuns {
const val host = "$nativePackage.KotlinNativeHostTestRun"
const val simulator = "$nativePackage.KotlinNativeSimulatorTestRun"
}
}
internal val jvmPresetEntry = KotlinPresetEntry(
@@ -71,14 +64,14 @@ internal val nativePresetEntries = HostManager().targets
val (presetType, targetType) = when (target) {
in nativeTargetsWithHostTests ->
typeName(Presets.withHostTests) to typeName(Targets.withTests, TestRuns.host)
Presets.withHostTests to Targets.withHostTests
in nativeTargetsWithSimulatorTests ->
typeName(Presets.withSimulatorTests) to typeName(Targets.withTests, TestRuns.simulator)
Presets.withSimulatorTests to Targets.withSimulatorTests
else ->
typeName(Presets.simple) to typeName(Targets.base)
Presets.simple to Targets.base
}
KotlinPresetEntry(target.presetName, presetType, targetType)
KotlinPresetEntry(target.presetName, typeName(presetType), typeName(targetType))
}
internal val allPresetEntries = listOf(