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") kotlin("jvm")
} }
repositories {
maven(kotlinNativeRepo)
}
dependencies { dependencies {
compile(gradleApi()) compile(gradleApi())
compile(project(":kotlin-gradle-plugin-api")) compile(project(":kotlin-gradle-plugin-api"))
@@ -127,7 +127,7 @@ fun generateAbstractKotlinNativeBinaryContainer() {
binaryType("an Objective-C framework","Framework", "FRAMEWORK", "framework"), binaryType("an Objective-C framework","Framework", "FRAMEWORK", "framework"),
binaryType( binaryType(
"a test executable", "a test executable",
"Test", "TestExecutable",
"TEST", "TEST",
"test", "test",
defaultBaseName = "\"test\"" defaultBaseName = "\"test\""
@@ -143,30 +143,30 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
fun findFramework(buildType: String): Framework? = findFramework("", buildType) 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.*/ /** 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.*/ /** 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())) 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.*/ /** 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.*/ /** 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. */ /** 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. */ /** 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())) 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. */ /** 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. */ /** 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. */ /** Creates an executable with the given [namePrefix] for each build type and configures it. */
@JvmOverloads @JvmOverloads
@@ -293,15 +293,15 @@ abstract class AbstractKotlinNativeBinaryContainer : DomainObjectSet<NativeBinar
fun test( fun test(
namePrefix: String, namePrefix: String,
buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES, buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: Test.() -> Unit = {} configure: TestExecutable.() -> Unit = {}
) = createBinaries(namePrefix, namePrefix, NativeOutputKind.TEST, buildTypes, ::Test, configure) ) = createBinaries(namePrefix, namePrefix, NativeOutputKind.TEST, buildTypes, ::TestExecutable, configure)
/** Creates a test executable with the empty name prefix for each build type and configures it. */ /** Creates a test executable with the empty name prefix for each build type and configures it. */
@JvmOverloads @JvmOverloads
fun test( fun test(
buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES, buildTypes: Collection<NativeBuildType> = NativeBuildType.DEFAULT_BUILD_TYPES,
configure: Test.() -> Unit = {} configure: TestExecutable.() -> Unit = {}
) = createBinaries("", "test", NativeOutputKind.TEST, buildTypes, ::Test, configure) ) = createBinaries("", "test", NativeOutputKind.TEST, buildTypes, ::TestExecutable, configure)
/** Creates a test executable with the given [namePrefix] for each build type and configures it. */ /** Creates a test executable with the given [namePrefix] for each build type and configures it. */
@JvmOverloads @JvmOverloads
@@ -92,7 +92,7 @@ open class KotlinNativeBinaryContainer @Inject constructor(
override fun getFramework(namePrefix: String, buildType: NativeBuildType): Framework = override fun getFramework(namePrefix: String, buildType: NativeBuildType): Framework =
getBinary(namePrefix, buildType, NativeOutputKind.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) getBinary(namePrefix, buildType, NativeOutputKind.TEST)
override fun findExecutable(namePrefix: String, buildType: NativeBuildType): Executable? { 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? = override fun findFramework(namePrefix: String, buildType: NativeBuildType): Framework? =
findBinary(namePrefix, buildType, NativeOutputKind.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) findBinary(namePrefix, buildType, NativeOutputKind.TEST)
// endregion. // endregion.
@@ -121,7 +121,7 @@ open class KotlinNativeTargetConfigurator(
destinationDir = binary.outputDirectory destinationDir = binary.outputDirectory
addCompilerPlugins() addCompilerPlugins()
if (binary !is Test) { if (binary !is TestExecutable) {
tasks.maybeCreate(target.artifactsTaskName).dependsOn(this) tasks.maybeCreate(target.artifactsTaskName).dependsOn(this)
tasks.maybeCreate(LifecycleBasePlugin.ASSEMBLE_TASK_NAME).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<*> } get() = runTaskName?.let { project.tasks.getByName(it) as AbstractExecTask<*> }
} }
class Test( class TestExecutable(
name: String, name: String,
baseName: String, baseName: String,
buildType: NativeBuildType, buildType: NativeBuildType,
@@ -364,7 +364,7 @@ open class KotlinNativeLink : AbstractKotlinNativeCompile() {
@get:Input @get:Input
val processTests: Boolean val processTests: Boolean
get() = binary is Test get() = binary is TestExecutable
@get:InputFiles @get:InputFiles
val exportLibraries: FileCollection val exportLibraries: FileCollection