[mpp] Minor: drop warning about deprecated K/N test binary access
This commit is contained in:
+1
-27
@@ -804,7 +804,7 @@ class GeneralNativeIT : BaseGradleIT() {
|
||||
@Test
|
||||
fun testNativeTestGetters() = with(transformNativeTestProject("native-tests")) {
|
||||
// Check that test binaries can be accessed in a buildscript.
|
||||
build("checkNewGetters") {
|
||||
build("checkGetters") {
|
||||
assertSuccessful()
|
||||
val suffix = if (HostManager.hostIsMingw) "exe" else "kexe"
|
||||
val names = listOf("test", "another")
|
||||
@@ -815,32 +815,6 @@ class GeneralNativeIT : BaseGradleIT() {
|
||||
assertContains("Find test: $it")
|
||||
}
|
||||
}
|
||||
|
||||
// Check that accessing a test as an executable fails or returns null and shows the corresponding warning.
|
||||
build("checkOldGet") {
|
||||
assertFailed()
|
||||
assertContains(
|
||||
"""
|
||||
|Probably you are accessing the default test binary using the 'binaries.getExecutable("test", DEBUG)' method.
|
||||
|Since 1.3.40 tests are represented by a separate binary type. To get the default test binary, use:
|
||||
|
|
||||
| binaries.getTest("DEBUG")
|
||||
""".trimMargin()
|
||||
)
|
||||
}
|
||||
|
||||
build("checkOldFind") {
|
||||
assertSuccessful()
|
||||
assertContains(
|
||||
"""
|
||||
|Probably you are accessing the default test binary using the 'binaries.findExecutable("test", DEBUG)' method.
|
||||
|Since 1.3.40 tests are represented by a separate binary type. To get the default test binary, use:
|
||||
|
|
||||
| binaries.findTest("DEBUG")
|
||||
""".trimMargin()
|
||||
)
|
||||
assertContains("Find test: null")
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+1
-19
@@ -50,25 +50,7 @@ configure([hostTest, iosTest, iosArm64Test]){
|
||||
}
|
||||
}
|
||||
|
||||
// Check that getting a test binary in an old way fails showing the corresponding warning
|
||||
task checkOldGet {
|
||||
doLast {
|
||||
configure([kotlin.targets.host]) {
|
||||
println("Get test: ${binaries.getExecutable("test", DEBUG)}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Check that finding a test binary in an old way returns null showing the corresponding warning.
|
||||
task checkOldFind {
|
||||
doLast {
|
||||
configure([kotlin.targets.host]) {
|
||||
println("Find test: ${binaries.findExecutable("test", DEBUG)}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
task checkNewGetters {
|
||||
task checkGetters {
|
||||
doLast {
|
||||
configure([kotlin.targets.host]) {
|
||||
println("Get test: ${binaries.getTest(DEBUG).outputFile.name}")
|
||||
|
||||
+1
-31
@@ -75,14 +75,7 @@ abstract class KotlinNativeBinaryContainer @Inject constructor(
|
||||
override fun getByName(name: String): NativeBinary = nameToBinary.getValue(name)
|
||||
override fun findByName(name: String): NativeBinary? = nameToBinary[name]
|
||||
|
||||
private fun checkDeprecatedTestAccess(namePrefix: String, buildType: NativeBuildType, warning: String) {
|
||||
if (namePrefix == DEFAULT_TEST_NAME_PREFIX && buildType == DEFAULT_TEST_BUILD_TYPE) {
|
||||
project.logger.warn(warning)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getExecutable(namePrefix: String, buildType: NativeBuildType): Executable {
|
||||
checkDeprecatedTestAccess(namePrefix, buildType, GET_TEST_DEPRECATION_WARNING)
|
||||
return getBinary(namePrefix, buildType, NativeOutputKind.EXECUTABLE)
|
||||
}
|
||||
|
||||
@@ -99,7 +92,6 @@ abstract class KotlinNativeBinaryContainer @Inject constructor(
|
||||
getBinary(namePrefix, buildType, NativeOutputKind.TEST)
|
||||
|
||||
override fun findExecutable(namePrefix: String, buildType: NativeBuildType): Executable? {
|
||||
checkDeprecatedTestAccess(namePrefix, buildType, FIND_TEST_DEPRECATED_WARNING)
|
||||
return findBinary(namePrefix, buildType, NativeOutputKind.EXECUTABLE)
|
||||
}
|
||||
|
||||
@@ -154,10 +146,7 @@ abstract class KotlinNativeBinaryContainer @Inject constructor(
|
||||
}
|
||||
|
||||
companion object {
|
||||
internal val DEFAULT_TEST_BUILD_TYPE = NativeBuildType.DEBUG
|
||||
internal val DEFAULT_TEST_NAME_PREFIX = "test"
|
||||
|
||||
internal fun generateBinaryName(prefix: String, buildType: NativeBuildType, outputKindClassifier: String) =
|
||||
internal fun generateBinaryName(prefix: String, buildType: NativeBuildType, outputKindClassifier: String) =
|
||||
lowerCamelCaseName(prefix, buildType.getName(), outputKindClassifier)
|
||||
|
||||
internal fun extractPrefixFromBinaryName(name: String, buildType: NativeBuildType, outputKindClassifier: String): String {
|
||||
@@ -167,25 +156,6 @@ abstract class KotlinNativeBinaryContainer @Inject constructor(
|
||||
else
|
||||
name.substringBeforeLast(suffix.capitalizeAsciiOnly())
|
||||
}
|
||||
|
||||
// TODO: Remove in 1.3.50.
|
||||
private val GET_TEST_DEPRECATION_WARNING = """
|
||||
|
|
||||
|Probably you are accessing the default test binary using the 'binaries.getExecutable("$DEFAULT_TEST_NAME_PREFIX", ${DEFAULT_TEST_BUILD_TYPE.name})' method.
|
||||
|Since 1.3.40 tests are represented by a separate binary type. To get the default test binary, use:
|
||||
|
|
||||
| binaries.getTest("DEBUG")
|
||||
|
|
||||
""".trimMargin()
|
||||
|
||||
private val FIND_TEST_DEPRECATED_WARNING = """
|
||||
|
|
||||
|Probably you are accessing the default test binary using the 'binaries.findExecutable("$DEFAULT_TEST_NAME_PREFIX", ${DEFAULT_TEST_BUILD_TYPE.name})' method.
|
||||
|Since 1.3.40 tests are represented by a separate binary type. To get the default test binary, use:
|
||||
|
|
||||
| binaries.findTest("DEBUG")
|
||||
|
|
||||
""".trimMargin()
|
||||
}
|
||||
// endregion.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user