Gradle, native: Rename test binary class: Test -> TestExecutable

This commit is contained in:
Ilya Matveev
2019-05-27 21:12:49 +03:00
parent 954fedc6f9
commit f47aafc471
7 changed files with 22 additions and 18 deletions
@@ -4,6 +4,10 @@ plugins {
kotlin("jvm")
}
repositories {
maven(kotlinNativeRepo)
}
dependencies {
compile(gradleApi())
compile(project(":kotlin-gradle-plugin-api"))
@@ -127,7 +127,7 @@ fun generateAbstractKotlinNativeBinaryContainer() {
binaryType("an Objective-C framework","Framework", "FRAMEWORK", "framework"),
binaryType(
"a test executable",
"Test",
"TestExecutable",
"TEST",
"test",
defaultBaseName = "\"test\""
@@ -143,30 +143,30 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
fun findFramework(buildType: String): Framework? = findFramework("", buildType)
/** Returns a test executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
abstract fun getTest(namePrefix: String, buildType: NativeBuildType): Test
abstract fun getTest(namePrefix: String, buildType: NativeBuildType): TestExecutable
/** Returns a test executable with the given [namePrefix] and the given build type. Throws an exception if there is no such binary.*/
fun getTest(namePrefix: String, buildType: String): Test =
fun getTest(namePrefix: String, buildType: String): TestExecutable =
getTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
/** Returns a test executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
fun getTest(buildType: NativeBuildType): Test = getTest("", buildType)
fun getTest(buildType: NativeBuildType): TestExecutable = getTest("", buildType)
/** Returns a test executable with the empty name prefix and the given build type. Throws an exception if there is no such binary.*/
fun getTest(buildType: String): Test = getTest("", buildType)
fun getTest(buildType: String): TestExecutable = getTest("", buildType)
/** Returns a test executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
abstract fun findTest(namePrefix: String, buildType: NativeBuildType): Test?
abstract fun findTest(namePrefix: String, buildType: NativeBuildType): TestExecutable?
/** Returns a test executable with the given [namePrefix] and the given build type. Returns null if there is no such binary. */
fun findTest(namePrefix: String, buildType: String): Test? =
fun findTest(namePrefix: String, buildType: String): TestExecutable? =
findTest(namePrefix, NativeBuildType.valueOf(buildType.toUpperCase()))
/** Returns a test executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
fun findTest(buildType: NativeBuildType): Test? = findTest("", buildType)
fun findTest(buildType: NativeBuildType): TestExecutable? = findTest("", buildType)
/** Returns a test executable with the empty name prefix and the given build type. Returns null if there is no such binary. */
fun findTest(buildType: String): Test? = findTest("", buildType)
fun findTest(buildType: String): TestExecutable? = findTest("", buildType)
/** Creates an executable with the given [namePrefix] for each build type and configures it. */
@JvmOverloads
@@ -293,15 +293,15 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
fun test(
namePrefix: String,
buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: Test.() -> Unit = {}
) = createBinaries(namePrefix, namePrefix, NativeOutputKind.TEST, buildTypes, ::Test, configure)
configure: TestExecutable.() -> Unit = {}
) = createBinaries(namePrefix, namePrefix, NativeOutputKind.TEST, buildTypes, ::TestExecutable, configure)
/** Creates a test executable with the empty name prefix for each build type and configures it. */
@JvmOverloads
fun test(
buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: Test.() -> Unit = {}
) = createBinaries("", "test", NativeOutputKind.TEST, buildTypes, ::Test, configure)
configure: TestExecutable.() -> Unit = {}
) = createBinaries("", "test", NativeOutputKind.TEST, buildTypes, ::TestExecutable, configure)
/** Creates a test executable with the given [namePrefix] for each build type and configures it. */
@JvmOverloads
@@ -92,7 +92,7 @@ open class KotlinNativeBinaryContainer @Inject constructor(
override fun getFramework(namePrefix: String, buildType: NativeBuildType): Framework =
getBinary(namePrefix, buildType, NativeOutputKind.FRAMEWORK)
override fun getTest(namePrefix: String, buildType: NativeBuildType): Test =
override fun getTest(namePrefix: String, buildType: NativeBuildType): TestExecutable =
getBinary(namePrefix, buildType, NativeOutputKind.TEST)
override fun findExecutable(namePrefix: String, buildType: NativeBuildType): Executable? {
@@ -109,7 +109,7 @@ open class KotlinNativeBinaryContainer @Inject constructor(
override fun findFramework(namePrefix: String, buildType: NativeBuildType): Framework? =
findBinary(namePrefix, buildType, NativeOutputKind.FRAMEWORK)
override fun findTest(namePrefix: String, buildType: NativeBuildType): Test? =
override fun findTest(namePrefix: String, buildType: NativeBuildType): TestExecutable? =
findBinary(namePrefix, buildType, NativeOutputKind.TEST)
// endregion.
@@ -121,7 +121,7 @@ open class KotlinNativeTargetConfigurator(
destinationDir = binary.outputDirectory
addCompilerPlugins()
if (binary !is Test) {
if (binary !is TestExecutable) {
tasks.maybeCreate(target.artifactsTaskName).dependsOn(this)
tasks.maybeCreate(LifecycleBasePlugin.ASSEMBLE_TASK_NAME).dependsOn(this)
}
@@ -130,7 +130,7 @@ class Executable constructor(
get() = runTaskName?.let { project.tasks.getByName(it) as AbstractExecTask<*> }
}
class Test(
class TestExecutable(
name: String,
baseName: String,
buildType: NativeBuildType,
@@ -364,7 +364,7 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile() {
@get:Input
val processTests: Boolean
get() = binary is Test
get() = binary is TestExecutable
@get:InputFiles
val exportLibraries: FileCollection