Remove old build report properties
kotlin.build.report.dir and kotlin.internal.single.build.metrics.file were deleted #KT-64380
This commit is contained in:
committed by
Space Team
parent
a7f57710e2
commit
485840731d
+23
-7
@@ -26,12 +26,12 @@ import kotlin.test.assertTrue
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildExecutionData
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildOperationRecord
|
||||
import org.jetbrains.kotlin.gradle.plugin.diagnostics.KotlinToolingDiagnostics
|
||||
import org.jetbrains.kotlin.gradle.testbase.TestVersions.ThirdPartyDependencies.GRADLE_ENTERPRISE_PLUGIN_VERSION
|
||||
import java.lang.reflect.Type
|
||||
import java.nio.file.Files
|
||||
import kotlin.streams.asSequence
|
||||
import kotlin.test.assertEquals
|
||||
import kotlin.test.assertNotNull
|
||||
|
||||
@DisplayName("Build reports")
|
||||
@JvmGradlePluginTests
|
||||
@@ -248,21 +248,37 @@ class BuildReportsIT : KGPBaseTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("deprecated property")
|
||||
@DisplayName("single build report output")
|
||||
@GradleTestVersions(
|
||||
additionalVersions = [TestVersions.Gradle.G_7_6, TestVersions.Gradle.G_8_0],
|
||||
)
|
||||
@GradleTest
|
||||
fun testDeprecatedAndNewSingleBuildMetricsFile(gradleVersion: GradleVersion) {
|
||||
fun testSingleBuildMetricsFile(gradleVersion: GradleVersion) {
|
||||
project("simpleProject", gradleVersion) {
|
||||
val newMetricsPath = projectPath.resolve("metrics.bin")
|
||||
val deprecatedMetricsPath = projectPath.resolve("deprecated_metrics.bin")
|
||||
build(
|
||||
"compileKotlin", "-Pkotlin.build.report.single_file=${newMetricsPath.pathString}",
|
||||
"-Pkotlin.internal.single.build.metrics.file=${deprecatedMetricsPath.pathString}"
|
||||
"-Pkotlin.build.report.output=single_file"
|
||||
)
|
||||
assertTrue { deprecatedMetricsPath.exists() }
|
||||
assertTrue { newMetricsPath.notExists() }
|
||||
assertTrue { newMetricsPath.exists() }
|
||||
}
|
||||
}
|
||||
|
||||
@DisplayName("deprecated properties")
|
||||
@GradleTestVersions(
|
||||
additionalVersions = [TestVersions.Gradle.G_7_6, TestVersions.Gradle.G_8_0],
|
||||
)
|
||||
@GradleTest
|
||||
fun testDeprecatedReportProperties(gradleVersion: GradleVersion) {
|
||||
project("simpleProject", gradleVersion) {
|
||||
val deprecatedMetricsPath = projectPath.resolve("deprecated_metrics.bin")
|
||||
build(
|
||||
"compileKotlin", "-Pkotlin.build.report.dir=${projectPath.resolve("reports").pathString}",
|
||||
"-Pkotlin.internal.single.build.metrics.file=${projectPath.resolve("deprecated_metrics.bin").pathString}"
|
||||
) {
|
||||
assertHasDiagnostic(KotlinToolingDiagnostics.DeprecatedGradleProperties, "kotlin.internal.single.build.metrics.file")
|
||||
assertHasDiagnostic(KotlinToolingDiagnostics.DeprecatedGradleProperties, "kotlin.build.report.dir")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-9
@@ -67,11 +67,6 @@ import org.jetbrains.kotlin.util.prefixIfNot
|
||||
import java.io.File
|
||||
|
||||
internal class PropertiesProvider private constructor(private val project: Project) {
|
||||
|
||||
@Deprecated(message = "Please use kotlin.build.report.output=SINGLE_FILE and kotlin.build.report.single_file ")
|
||||
val singleBuildMetricsFile: File?
|
||||
get() = property("kotlin.internal.single.build.metrics.file").orNull?.let { File(it) }
|
||||
|
||||
val buildReportSingleFile: File?
|
||||
get() = property(PropertyNames.KOTLIN_BUILD_REPORT_SINGLE_FILE).orNull?.let { File(it) }
|
||||
|
||||
@@ -117,10 +112,6 @@ internal class PropertiesProvider private constructor(private val project: Proje
|
||||
val buildReportVerbose: Boolean
|
||||
get() = booleanProperty("kotlin.build.report.verbose") ?: false
|
||||
|
||||
@Deprecated("Please use \"kotlin.build.report.file.output_dir\" property instead")
|
||||
val buildReportDir: File?
|
||||
get() = property("kotlin.build.report.dir").orNull?.let { File(it) }
|
||||
|
||||
val incrementalJvm: Boolean?
|
||||
get() = booleanProperty("kotlin.incremental")
|
||||
|
||||
|
||||
+3
-2
@@ -810,10 +810,11 @@ object KotlinToolingDiagnostics {
|
||||
}
|
||||
|
||||
object DeprecatedGradleProperties : ToolingDiagnosticFactory(WARNING) {
|
||||
operator fun invoke(usedDeprecatedProperties: List<String>): ToolingDiagnostic {
|
||||
operator fun invoke(usedDeprecatedProperty: String): ToolingDiagnostic {
|
||||
return build(
|
||||
"""
|
||||
$usedDeprecatedProperties properties were deprecated and are not supported anymore. Please, delete them from project properties.
|
||||
|The `$usedDeprecatedProperty` deprecated property is used in your build.
|
||||
|Please, stop using it as it is unsupported and may apply no effect to your build.
|
||||
""".trimMargin()
|
||||
)
|
||||
}
|
||||
|
||||
+3
-2
@@ -25,10 +25,11 @@ internal object GradleDeprecatedPropertyChecker : KotlinGradleProjectChecker {
|
||||
|
||||
val usedDeprecatedProperties = deprecatedProperties.filter { propertiesBuildService.get(it, project) != null }
|
||||
|
||||
if (usedDeprecatedProperties.isNotEmpty()) {
|
||||
usedDeprecatedProperties.forEach {
|
||||
collector.reportOncePerGradleBuild(
|
||||
project,
|
||||
KotlinToolingDiagnostics.DeprecatedGradleProperties(usedDeprecatedProperties)
|
||||
KotlinToolingDiagnostics.DeprecatedGradleProperties(it),
|
||||
it
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-5
@@ -84,10 +84,6 @@ internal fun reportingSettings(project: Project): ReportingSettings {
|
||||
?: throw IllegalStateException("Can't configure json report: '$KOTLIN_BUILD_REPORT_JSON_DIR' property is mandatory")
|
||||
} else null
|
||||
|
||||
//temporary solution. support old property
|
||||
@Suppress("DEPRECATION")
|
||||
val oldSingleBuildMetric = properties.singleBuildMetricsFile?.also { buildReportOutputTypes.add(BuildReportType.SINGLE_FILE) }
|
||||
|
||||
return ReportingSettings(
|
||||
buildReportMode = buildReportMode,
|
||||
buildReportLabel = properties.buildReportLabel,
|
||||
@@ -95,7 +91,7 @@ internal fun reportingSettings(project: Project): ReportingSettings {
|
||||
httpReportSettings = httpReportSettings,
|
||||
buildScanReportSettings = buildScanSettings,
|
||||
buildReportOutputs = buildReportOutputTypes,
|
||||
singleOutputFile = singleOutputFile ?: oldSingleBuildMetric,
|
||||
singleOutputFile = singleOutputFile,
|
||||
jsonOutputDir = jsonReportDir,
|
||||
includeCompilerArguments = properties.buildReportIncludeCompilerArguments,
|
||||
experimentalTryNextConsoleOutput = experimentalTryNextEnabled
|
||||
|
||||
Reference in New Issue
Block a user