[Gradle] Do not check for configuration cache report file existence

This file is generated even if there's no problems since Gradle 7.4. It now contains useful information to determine configuration inputs. Rely on the configuration cache problems option instead.
#KT-52625 In Progress
This commit is contained in:
Alexander Likhachev
2023-01-03 19:05:52 +01:00
committed by Space Team
parent 72a6f977f6
commit bfde8eda81
2 changed files with 0 additions and 37 deletions
@@ -109,7 +109,6 @@ class ConfigurationCacheIT : AbstractConfigurationCacheIT() {
testConfigurationCacheOf(
"build",
executedTaskNames = expectedTasks,
checkConfigurationCacheFileReport = false,
buildOptions = defaultBuildOptions.copy(
configurationCacheProblems = BaseGradleIT.ConfigurationCacheProblems.FAIL,
warningMode = WarningMode.All,
@@ -264,14 +263,12 @@ abstract class AbstractConfigurationCacheIT : KGPBaseTest() {
vararg taskNames: String,
executedTaskNames: List<String>? = null,
checkUpToDateOnRebuild: Boolean = true,
checkConfigurationCacheFileReport: Boolean = true,
buildOptions: BuildOptions = defaultBuildOptions
) {
assertSimpleConfigurationCacheScenarioWorks(
*taskNames,
executedTaskNames = executedTaskNames,
checkUpToDateOnRebuild = checkUpToDateOnRebuild,
checkConfigurationCacheFileReport = checkConfigurationCacheFileReport,
buildOptions = buildOptions,
)
}
@@ -22,7 +22,6 @@ fun TestProject.assertSimpleConfigurationCacheScenarioWorks(
buildOptions: BuildOptions,
executedTaskNames: List<String>? = null,
checkUpToDateOnRebuild: Boolean = true,
checkConfigurationCacheFileReport: Boolean = true,
) {
// First, run a build that serializes the tasks state for configuration cache in further builds
@@ -35,7 +34,6 @@ fun TestProject.assertSimpleConfigurationCacheScenarioWorks(
)
assertOutputContains("Configuration cache entry stored.")
if (checkConfigurationCacheFileReport) assertConfigurationCacheReportNotCreated()
}
build("clean", buildOptions = buildOptions)
@@ -53,38 +51,6 @@ fun TestProject.assertSimpleConfigurationCacheScenarioWorks(
}
}
/**
* Copies all files from the directory containing the given [htmlReportFile] to a
* fresh temp dir and returns a reference to the copied [htmlReportFile] in the new
* directory.
*/
@OptIn(ExperimentalPathApi::class)
private fun copyReportToTempDir(htmlReportFile: Path): Path =
createTempDirDeleteOnExit("report").let { tempDir ->
htmlReportFile.parent.toFile().copyRecursively(tempDir.toFile())
tempDir.resolve(htmlReportFile.name)
}
/**
* The configuration cache report file, if exists, indicates problems were
* found while caching the task graph.
*/
private val GradleProject.configurationCacheReportFile
get() = projectPath
.resolve("build")
.takeIf { it.exists() }
?.findInPath("configuration-cache-report.html")
?.let { copyReportToTempDir(it) }
private val Path.asClickableFileUrl
get() = URI("file", "", toUri().path, null, null).toString()
private fun GradleProject.assertConfigurationCacheReportNotCreated() {
configurationCacheReportFile?.let { htmlReportFile ->
fail("Configuration cache problems were found, check ${htmlReportFile.asClickableFileUrl} for details.")
}
}
fun BuildResult.assertConfigurationCacheReused() {
assertOutputContains("Reusing configuration cache.")
}