Update block to print build info on error.
^KT-45745 In Progress
This commit is contained in:
+24
-24
@@ -71,14 +71,13 @@ fun TestProject.build(
|
|||||||
assertions: BuildResult.() -> Unit = {}
|
assertions: BuildResult.() -> Unit = {}
|
||||||
) {
|
) {
|
||||||
val allBuildArguments = commonBuildSetup(buildArguments.toList())
|
val allBuildArguments = commonBuildSetup(buildArguments.toList())
|
||||||
withBuildSummary(allBuildArguments) {
|
val gradleRunnerForBuild = gradleRunner
|
||||||
val buildResult = gradleRunner
|
.also { if (forceOutput) it.forwardOutput() }
|
||||||
.also { if (forceOutput) it.forwardOutput() }
|
.withArguments(allBuildArguments)
|
||||||
.withArguments(allBuildArguments)
|
val buildResult = withBuildSummary(allBuildArguments) {
|
||||||
.build()
|
gradleRunnerForBuild.build()
|
||||||
|
|
||||||
assertions(buildResult)
|
|
||||||
}
|
}
|
||||||
|
assertions(buildResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -90,14 +89,14 @@ fun TestProject.buildAndFail(
|
|||||||
assertions: BuildResult.() -> Unit = {}
|
assertions: BuildResult.() -> Unit = {}
|
||||||
) {
|
) {
|
||||||
val allBuildArguments = commonBuildSetup(buildArguments.toList())
|
val allBuildArguments = commonBuildSetup(buildArguments.toList())
|
||||||
withBuildSummary(allBuildArguments) {
|
val gradleRunnerForBuild = gradleRunner
|
||||||
val buildResult = gradleRunner
|
.also { if (forceOutput) it.forwardOutput() }
|
||||||
.also { if (forceOutput) it.forwardOutput() }
|
.withArguments(allBuildArguments)
|
||||||
.withArguments(allBuildArguments)
|
val buildResult = withBuildSummary(allBuildArguments) {
|
||||||
.buildAndFail()
|
gradleRunnerForBuild.buildAndFail()
|
||||||
|
|
||||||
assertions(buildResult)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
assertions(buildResult)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun TestProject.enableLocalBuildCache(
|
fun TestProject.enableLocalBuildCache(
|
||||||
@@ -140,16 +139,17 @@ private fun TestProject.commonBuildSetup(
|
|||||||
return buildOptionsArguments + buildArguments + "--full-stacktrace"
|
return buildOptionsArguments + buildArguments + "--full-stacktrace"
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun TestProject.withBuildSummary(buildArguments: List<String>, run: () -> Unit) {
|
private fun TestProject.withBuildSummary(
|
||||||
try {
|
buildArguments: List<String>,
|
||||||
run()
|
run: () -> BuildResult
|
||||||
} catch (t: Throwable) {
|
): BuildResult = try {
|
||||||
println("<=== Test build: ${projectName} ===>")
|
run()
|
||||||
println("<=== Using Gradle version: ${gradleVersion.version} ===>")
|
} catch (t: Throwable) {
|
||||||
println("<=== Run arguments: ${buildArguments.joinToString()} ===>")
|
println("<=== Test build: $projectName ===>")
|
||||||
println("<=== Project path: ${projectPath.toAbsolutePath()} ===>")
|
println("<=== Using Gradle version: ${gradleVersion.version} ===>")
|
||||||
throw t
|
println("<=== Run arguments: ${buildArguments.joinToString()} ===>")
|
||||||
}
|
println("<=== Project path: ${projectPath.toAbsolutePath()} ===>")
|
||||||
|
throw t
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user