Update settings script properly, more tests with warning-mode=fail

For some test class where most of the sub tests are able to run
warning-mode=fail, we should not disable that warning mode for all
sub tests in that class.
This commit is contained in:
Bingran
2020-11-13 11:04:26 +00:00
committed by Sergey Igushkin
parent 52c22d891f
commit 858f73124d
6 changed files with 17 additions and 16 deletions
@@ -153,13 +153,15 @@ abstract class BaseGradleIT {
return wrapper
}
fun mightUpdateSettingsScript(wrapperVersion: String, settingsScript: File) {
fun maybeUpdateSettingsScript(wrapperVersion: String, settingsScript: File) {
// enableFeaturePreview("GRADLE_METADATA") is no longer needed when building with Gradle 5.4 or above
if (GradleVersion.version(wrapperVersion) > GradleVersion.version("5.3")) {
if (GradleVersion.version(wrapperVersion) >= GradleVersion.version("5.4")) {
settingsScript.apply {
if(exists()) {
modify {
it.replace("enableFeaturePreview('GRADLE_METADATA')", "//")
}
modify {
it.replace("enableFeaturePreview(\"GRADLE_METADATA\")", "//")
}
}
@@ -336,8 +338,6 @@ abstract class BaseGradleIT {
val env = createEnvironmentVariablesMap(options)
val wrapperDir = prepareWrapper(wrapperVersion, env)
mightUpdateSettingsScript(wrapperVersion, gradleSettingsScript())
val cmd = createBuildCommand(wrapperDir, params, options)
println("<=== Test build: ${this.projectName} $cmd ===>")
@@ -346,6 +346,8 @@ abstract class BaseGradleIT {
setupWorkingDir()
}
maybeUpdateSettingsScript(wrapperVersion, gradleSettingsScript())
val result = runProcess(cmd, projectDir, env, options)
try {
CompiledProject(this, result.output, result.exitCode).check()
@@ -19,8 +19,7 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() {
androidHome = KotlinTestUtils.findAndroidSdk(),
androidGradlePluginVersion = androidGradlePluginVersion,
configurationCache = true,
configurationCacheProblems = ConfigurationCacheProblems.FAIL,
warningMode = WarningMode.Summary
configurationCacheProblems = ConfigurationCacheProblems.FAIL
)
@Test
@@ -39,7 +38,10 @@ class ConfigurationCacheForAndroidIT : AbstractConfigurationCacheIT() {
@Test
fun testKotlinAndroidProjectTests() = with(Project("AndroidIncrementalMultiModule")) {
applyAndroid40Alpha4KotlinVersionWorkaround()
testConfigurationCacheOf(":app:compileDebugAndroidTestKotlin", ":app:compileDebugUnitTestKotlin")
testConfigurationCacheOf(
":app:compileDebugAndroidTestKotlin", ":app:compileDebugUnitTestKotlin",
buildOptions = defaultBuildOptions().copy(warningMode = WarningMode.Summary)
)
}
/**
@@ -93,7 +93,7 @@ abstract class AbstractConfigurationCacheIT : BaseGradleIT() {
checkInstantExecutionSucceeded()
}
build("clean") {
build("clean", options = buildOptions) {
assertSuccessful()
}
@@ -36,10 +36,6 @@ import kotlin.test.assertTrue
class KotlinGradleIT : BaseGradleIT() {
override fun defaultBuildOptions(): BuildOptions {
return super.defaultBuildOptions().copy(warningMode = WarningMode.Summary)
}
@Test
fun testCrossCompile() {
val project = Project("kotlinJavaProject")
@@ -395,7 +391,7 @@ class KotlinGradleIT : BaseGradleIT() {
""".trimIndent()
}
project.build("build", "install") {
project.build("build", "install", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertTasksExecuted(":compileKotlin", ":compileTestKotlin")
val pomLines = File(project.projectDir, "build/poms/pom-default.xml").readLines()
@@ -934,7 +930,7 @@ class KotlinGradleIT : BaseGradleIT() {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
build("publish", "check", "runBenchmark") {
build("publish", "check", "runBenchmark", options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertTasksExecuted(":compileKotlin", ":compileTestKotlin", ":compileBenchmarkKotlin", ":test", ":runBenchmark")
@@ -5,6 +5,7 @@
package org.jetbrains.kotlin.gradle.util
import org.gradle.api.logging.configuration.WarningMode
import org.jetbrains.kotlin.gradle.BaseGradleIT
import kotlin.test.assertTrue
@@ -31,7 +32,7 @@ fun BaseGradleIT.Project.testResolveAllConfigurations(
}
}
build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME) {
build(RESOLVE_ALL_CONFIGURATIONS_TASK_NAME, options = defaultBuildOptions().copy(warningMode = WarningMode.Summary)) {
assertSuccessful()
assertTasksExecuted(":${subproject?.let { "$it:" }.orEmpty()}$RESOLVE_ALL_CONFIGURATIONS_TASK_NAME")
val unresolvedConfigurations = unresolvedConfigurationRegex.findAll(output).map { it.groupValues[1] }.toList()
@@ -55,7 +55,7 @@ const val IMPLEMENT_DEPRECATION_WARNING = "The '$IMPLEMENT_CONFIG_NAME' configur
open class KotlinPlatformImplementationPluginBase(platformName: String) : KotlinPlatformPluginBase(platformName) {
private val commonProjects = arrayListOf<Project>()
protected open fun configurationsForCommonModuleDependency(project: Project): List<Configuration> =
private fun configurationsForCommonModuleDependency(project: Project): List<Configuration> =
listOf(project.configurations.getByName("api"))
override fun apply(project: Project) {