KT-57224: Add kotlin language version to file report
This commit is contained in:
committed by
Space Team
parent
3deea96b53
commit
f87fdb43fa
+6
@@ -278,6 +278,12 @@ class FileReportService(
|
|||||||
p.println("Task '${statisticsData.taskName}' finished in ${formatTime(statisticsData.durationMs)}")
|
p.println("Task '${statisticsData.taskName}' finished in ${formatTime(statisticsData.durationMs)}")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
statisticsData.kotlinLanguageVersion?.also {
|
||||||
|
p.withIndent("Task info:") {
|
||||||
|
p.println("Kotlin language version: $it")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (statisticsData.icLogLines.isNotEmpty()) {
|
if (statisticsData.icLogLines.isNotEmpty()) {
|
||||||
p.withIndent("Compilation log for task '${statisticsData.taskName}':") {
|
p.withIndent("Compilation log for task '${statisticsData.taskName}':") {
|
||||||
statisticsData.icLogLines.forEach { p.println(it) }
|
statisticsData.icLogLines.forEach { p.println(it) }
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ dependencies {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
testImplementation(project(":kotlin-gradle-compiler-types"))
|
||||||
testImplementation(project(":kotlin-gradle-plugin-idea"))
|
testImplementation(project(":kotlin-gradle-plugin-idea"))
|
||||||
testImplementation(testFixtures(project(":kotlin-gradle-plugin-idea")))
|
testImplementation(testFixtures(project(":kotlin-gradle-plugin-idea")))
|
||||||
testImplementation(project(":kotlin-gradle-plugin-idea-proto"))
|
testImplementation(project(":kotlin-gradle-plugin-idea-proto"))
|
||||||
|
|||||||
+58
-18
@@ -15,6 +15,7 @@ import java.io.ObjectInputStream
|
|||||||
import java.nio.file.Path
|
import java.nio.file.Path
|
||||||
import kotlin.io.path.*
|
import kotlin.io.path.*
|
||||||
import kotlin.test.assertTrue
|
import kotlin.test.assertTrue
|
||||||
|
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||||
|
|
||||||
@DisplayName("Build reports")
|
@DisplayName("Build reports")
|
||||||
@JvmGradlePluginTests
|
@JvmGradlePluginTests
|
||||||
@@ -54,28 +55,67 @@ class BuildReportsIT : KGPBaseTest() {
|
|||||||
@DisplayName("Build metrics produces valid report")
|
@DisplayName("Build metrics produces valid report")
|
||||||
@GradleTest
|
@GradleTest
|
||||||
fun testBuildMetricsSmokeTest(gradleVersion: GradleVersion) {
|
fun testBuildMetricsSmokeTest(gradleVersion: GradleVersion) {
|
||||||
project("simpleProject", gradleVersion) {
|
testBuildReportInFile("simpleProject", "assemble", gradleVersion)
|
||||||
build("assemble") {
|
}
|
||||||
|
|
||||||
|
@DisplayName("Build metrics produces valid report for mpp-jvm")
|
||||||
|
@GradleTest
|
||||||
|
fun testBuildMetricsForMppJvm(gradleVersion: GradleVersion) {
|
||||||
|
testBuildReportInFile("mppJvmWithJava", "assemble", gradleVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("Build metrics produces valid report for mpp-js")
|
||||||
|
@GradleTest
|
||||||
|
fun testBuildMetricsForMppJs(gradleVersion: GradleVersion) {
|
||||||
|
testBuildReportInFile("kotlin-js-package-module-name", "assemble", gradleVersion)
|
||||||
|
}
|
||||||
|
|
||||||
|
@DisplayName("Build metrics produces valid report for JS project")
|
||||||
|
@GradleTest
|
||||||
|
fun testBuildMetricsForJsProject(gradleVersion: GradleVersion) {
|
||||||
|
testBuildReportInFile("kotlin-js-plugin-project", "compileKotlinJs", gradleVersion,
|
||||||
|
languageVersion = KotlinVersion.KOTLIN_1_7.version)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun testBuildReportInFile(project: String, task: String, gradleVersion: GradleVersion,
|
||||||
|
languageVersion: String = KotlinVersion.KOTLIN_2_0.version) {
|
||||||
|
project(project, gradleVersion) {
|
||||||
|
build(task) {
|
||||||
assertBuildReportPathIsPrinted()
|
assertBuildReportPathIsPrinted()
|
||||||
}
|
}
|
||||||
//Should contains build metrics for all compile kotlin tasks
|
//Should contains build metrics for all compile kotlin tasks
|
||||||
assertFileContains(
|
validateBuildReportFile(KotlinVersion.DEFAULT.version)
|
||||||
reportFile,
|
|
||||||
"Time metrics:",
|
|
||||||
"Run compilation:",
|
|
||||||
"Incremental compilation in daemon:",
|
|
||||||
"Size metrics:",
|
|
||||||
"Total size of the cache directory:",
|
|
||||||
"Total compiler iteration:",
|
|
||||||
"ABI snapshot size:",
|
|
||||||
//for non-incremental builds
|
|
||||||
"Build attributes:",
|
|
||||||
"REBUILD_REASON:",
|
|
||||||
//gc metrics
|
|
||||||
"GC count:",
|
|
||||||
"GC time:",
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
project(project, gradleVersion, buildOptions = defaultBuildOptions.copy(languageVersion = languageVersion)) {
|
||||||
|
build(task, buildOptions = buildOptions.copy(languageVersion = languageVersion)) {
|
||||||
|
assertBuildReportPathIsPrinted()
|
||||||
|
}
|
||||||
|
//Should contains build metrics for all compile kotlin tasks
|
||||||
|
validateBuildReportFile(languageVersion)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun TestProject.validateBuildReportFile(kotlinLanguageVersion: String) {
|
||||||
|
assertFileContains(
|
||||||
|
reportFile,
|
||||||
|
"Time metrics:",
|
||||||
|
"Run compilation:",
|
||||||
|
"Incremental compilation in daemon:",
|
||||||
|
"Size metrics:",
|
||||||
|
"Total size of the cache directory:",
|
||||||
|
"Total compiler iteration:",
|
||||||
|
"ABI snapshot size:",
|
||||||
|
//for non-incremental builds
|
||||||
|
"Build attributes:",
|
||||||
|
"REBUILD_REASON:",
|
||||||
|
//gc metrics
|
||||||
|
"GC count:",
|
||||||
|
"GC time:",
|
||||||
|
//task info
|
||||||
|
"Task info:",
|
||||||
|
"Kotlin language version: $kotlinLanguageVersion",
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@DisplayName("Compiler build metrics report is produced")
|
@DisplayName("Compiler build metrics report is produced")
|
||||||
|
|||||||
+1
@@ -565,6 +565,7 @@ internal fun Path.enableAndroidSdk() {
|
|||||||
applyAndroidTestFixes()
|
applyAndroidTestFixes()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
internal fun Path.enableCacheRedirector() {
|
internal fun Path.enableCacheRedirector() {
|
||||||
// Path relative to the current gradle module project dir
|
// Path relative to the current gradle module project dir
|
||||||
val redirectorScript = Paths.get("../../../repo/scripts/cache-redirector.settings.gradle.kts")
|
val redirectorScript = Paths.get("../../../repo/scripts/cache-redirector.settings.gradle.kts")
|
||||||
|
|||||||
Reference in New Issue
Block a user