[Android] Add Gradle integration tests for AGP 7.1
^KT-49798
This commit is contained in:
committed by
Space
parent
48bb9ae069
commit
f864e19d95
+20
-8
@@ -120,10 +120,10 @@ open class KotlinAndroid36GradleIT : KotlinAndroid34GradleIT() {
|
|||||||
compilerPluginArgsRegex.findAll(output).associate { it.groupValues[1] to it.groupValues[2] }
|
compilerPluginArgsRegex.findAll(output).associate { it.groupValues[1] to it.groupValues[2] }
|
||||||
|
|
||||||
compilerPluginOptionsBySourceSet.entries.forEach { (sourceSetName, argsString) ->
|
compilerPluginOptionsBySourceSet.entries.forEach { (sourceSetName, argsString) ->
|
||||||
val shouldHaveAndroidExtensionArgs =
|
val shouldHaveAndroidExtensionArgs = sourceSetName.startsWith("androidApp") &&
|
||||||
sourceSetName.startsWith("androidApp") && (
|
(androidGradlePluginVersion < AGPVersion.v7_0_0 || !sourceSetName.contains("AndroidTestRelease")) &&
|
||||||
androidGradlePluginVersion < AGPVersion.v7_0_0 || !sourceSetName.contains("AndroidTestRelease")
|
(androidGradlePluginVersion < AGPVersion.v7_1_0 || !sourceSetName.contains("androidAppTestFixtures"))
|
||||||
)
|
|
||||||
if (shouldHaveAndroidExtensionArgs)
|
if (shouldHaveAndroidExtensionArgs)
|
||||||
assertTrue("$sourceSetName is an Android source set and should have Android Extensions in the args") {
|
assertTrue("$sourceSetName is an Android source set and should have Android Extensions in the args") {
|
||||||
"plugin:org.jetbrains.kotlin.android" in argsString
|
"plugin:org.jetbrains.kotlin.android" in argsString
|
||||||
@@ -482,12 +482,14 @@ open class KotlinAndroid70GradleIT : KotlinAndroid36GradleIT() {
|
|||||||
val options = defaultBuildOptions().copy(incremental = true, kotlinDaemonDebugPort = null)
|
val options = defaultBuildOptions().copy(incremental = true, kotlinDaemonDebugPort = null)
|
||||||
|
|
||||||
project.setupWorkingDir().also {
|
project.setupWorkingDir().also {
|
||||||
project.gradleBuildScript("libAndroid").appendText("""
|
project.gradleBuildScript("libAndroid").appendText(
|
||||||
|
"""
|
||||||
|
|
||||||
android.kotlinOptions {
|
android.kotlinOptions {
|
||||||
moduleName = "custom_path"
|
moduleName = "custom_path"
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
project.build("assembleDebug", options = options) {
|
project.build("assembleDebug", options = options) {
|
||||||
@@ -505,6 +507,14 @@ open class KotlinAndroid70GradleIT : KotlinAndroid36GradleIT() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
open class KotlinAndroid71GradleIT : KotlinAndroid70GradleIT() {
|
||||||
|
override val androidGradlePluginVersion: AGPVersion
|
||||||
|
get() = AGPVersion.v7_1_0
|
||||||
|
|
||||||
|
override val defaultGradleVersion: GradleVersionRequired
|
||||||
|
get() = GradleVersionRequired.AtLeast("7.2")
|
||||||
|
}
|
||||||
|
|
||||||
open class KotlinAndroid34GradleIT : KotlinAndroid3GradleIT() {
|
open class KotlinAndroid34GradleIT : KotlinAndroid3GradleIT() {
|
||||||
override val androidGradlePluginVersion: AGPVersion
|
override val androidGradlePluginVersion: AGPVersion
|
||||||
get() = AGPVersion.v3_4_1
|
get() = AGPVersion.v3_4_1
|
||||||
@@ -1057,14 +1067,16 @@ fun getSomething() = 10
|
|||||||
""".trimIndent() + it
|
""".trimIndent() + it
|
||||||
}
|
}
|
||||||
|
|
||||||
gradleBuildScript("Lib").appendText("\n" + """
|
gradleBuildScript("Lib").appendText(
|
||||||
|
"\n" + """
|
||||||
android {
|
android {
|
||||||
lintOptions.checkDependencies = true
|
lintOptions.checkDependencies = true
|
||||||
}
|
}
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation(project(":java-lib"))
|
implementation(project(":java-lib"))
|
||||||
}
|
}
|
||||||
""".trimIndent())
|
""".trimIndent()
|
||||||
|
)
|
||||||
|
|
||||||
gradleSettingsScript().appendText(
|
gradleSettingsScript().appendText(
|
||||||
"\n" + """
|
"\n" + """
|
||||||
|
|||||||
+2
-1
@@ -23,5 +23,6 @@ class AGPVersion private constructor(private val versionNumber: VersionNumber) {
|
|||||||
val v4_1_0 = fromString("4.1.3")
|
val v4_1_0 = fromString("4.1.3")
|
||||||
val v4_2_0 = fromString("4.2.0")
|
val v4_2_0 = fromString("4.2.0")
|
||||||
val v7_0_0 = fromString("7.0.0-beta02")
|
val v7_0_0 = fromString("7.0.0-beta02")
|
||||||
|
val v7_1_0 = fromString("7.1.0-beta03")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,7 @@ android {
|
|||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "app.example.com.app_sample"
|
applicationId "app.example.com.app_sample"
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||||
@@ -75,4 +75,4 @@ task printCompilerPluginOptions {
|
|||||||
println sourceSet.name + '=cp=>' + cp
|
println sourceSet.name + '=cp=>' + cp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -10,7 +10,7 @@ android {
|
|||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
minSdkVersion 21
|
minSdkVersion 21
|
||||||
targetSdkVersion 29
|
targetSdkVersion 30
|
||||||
versionCode 1
|
versionCode 1
|
||||||
versionName "1.0"
|
versionName "1.0"
|
||||||
|
|
||||||
@@ -88,4 +88,4 @@ publishing {
|
|||||||
url = uri("$buildDir/repo")
|
url = uri("$buildDir/repo")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user