Move kotlin-build-statistic project to :compiler
This commit is contained in:
committed by
Space Team
parent
e34dd043da
commit
2a391f7330
@@ -19,14 +19,14 @@ dependencies {
|
||||
compileOnly(intellijCore())
|
||||
compileOnly(commonDependency("org.jetbrains.intellij.deps:asm-all"))
|
||||
compileOnly(commonDependency("org.jetbrains.intellij.deps:trove4j"))
|
||||
compileOnly(project(":kotlin-build-statistic"))
|
||||
compileOnly(project(":compiler:build-tools:kotlin-build-statistics"))
|
||||
|
||||
testCompileOnly(project(":compiler:cli-common"))
|
||||
testApi(projectTests(":compiler:tests-common"))
|
||||
testApi(commonDependency("junit:junit"))
|
||||
testApi(protobufFull())
|
||||
testApi(kotlinStdlib())
|
||||
testImplementation(project(":kotlin-build-statistic"))
|
||||
testImplementation(project(":compiler:build-tools:kotlin-build-statistics"))
|
||||
testImplementation(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
testImplementation("org.reflections:reflections:0.10.2")
|
||||
}
|
||||
|
||||
+2
-2
@@ -143,7 +143,7 @@ val commonCompilerModules = arrayOf(
|
||||
":analysis:project-structure",
|
||||
":analysis:kt-references",
|
||||
":kotlin-build-common",
|
||||
":kotlin-build-statistic",
|
||||
":compiler:build-tools:kotlin-build-statistics",
|
||||
).also { extra["commonCompilerModules"] = it }
|
||||
|
||||
val firCompilerCoreModules = arrayOf(
|
||||
@@ -264,7 +264,7 @@ extra["kotlinJpsPluginMavenDependencies"] = listOf(
|
||||
":kotlin-util-klib",
|
||||
":kotlin-util-klib-metadata",
|
||||
":native:kotlin-native-utils",
|
||||
":kotlin-build-statistic",
|
||||
":compiler:build-tools:kotlin-build-statistics",
|
||||
)
|
||||
|
||||
extra["kotlinJpsPluginMavenDependenciesNonTransitiveLibs"] = listOf(
|
||||
|
||||
@@ -81,7 +81,6 @@ val kotlinGradlePluginAndItsRequired = arrayOf(
|
||||
":native:kotlin-klib-commonizer-api",
|
||||
":compiler:build-tools:kotlin-build-tools-api",
|
||||
":compiler:build-tools:kotlin-build-tools-impl",
|
||||
":compiler:kotlin-build-statistic"
|
||||
)
|
||||
|
||||
fun Task.dependsOnKotlinGradlePluginInstall() {
|
||||
|
||||
+1
-20
@@ -25,23 +25,4 @@ sourceSets {
|
||||
"test" { projectDefault() }
|
||||
}
|
||||
|
||||
publish()
|
||||
|
||||
runtimeJar()
|
||||
sourcesJar()
|
||||
javadocJar()
|
||||
|
||||
testsJar()
|
||||
|
||||
projectTest(parallel = true)
|
||||
|
||||
projectTest("testJUnit5", jUnitMode = JUnitMode.JUnit5, parallel = true) {
|
||||
useJUnitPlatform()
|
||||
}
|
||||
|
||||
// 1.9 level breaks Kotlin Gradle plugins via changes in enums (KT-48872)
|
||||
// We limit api and LV until KGP will stop using Kotlin compiler directly (KT-56574)
|
||||
tasks.withType<KotlinCompilationTask<*>>().configureEach {
|
||||
compilerOptions.apiVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead()
|
||||
compilerOptions.languageVersion.value(GradleKotlinVersion.KOTLIN_1_8).finalizeValueOnRead()
|
||||
}
|
||||
projectTest(jUnitMode = JUnitMode.JUnit5, parallel = true)
|
||||
+7
-7
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic
|
||||
package org.jetbrains.kotlin.build.report.statistics
|
||||
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildAttribute
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildPerformanceMetric
|
||||
@@ -66,18 +66,18 @@ enum class BuildDataType {
|
||||
}
|
||||
|
||||
//Sensitive data. This object is used directly for statistic via http
|
||||
data class GradleBuildStartParameters(
|
||||
data class BuildStartParameters(
|
||||
val tasks: List<String>,
|
||||
val excludedTasks: Set<String>,
|
||||
val currentDir: String?,
|
||||
val projectProperties: List<String>,
|
||||
val systemProperties: List<String>,
|
||||
val excludedTasks: Set<String> = emptySet(),
|
||||
val currentDir: String? = null,
|
||||
val projectProperties: List<String> = emptyList(),
|
||||
val systemProperties: List<String> = emptyList(),
|
||||
) : java.io.Serializable
|
||||
|
||||
//Sensitive data. This object is used directly for statistic via http
|
||||
data class BuildFinishStatisticsData(
|
||||
val projectName: String,
|
||||
val startParameters: GradleBuildStartParameters,
|
||||
val startParameters: BuildStartParameters,
|
||||
val buildUuid: String = "Unset",
|
||||
val label: String?,
|
||||
val totalTime: Long,
|
||||
+12
-14
@@ -3,10 +3,10 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic
|
||||
package org.jetbrains.kotlin.build.report.statistics
|
||||
|
||||
import com.google.gson.Gson
|
||||
import org.jetbrains.kotlin.util.Logger
|
||||
import org.jetbrains.kotlin.compilerRunner.KotlinLogger
|
||||
import java.io.IOException
|
||||
import java.io.Serializable
|
||||
import java.net.HttpURLConnection
|
||||
@@ -14,31 +14,29 @@ import java.net.URL
|
||||
import java.util.*
|
||||
import kotlin.system.measureTimeMillis
|
||||
|
||||
interface HttpReportService {
|
||||
fun sendData(data: Any, log: Logger)
|
||||
}
|
||||
|
||||
class HttpReportServiceImpl(
|
||||
class HttpReportService(
|
||||
private val url: String,
|
||||
private val password: String?,
|
||||
private val user: String?,
|
||||
) : HttpReportService, Serializable {
|
||||
) : Serializable {
|
||||
|
||||
private var invalidUrl = false
|
||||
private var requestPreviousFailed = false
|
||||
|
||||
private fun checkResponseAndLog(connection: HttpURLConnection, log: Logger) {
|
||||
private fun checkResponseAndLog(connection: HttpURLConnection, log: KotlinLogger) {
|
||||
val isResponseBad = connection.responseCode !in 200..299
|
||||
if (isResponseBad) {
|
||||
val message = "Failed to send statistic to ${connection.url} with ${connection.responseCode}: ${connection.responseMessage}"
|
||||
if (!requestPreviousFailed) {
|
||||
log.warning(message)
|
||||
log.warn(message)
|
||||
} else {
|
||||
log.debug(message)
|
||||
}
|
||||
requestPreviousFailed = true
|
||||
}
|
||||
}
|
||||
|
||||
override fun sendData(data: Any, log: Logger) {
|
||||
fun sendData(data: Any, log: KotlinLogger) {
|
||||
val elapsedTime = measureTimeMillis {
|
||||
if (invalidUrl) {
|
||||
return
|
||||
@@ -46,7 +44,7 @@ class HttpReportServiceImpl(
|
||||
val connection = try {
|
||||
URL(url).openConnection() as HttpURLConnection
|
||||
} catch (e: IOException) {
|
||||
log.warning("Unable to open connection to ${url}: ${e.message}")
|
||||
log.warn("Unable to open connection to ${url}: ${e.message}")
|
||||
invalidUrl = true
|
||||
return
|
||||
}
|
||||
@@ -67,12 +65,12 @@ class HttpReportServiceImpl(
|
||||
connection.connect()
|
||||
checkResponseAndLog(connection, log)
|
||||
} catch (e: Exception) {
|
||||
log.warning("Unexpected exception happened ${e.message}: ${e.stackTrace}")
|
||||
log.warn("Unexpected exception happened ${e.message}: ${e.stackTrace}")
|
||||
checkResponseAndLog(connection, log)
|
||||
} finally {
|
||||
connection.disconnect()
|
||||
}
|
||||
}
|
||||
log.log("Report statistic by http takes $elapsedTime ms")
|
||||
log.debug("Report statistic by http takes $elapsedTime ms")
|
||||
}
|
||||
}
|
||||
+12
-14
@@ -3,15 +3,13 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic.file
|
||||
package org.jetbrains.kotlin.build.report.statistics.file
|
||||
|
||||
import org.jetbrains.kotlin.build.report.metrics.*
|
||||
import org.jetbrains.kotlin.build.report.statistic.asString
|
||||
import org.jetbrains.kotlin.build.report.statistic.formatSize
|
||||
import org.jetbrains.kotlin.build.report.statistic.formatTime
|
||||
import org.jetbrains.kotlin.build.report.statistic.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistic.GradleBuildStartParameters
|
||||
import org.jetbrains.kotlin.util.Logger
|
||||
import org.jetbrains.kotlin.build.report.statistics.*
|
||||
import org.jetbrains.kotlin.build.report.statistics.asString
|
||||
import org.jetbrains.kotlin.build.report.statistics.formatTime
|
||||
import org.jetbrains.kotlin.compilerRunner.KotlinLogger
|
||||
import java.io.File
|
||||
import java.io.Serializable
|
||||
import java.text.SimpleDateFormat
|
||||
@@ -20,7 +18,7 @@ import java.util.*
|
||||
class FileReportService(
|
||||
private val outputFile: File,
|
||||
private val printMetrics: Boolean,
|
||||
private val logger: Logger
|
||||
private val logger: KotlinLogger
|
||||
) : Serializable {
|
||||
companion object {
|
||||
private val formatter = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss").also { it.timeZone = TimeZone.getTimeZone("UTC")}
|
||||
@@ -29,9 +27,9 @@ class FileReportService(
|
||||
projectName: String,
|
||||
includeMetricsInReport: Boolean,
|
||||
buildData: List<CompileStatisticsData>,
|
||||
startParameters: GradleBuildStartParameters,
|
||||
startParameters: BuildStartParameters,
|
||||
failureMessages: List<String>,
|
||||
logger: Logger
|
||||
logger: KotlinLogger
|
||||
) {
|
||||
val ts = SimpleDateFormat("yyyy-MM-dd-HH-mm-ss").format(Calendar.getInstance().time)
|
||||
val reportFile = buildReportDir.resolve("$projectName-build-$ts.txt")
|
||||
@@ -48,8 +46,8 @@ class FileReportService(
|
||||
|
||||
fun process(
|
||||
statisticsData: List<CompileStatisticsData>,
|
||||
startParameters: GradleBuildStartParameters,
|
||||
failureMessages: List<String>
|
||||
startParameters: BuildStartParameters,
|
||||
failureMessages: List<String> = emptyList()
|
||||
) {
|
||||
val buildReportPath = outputFile.toPath().toUri().toString()
|
||||
try {
|
||||
@@ -72,7 +70,7 @@ class FileReportService(
|
||||
|
||||
private fun printBuildReport(
|
||||
statisticsData: List<CompileStatisticsData>,
|
||||
startParameters: GradleBuildStartParameters,
|
||||
startParameters: BuildStartParameters,
|
||||
failureMessages: List<String>
|
||||
) {
|
||||
// NOTE: BuildExecutionData / BuildOperationRecord contains data for both tasks and transforms.
|
||||
@@ -97,7 +95,7 @@ class FileReportService(
|
||||
printTasksLog(statisticsData)
|
||||
}
|
||||
|
||||
private fun printBuildInfo(startParameters: GradleBuildStartParameters, failureMessages: List<String>) {
|
||||
private fun printBuildInfo(startParameters: BuildStartParameters, failureMessages: List<String>) {
|
||||
p.withIndent("Gradle start parameters:") {
|
||||
startParameters.let {
|
||||
p.println("tasks = ${it.tasks}")
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic.file
|
||||
package org.jetbrains.kotlin.build.report.statistics.file
|
||||
|
||||
import java.util.*
|
||||
import kotlin.math.max
|
||||
+1
-1
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic.file
|
||||
package org.jetbrains.kotlin.build.report.statistics.file
|
||||
|
||||
import java.io.IOException
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.build.report.statistic
|
||||
package org.jetbrains.kotlin.build.report.statistics
|
||||
|
||||
internal fun formatTime(ms: Long): String {
|
||||
val seconds = ms.toDouble() / 1_000
|
||||
@@ -14,7 +14,7 @@ private const val kbSize = 1024
|
||||
private const val mbSize = kbSize * 1024
|
||||
private const val gbSize = mbSize * 1024
|
||||
|
||||
public fun formatSize(sizeInBytes: Long): String = when {
|
||||
fun formatSize(sizeInBytes: Long): String = when {
|
||||
sizeInBytes / gbSize >= 1 -> "${(sizeInBytes.toDouble() / gbSize).asString(1)} GB"
|
||||
sizeInBytes / mbSize >= 1 -> "${(sizeInBytes.toDouble() / mbSize).asString(1)} MB"
|
||||
sizeInBytes / kbSize >= 1 -> "${(sizeInBytes.toDouble() / kbSize).asString(1)} KB"
|
||||
@@ -26,12 +26,7 @@ import org.jetbrains.kotlin.name.FqName
|
||||
import org.jetbrains.kotlin.name.isSubpackageOf
|
||||
import org.jetbrains.kotlin.psi.KtFile
|
||||
import org.jetbrains.kotlin.util.Logger
|
||||
import org.jetbrains.kotlin.utils.KotlinPaths
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.util.zip.ZipEntry
|
||||
import java.util.zip.ZipFile
|
||||
import java.util.zip.ZipOutputStream
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
fun incrementalCompilationIsEnabled(arguments: CommonCompilerArguments): Boolean {
|
||||
@@ -87,7 +82,7 @@ fun <PathProvider : Any> getLibraryFromHome(
|
||||
|
||||
fun MessageCollector.toLogger(): Logger =
|
||||
object : Logger {
|
||||
override fun error(message: String, throwable: Throwable?) {
|
||||
override fun error(message: String) {
|
||||
report(CompilerMessageSeverity.ERROR, message)
|
||||
}
|
||||
|
||||
@@ -103,9 +98,5 @@ fun MessageCollector.toLogger(): Logger =
|
||||
override fun log(message: String) {
|
||||
report(CompilerMessageSeverity.LOGGING, message)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) {
|
||||
report(CompilerMessageSeverity.INFO, message)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ dependencies {
|
||||
api(project(":compiler:backend.jvm.entrypoint"))
|
||||
api(project(":kotlin-build-common"))
|
||||
api(project(":daemon-common"))
|
||||
api(project(":kotlin-build-statistic"))
|
||||
api(project(":compiler:build-tools:kotlin-build-statistics"))
|
||||
compileOnly(intellijCore())
|
||||
|
||||
testApi(commonDependency("junit:junit"))
|
||||
@@ -29,7 +29,6 @@ dependencies {
|
||||
testApi(intellijCore())
|
||||
testApi(commonDependency("org.jetbrains.intellij.deps:log4j"))
|
||||
testApi(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
||||
testApi(projectTests(":kotlin-build-statistic"))
|
||||
|
||||
testImplementation(commonDependency("com.google.code.gson:gson"))
|
||||
testRuntimeOnly(commonDependency("org.jetbrains.kotlin:kotlin-reflect")) { isTransitive = false }
|
||||
|
||||
@@ -106,9 +106,8 @@ val CompilerConfiguration.resolverLogger: Logger
|
||||
null -> DummyLogger
|
||||
else -> object : Logger {
|
||||
override fun log(message: String) = messageLogger.report(IrMessageLogger.Severity.INFO, message, null)
|
||||
override fun error(message: String, throwable: Throwable?) = messageLogger.report(IrMessageLogger.Severity.ERROR, message, null)
|
||||
override fun error(message: String) = messageLogger.report(IrMessageLogger.Severity.ERROR, message, null)
|
||||
override fun warning(message: String) = messageLogger.report(IrMessageLogger.Severity.WARNING, message, null)
|
||||
override fun lifecycle(message: String) = messageLogger.report(IrMessageLogger.Severity.INFO, message, null)
|
||||
|
||||
override fun fatal(message: String): Nothing {
|
||||
messageLogger.report(IrMessageLogger.Severity.ERROR, message, null)
|
||||
|
||||
@@ -175,9 +175,8 @@ object GenerationUtils {
|
||||
|
||||
fun messageCollectorLogger(collector: MessageCollector) = object : Logger {
|
||||
override fun warning(message: String) = collector.report(CompilerMessageSeverity.STRONG_WARNING, message)
|
||||
override fun error(message: String, throwable: Throwable?) = collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
override fun error(message: String) = collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
override fun log(message: String) = collector.report(CompilerMessageSeverity.LOGGING, message)
|
||||
override fun lifecycle(message: String) = collector.report(CompilerMessageSeverity.INFO, message)
|
||||
override fun fatal(message: String): Nothing {
|
||||
collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
(collector as? GroupingMessageCollector)?.flush()
|
||||
|
||||
@@ -4,10 +4,9 @@ import kotlin.system.exitProcess
|
||||
|
||||
interface Logger {
|
||||
fun log(message: String)
|
||||
fun error(message: String, throwable: Throwable? = null)
|
||||
fun error(message: String)
|
||||
fun warning(message: String)
|
||||
fun fatal(message: String): Nothing
|
||||
fun lifecycle(message: String)
|
||||
}
|
||||
|
||||
interface WithLogger {
|
||||
@@ -16,18 +15,10 @@ interface WithLogger {
|
||||
|
||||
object DummyLogger : Logger {
|
||||
override fun log(message: String) = println(message)
|
||||
override fun error(message: String, throwable: Throwable?) {
|
||||
println("e: $message")
|
||||
throwable?.also {
|
||||
println("${it.message}:\n${it.stackTraceToString()} ")
|
||||
}
|
||||
}
|
||||
|
||||
override fun error(message: String) = println("e: $message")
|
||||
override fun warning(message: String) = println("w: $message")
|
||||
override fun fatal(message: String): Nothing {
|
||||
println("e: $message")
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) = println("i: $message")
|
||||
}
|
||||
|
||||
@@ -16,10 +16,9 @@ fun resolveSingleFileKlib(
|
||||
libraryFile: File,
|
||||
logger: Logger = object : Logger {
|
||||
override fun log(message: String) {}
|
||||
override fun error(message: String, throwable: Throwable?) = kotlin.error("e: $message")
|
||||
override fun error(message: String) = kotlin.error("e: $message")
|
||||
override fun warning(message: String) {}
|
||||
override fun fatal(message: String) = kotlin.error("e: $message")
|
||||
override fun lifecycle(message: String) {}
|
||||
},
|
||||
strategy: SingleFileKlibResolveStrategy = CompilerSingleFileKlibResolveStrategy
|
||||
): KotlinLibrary = strategy.resolve(libraryFile, logger)
|
||||
|
||||
+4
-3
@@ -1,14 +1,15 @@
|
||||
/*
|
||||
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.compilerRunner
|
||||
|
||||
interface KotlinLogger {
|
||||
fun error(msg: String)
|
||||
val isDebugEnabled: Boolean
|
||||
fun error(msg: String, throwable: Throwable? = null)
|
||||
fun warn(msg: String)
|
||||
fun info(msg: String)
|
||||
fun debug(msg: String)
|
||||
val isDebugEnabled: Boolean
|
||||
fun lifecycle(msg: String)
|
||||
}
|
||||
@@ -17,10 +17,9 @@
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-annotation-processing-embeddable" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-annotation-processing-gradle" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-common" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-tools-enum-compat" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-tools-api" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-tools-enum-compat" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-tools-impl" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-build-statistic" version="1.9.0.*" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-compiler-embeddable" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-compiler-runner" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-daemon-client" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
@@ -46,8 +45,6 @@
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-scripting-jvm" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-serialization" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-serialization-unshaded" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin-embeddable" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-stdlib" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-stdlib-common" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-stdlib-jdk7" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
@@ -64,6 +61,8 @@
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-tooling-metadata" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-util-io" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlin-util-klib" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
<trust group="org.jetbrains.kotlin" name="kotlinx-serialization-compiler-plugin-embeddable" version="1.9.[0-9](-.+)?" regex="true"/>
|
||||
</trusted-artifacts>
|
||||
</configuration>
|
||||
<components>
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.jetbrains.kotlin.compilerRunner
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
|
||||
internal class JpsKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
override fun error(msg: String) {
|
||||
log.error(msg)
|
||||
override fun error(msg: String, throwable: Throwable?) {
|
||||
log.error(msg, throwable)
|
||||
}
|
||||
|
||||
override fun warn(msg: String) {
|
||||
@@ -35,6 +35,10 @@ internal class JpsKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
log.debug(msg)
|
||||
}
|
||||
|
||||
override fun lifecycle(msg: String) {
|
||||
log.info(msg)
|
||||
}
|
||||
|
||||
override val isDebugEnabled: Boolean
|
||||
get() = log.isDebugEnabled
|
||||
}
|
||||
@@ -42,7 +42,7 @@ import org.jetbrains.kotlin.jps.KotlinJpsBundle
|
||||
import org.jetbrains.kotlin.jps.incremental.JpsIncrementalCache
|
||||
import org.jetbrains.kotlin.jps.incremental.JpsLookupStorageManager
|
||||
import org.jetbrains.kotlin.jps.model.kotlinKind
|
||||
import org.jetbrains.kotlin.jps.statistic.KotlinBuilderReportService
|
||||
import org.jetbrains.kotlin.jps.statistic.JpsStatisticsReportService
|
||||
import org.jetbrains.kotlin.jps.targets.KotlinJvmModuleBuildTarget
|
||||
import org.jetbrains.kotlin.jps.targets.KotlinModuleBuildTarget
|
||||
import org.jetbrains.kotlin.load.kotlin.header.KotlinClassHeader
|
||||
@@ -68,7 +68,7 @@ class KotlinBuilder : ModuleLevelBuilder(BuilderCategory.SOURCE_PROCESSOR) {
|
||||
System.getProperty("kotlin.jps.classesToLoadByParent")?.split(',')?.map { it.trim() } ?: emptyList()
|
||||
private val classPrefixesToLoadByParentFromRegistry =
|
||||
System.getProperty("kotlin.jps.classPrefixesToLoadByParent")?.split(',')?.map { it.trim() } ?: emptyList()
|
||||
private val reportService = KotlinBuilderReportService()
|
||||
private val reportService = JpsStatisticsReportService()
|
||||
|
||||
val classesToLoadByParent: ClassCondition
|
||||
get() = ClassCondition { className ->
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.jps.statistic
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger
|
||||
|
||||
class JpsLoggerAdapter(private val log: Logger) : org.jetbrains.kotlin.util.Logger {
|
||||
|
||||
override fun log(message: String) {
|
||||
log.info(message)
|
||||
}
|
||||
|
||||
override fun warning(message: String) {
|
||||
log.warn(message)
|
||||
}
|
||||
|
||||
override fun fatal(message: String): Nothing {
|
||||
log.error(message)
|
||||
kotlin.error(message)
|
||||
}
|
||||
|
||||
override fun error(message: String, throwable: Throwable?) {
|
||||
log.error(message, throwable)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) {
|
||||
log.info(message)
|
||||
}
|
||||
}
|
||||
+24
-33
@@ -10,10 +10,9 @@ import org.jetbrains.jps.incremental.CompileContext
|
||||
import org.jetbrains.kotlin.build.report.FileReportSettings
|
||||
import org.jetbrains.kotlin.build.report.HttpReportSettings
|
||||
import org.jetbrains.kotlin.build.report.metrics.*
|
||||
import org.jetbrains.kotlin.build.report.statistic.BuildDataType
|
||||
import org.jetbrains.kotlin.build.report.statistic.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistic.HttpReportServiceImpl
|
||||
import org.jetbrains.kotlin.build.report.statistic.file.FileReportService
|
||||
import org.jetbrains.kotlin.build.report.statistics.*
|
||||
import org.jetbrains.kotlin.build.report.statistics.file.FileReportService
|
||||
import org.jetbrains.kotlin.compilerRunner.JpsKotlinLogger
|
||||
import java.io.File
|
||||
import java.util.*
|
||||
import java.net.InetAddress
|
||||
@@ -22,11 +21,11 @@ interface JpsBuilderMetricReporter : BuildMetricsReporter {
|
||||
fun flush(context: CompileContext): CompileStatisticsData
|
||||
}
|
||||
|
||||
//single thread execution
|
||||
private const val jpsBuildTaskName = "JPS build"
|
||||
|
||||
class JpsBuilderMetricReporterImpl(private val reporter: BuildMetricsReporterImpl) : JpsBuilderMetricReporter, BuildMetricsReporter by reporter {
|
||||
|
||||
companion object {
|
||||
private val log = Logger.getInstance("#org.jetbrains.kotlin.jps.statistic.KotlinBuilderMetricImpl")
|
||||
private val hostName: String? = try {
|
||||
InetAddress.getLocalHost().hostName
|
||||
} catch (_: Exception) {
|
||||
@@ -38,24 +37,24 @@ class JpsBuilderMetricReporterImpl(private val reporter: BuildMetricsReporterImp
|
||||
private val uuid = UUID.randomUUID()
|
||||
private val startTime = System.currentTimeMillis()
|
||||
|
||||
override fun flush(context: CompileContext/*, listener: BuildListener*/): CompileStatisticsData {
|
||||
override fun flush(context: CompileContext): CompileStatisticsData {
|
||||
val buildMetrics = reporter.getMetrics()
|
||||
return CompileStatisticsData(
|
||||
projectName = context.projectDescriptor.project.name,
|
||||
label = "JPS build", //TODO
|
||||
taskName = "JPS build",
|
||||
taskResult = "Unknown",//TODO
|
||||
label = "JPS build", //TODO will be updated in KT-58026
|
||||
taskName = jpsBuildTaskName,
|
||||
taskResult = "Unknown",//TODO will be updated in KT-58026
|
||||
startTimeMs = startTime,
|
||||
durationMs = System.currentTimeMillis() - startTime,
|
||||
tags = emptySet(),
|
||||
buildUuid = uuid.toString(),
|
||||
changes = emptyList(), //TODO
|
||||
kotlinVersion = "kotlin_version", //TODO
|
||||
changes = emptyList(), //TODO will be updated in KT-58026
|
||||
kotlinVersion = "kotlin_version", //TODO will be updated in KT-58026
|
||||
hostName = hostName,
|
||||
finishTime = System.currentTimeMillis(),
|
||||
buildTimesMetrics = buildMetrics.buildTimes.asMapMs(),
|
||||
performanceMetrics = buildMetrics.buildPerformanceMetrics.asMap(),
|
||||
compilerArguments = emptyList(), //TODO
|
||||
compilerArguments = emptyList(), //TODO will be updated in KT-58026
|
||||
nonIncrementalAttributes = emptySet(),
|
||||
type = BuildDataType.JPS_DATA.name,
|
||||
fromKotlinPlugin = true,
|
||||
@@ -71,14 +70,10 @@ class JpsBuilderMetricReporterImpl(private val reporter: BuildMetricsReporterImp
|
||||
}
|
||||
|
||||
// TODO test UserDataHolder in CompileContext to store CompileStatisticsData.Build or KotlinBuilderMetric
|
||||
class KotlinBuilderReportService(
|
||||
private val fileReportSettings: FileReportSettings?,
|
||||
private val httpReportSettings: HttpReportSettings?
|
||||
) {
|
||||
constructor() : this(
|
||||
initFileReportSettings(),
|
||||
initHttpReportSettings(),
|
||||
)
|
||||
class JpsStatisticsReportService {
|
||||
|
||||
private val fileReportSettings: FileReportSettings? = initFileReportSettings()
|
||||
private val httpReportSettings: HttpReportSettings? = initHttpReportSettings()
|
||||
|
||||
companion object {
|
||||
private fun initFileReportSettings(): FileReportSettings? {
|
||||
@@ -97,8 +92,8 @@ class KotlinBuilderReportService(
|
||||
|
||||
private val contextMetrics = HashMap<CompileContext, JpsBuilderMetricReporter>()
|
||||
private val log = Logger.getInstance("#org.jetbrains.kotlin.jps.statistic.KotlinBuilderReportService")
|
||||
private val loggerAdapter = JpsLoggerAdapter(log)
|
||||
private val httpService = httpReportSettings?.let { HttpReportServiceImpl(it.url, it.user, it.password) }
|
||||
private val loggerAdapter = JpsKotlinLogger(log)
|
||||
private val httpService = httpReportSettings?.let { HttpReportService(it.url, it.user, it.password) }
|
||||
fun buildStarted(context: CompileContext) {
|
||||
if (contextMetrics[context] != null) {
|
||||
log.error("Service already initialized for context")
|
||||
@@ -113,17 +108,13 @@ class KotlinBuilderReportService(
|
||||
return
|
||||
}
|
||||
|
||||
httpService?.sendData(metrics.flush(context), loggerAdapter)
|
||||
fileReportSettings?.also { FileReportService(it.buildReportDir, true, loggerAdapter) }
|
||||
}
|
||||
|
||||
fun addMetric(context: CompileContext, metric: BuildTime, value: Long) {
|
||||
val metrics = contextMetrics[context]
|
||||
if (metrics == null) {
|
||||
log.error("Service hasn't initialized for context")
|
||||
return
|
||||
val compileStatisticsData = metrics.flush(context)
|
||||
httpService?.sendData(compileStatisticsData, loggerAdapter)
|
||||
fileReportSettings?.also {
|
||||
FileReportService(it.buildReportDir, true, loggerAdapter)
|
||||
.process(listOf(compileStatisticsData),
|
||||
BuildStartParameters(tasks = listOf(jpsBuildTaskName)))
|
||||
}
|
||||
metrics.addTimeMetricNs(metric, value)
|
||||
}
|
||||
}
|
||||
|
||||
+1
-2
@@ -38,13 +38,12 @@ class KonanLibrariesResolveSupport(
|
||||
object : Logger {
|
||||
private val collector = configuration.getNotNull(CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY)
|
||||
override fun warning(message: String)= collector.report(CompilerMessageSeverity.STRONG_WARNING, message)
|
||||
override fun error(message: String, throwable: Throwable?) = collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
override fun error(message: String) = collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
override fun log(message: String) = collector.report(CompilerMessageSeverity.LOGGING, message)
|
||||
override fun fatal(message: String): Nothing {
|
||||
collector.report(CompilerMessageSeverity.ERROR, message)
|
||||
throw KonanCompilationException()
|
||||
}
|
||||
override fun lifecycle(message: String) =collector.report(CompilerMessageSeverity.LOGGING, message)
|
||||
}
|
||||
|
||||
private val resolver = defaultResolver(
|
||||
|
||||
@@ -88,10 +88,9 @@ fun error(text: String): Nothing {
|
||||
|
||||
object KlibToolLogger : Logger {
|
||||
override fun warning(message: String) = org.jetbrains.kotlin.cli.klib.warn(message)
|
||||
override fun error(message: String, throwable: Throwable?) = org.jetbrains.kotlin.cli.klib.warn(message)
|
||||
override fun error(message: String) = org.jetbrains.kotlin.cli.klib.warn(message)
|
||||
override fun fatal(message: String) = org.jetbrains.kotlin.cli.klib.error(message)
|
||||
override fun log(message: String) = println(message)
|
||||
override fun lifecycle(message: String) = println(message)
|
||||
}
|
||||
|
||||
val defaultRepository = File(DependencyProcessor.localKonanDir.resolve("klib").absolutePath)
|
||||
|
||||
@@ -74,7 +74,7 @@ dependencies {
|
||||
testImplementation(project(":kotlin-compiler-embeddable"))
|
||||
testImplementation(commonDependency("org.jetbrains.intellij.deps:jdom"))
|
||||
testImplementation(project(":compiler:cli-common"))
|
||||
testImplementation(project(":kotlin-build-statistic"))
|
||||
testImplementation(project(":compiler:build-tools:kotlin-build-statistics"))
|
||||
// testCompileOnly dependency on non-shaded artifacts is needed for IDE support
|
||||
// testRuntimeOnly on shaded artifact is needed for running tests with shaded compiler
|
||||
testCompileOnly(project(":kotlin-gradle-plugin-test-utils-embeddable"))
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ import io.ktor.server.netty.*
|
||||
import io.ktor.util.*
|
||||
import io.ktor.util.collections.*
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.kotlin.build.report.statistic.*
|
||||
import org.jetbrains.kotlin.build.report.statistics.*
|
||||
import org.jetbrains.kotlin.gradle.report.BuildReportType
|
||||
import org.jetbrains.kotlin.gradle.testbase.*
|
||||
import org.junit.jupiter.api.DisplayName
|
||||
|
||||
@@ -52,12 +52,14 @@ dependencies {
|
||||
commonCompileOnly(intellijCore())
|
||||
commonCompileOnly(commonDependency("org.jetbrains.teamcity:serviceMessages"))
|
||||
commonCompileOnly("com.gradle:gradle-enterprise-gradle-plugin:3.12.4")
|
||||
commonCompileOnly(commonDependency("com.google.code.gson:gson"))
|
||||
commonCompileOnly(commonDependency("com.google.guava:guava"))
|
||||
commonCompileOnly("de.undercouch:gradle-download-task:4.1.1")
|
||||
commonCompileOnly("com.github.gundy:semver4j:0.16.4:nodeps") {
|
||||
exclude(group = "*")
|
||||
}
|
||||
commonCompileOnly(project(":kotlin-tooling-metadata"))
|
||||
commonCompileOnly(project(":compiler:build-tools:kotlin-build-statistics"))
|
||||
|
||||
|
||||
commonImplementation(project(":kotlin-gradle-plugin-idea"))
|
||||
@@ -66,7 +68,6 @@ dependencies {
|
||||
commonImplementation(project(":native:kotlin-klib-commonizer-api"))
|
||||
commonImplementation(project(":kotlin-project-model"))
|
||||
commonImplementation(project(":compiler:build-tools:kotlin-build-tools-api"))
|
||||
commonImplementation(project(":kotlin-build-statistic"))
|
||||
|
||||
commonRuntimeOnly(project(":kotlin-compiler-embeddable"))
|
||||
commonRuntimeOnly(project(":kotlin-annotation-processing-embeddable"))
|
||||
@@ -111,7 +112,6 @@ dependencies {
|
||||
testImplementation(commonDependency("junit:junit"))
|
||||
testImplementation(project(":kotlin-gradle-statistics"))
|
||||
testImplementation(project(":kotlin-tooling-metadata"))
|
||||
testImplementation(projectTests(":kotlin-build-statistic"))
|
||||
}
|
||||
|
||||
configurations.commonCompileClasspath.get().exclude("org.jetbrains.kotlinx", "kotlinx-coroutines-core")
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.gradle.logging.*
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskExecutionResults
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskLoggers
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.gradle.report.*
|
||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilerExecutionStrategy
|
||||
import org.jetbrains.kotlin.gradle.tasks.cleanOutputsAndLocalState
|
||||
|
||||
+3
-3
@@ -13,8 +13,8 @@ internal class GradleKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
log.debug(msg)
|
||||
}
|
||||
|
||||
override fun error(msg: String) {
|
||||
log.error(msg)
|
||||
override fun error(msg: String, throwable: Throwable?) {
|
||||
log.error(msg, throwable)
|
||||
}
|
||||
|
||||
override fun info(msg: String) {
|
||||
@@ -25,7 +25,7 @@ internal class GradleKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
log.warn(msg)
|
||||
}
|
||||
|
||||
fun lifecycle(msg: String) {
|
||||
override fun lifecycle(msg: String) {
|
||||
log.lifecycle(msg)
|
||||
}
|
||||
|
||||
|
||||
+6
-2
@@ -13,8 +13,12 @@ internal class SL4JKotlinLogger(private val log: Logger) : KotlinLogger {
|
||||
log.debug(msg)
|
||||
}
|
||||
|
||||
override fun error(msg: String) {
|
||||
log.error(msg)
|
||||
override fun lifecycle(msg: String) {
|
||||
log.info(msg)
|
||||
}
|
||||
|
||||
override fun error(msg: String, throwable: Throwable?) {
|
||||
log.error(msg, throwable)
|
||||
}
|
||||
|
||||
override fun info(msg: String) {
|
||||
|
||||
+10
-6
@@ -26,13 +26,12 @@ import org.jetbrains.kotlin.build.report.metrics.BuildMetrics
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildMetricsReporter
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildPerformanceMetric
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildTime
|
||||
import org.jetbrains.kotlin.build.report.statistic.HttpReportService
|
||||
import org.jetbrains.kotlin.build.report.statistic.HttpReportServiceImpl
|
||||
import org.jetbrains.kotlin.build.report.statistics.HttpReportService
|
||||
import org.jetbrains.kotlin.gradle.plugin.BuildEventsListenerRegistryHolder
|
||||
import org.jetbrains.kotlin.gradle.plugin.getKotlinPluginVersion
|
||||
import org.jetbrains.kotlin.gradle.plugin.internal.state.TaskExecutionResults
|
||||
import org.jetbrains.kotlin.build.report.statistic.GradleBuildStartParameters
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.BuildStartParameters
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.gradle.plugin.statistics.KotlinBuildStatsService
|
||||
import org.jetbrains.kotlin.gradle.report.BuildReportsService.Companion.getStartParameters
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildOperationRecord
|
||||
@@ -45,6 +44,7 @@ import org.jetbrains.kotlin.statistics.metrics.NumericalMetrics
|
||||
import java.util.concurrent.ConcurrentHashMap
|
||||
import java.util.concurrent.ConcurrentLinkedQueue
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import java.lang.management.ManagementFactory
|
||||
|
||||
internal interface UsesBuildMetricsService : Task {
|
||||
@get:Internal
|
||||
@@ -55,7 +55,7 @@ abstract class BuildMetricsService : BuildService<BuildMetricsService.Parameters
|
||||
|
||||
//Part of BuildReportService
|
||||
interface Parameters : BuildServiceParameters {
|
||||
val startParameters: Property<GradleBuildStartParameters>
|
||||
val startParameters: Property<BuildStartParameters>
|
||||
val reportingSettings: Property<ReportingSettings>
|
||||
val httpService: Property<HttpReportService>
|
||||
|
||||
@@ -204,7 +204,7 @@ abstract class BuildMetricsService : BuildService<BuildMetricsService.Parameters
|
||||
it.parameters.reportingSettings.set(reportingSettings)
|
||||
reportingSettings.httpReportSettings?.let { httpSettings ->
|
||||
it.parameters.httpService.set(
|
||||
HttpReportServiceImpl(
|
||||
HttpReportService(
|
||||
httpSettings.url,
|
||||
httpSettings.user,
|
||||
httpSettings.password
|
||||
@@ -265,6 +265,10 @@ abstract class BuildMetricsService : BuildService<BuildMetricsService.Parameters
|
||||
if (gradle.startParameter.isBuildCacheEnabled) {
|
||||
additionalTags.add(StatTag.BUILD_CACHE)
|
||||
}
|
||||
val debugConfiguration = "-agentlib:"
|
||||
if (ManagementFactory.getRuntimeMXBean().inputArguments.firstOrNull { it.startsWith(debugConfiguration) } != null) {
|
||||
additionalTags.add(StatTag.GRADLE_DEBUG)
|
||||
}
|
||||
return additionalTags
|
||||
}
|
||||
}
|
||||
|
||||
+11
-16
@@ -9,18 +9,17 @@ import org.gradle.api.Project
|
||||
import org.gradle.api.logging.Logging
|
||||
import org.gradle.tooling.events.task.TaskFinishEvent
|
||||
import org.jetbrains.kotlin.build.report.metrics.ValueType
|
||||
import org.jetbrains.kotlin.build.report.statistic.HttpReportService
|
||||
import org.jetbrains.kotlin.build.report.statistic.file.FileReportService
|
||||
import org.jetbrains.kotlin.build.report.statistic.formatSize
|
||||
import org.jetbrains.kotlin.build.report.statistic.BuildFinishStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistic.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistic.GradleBuildStartParameters
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.HttpReportService
|
||||
import org.jetbrains.kotlin.build.report.statistics.file.FileReportService
|
||||
import org.jetbrains.kotlin.build.report.statistics.formatSize
|
||||
import org.jetbrains.kotlin.build.report.statistics.BuildFinishStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistics.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistics.BuildStartParameters
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildExecutionData
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildOperationRecord
|
||||
import org.jetbrains.kotlin.utils.addToStdlib.measureTimeMillisWithResult
|
||||
import java.io.File
|
||||
import java.lang.management.ManagementFactory
|
||||
import java.net.InetAddress
|
||||
import java.text.SimpleDateFormat
|
||||
import java.util.*
|
||||
@@ -133,11 +132,11 @@ class BuildReportsService {
|
||||
parameters.httpService?.sendData(buildFinishData, loggerAdapter)
|
||||
}
|
||||
|
||||
private fun GradleBuildStartParameters.includeVerboseEnvironment(verboseEnvironment: Boolean): GradleBuildStartParameters {
|
||||
private fun BuildStartParameters.includeVerboseEnvironment(verboseEnvironment: Boolean): BuildStartParameters {
|
||||
return if (verboseEnvironment) {
|
||||
this
|
||||
} else {
|
||||
GradleBuildStartParameters(
|
||||
BuildStartParameters(
|
||||
tasks = this.tasks,
|
||||
excludedTasks = this.excludedTasks,
|
||||
currentDir = null,
|
||||
@@ -284,10 +283,6 @@ class BuildReportsService {
|
||||
label?.also {
|
||||
buildScan.buildScan.tag(it)
|
||||
}
|
||||
val debugConfiguration = "-agentlib:"
|
||||
if (ManagementFactory.getRuntimeMXBean().inputArguments.firstOrNull { it.startsWith(debugConfiguration) } != null) {
|
||||
buildScan.buildScan.tag(StatTag.GRADLE_DEBUG.readableString)
|
||||
}
|
||||
}
|
||||
|
||||
internal fun addCollectedTags(buildScan: BuildScanExtensionHolder) {
|
||||
@@ -322,7 +317,7 @@ class BuildReportsService {
|
||||
private val DATE_FORMATTER = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss")
|
||||
|
||||
fun getStartParameters(project: Project) = project.gradle.startParameter.let {
|
||||
GradleBuildStartParameters(
|
||||
BuildStartParameters(
|
||||
tasks = it.taskRequests.flatMap { it.args },
|
||||
excludedTasks = it.excludedTaskNames,
|
||||
currentDir = it.currentDir.path,
|
||||
@@ -352,7 +347,7 @@ enum class TaskExecutionState {
|
||||
}
|
||||
|
||||
data class BuildReportParameters(
|
||||
val startParameters: GradleBuildStartParameters,
|
||||
val startParameters: BuildStartParameters,
|
||||
val reportingSettings: ReportingSettings,
|
||||
val httpService: HttpReportService?,
|
||||
|
||||
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.report
|
||||
|
||||
import org.gradle.api.logging.Logger
|
||||
|
||||
class GradleLoggerAdapter(private val log: Logger) : org.jetbrains.kotlin.util.Logger {
|
||||
override fun log(message: String) {
|
||||
log.info(message)
|
||||
}
|
||||
|
||||
override fun warning(message: String) {
|
||||
log.warn(message)
|
||||
}
|
||||
|
||||
override fun fatal(message: String): Nothing {
|
||||
log.error(message)
|
||||
kotlin.error(message)
|
||||
}
|
||||
|
||||
override fun error(message: String, throwable: Throwable?) {
|
||||
throwable?.let { log.error(message, throwable) } ?: log.error(message)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) {
|
||||
log.lifecycle(message)
|
||||
}
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright 2010-2023 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||
*/
|
||||
|
||||
package org.jetbrains.kotlin.gradle.report
|
||||
|
||||
import org.gradle.api.logging.Logger
|
||||
import org.jetbrains.kotlin.compilerRunner.KotlinLogger
|
||||
|
||||
class GradleLoggerAdapter(private val log: Logger) : KotlinLogger {
|
||||
|
||||
override val isDebugEnabled: Boolean
|
||||
get() = log.isDebugEnabled
|
||||
override fun info(msg: String) {
|
||||
log.info(msg)
|
||||
}
|
||||
|
||||
override fun debug(msg: String) {
|
||||
log.debug(msg)
|
||||
}
|
||||
|
||||
override fun warn(msg: String) {
|
||||
log.warn(msg)
|
||||
}
|
||||
|
||||
override fun error(msg: String, throwable: Throwable?) {
|
||||
throwable?.let { log.error(msg, throwable) } ?: log.error(msg)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) {
|
||||
log.lifecycle(message)
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -7,7 +7,7 @@ package org.jetbrains.kotlin.gradle.report
|
||||
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildMetrics
|
||||
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.incremental.ChangedFiles
|
||||
|
||||
internal class TaskExecutionResult(
|
||||
|
||||
+2
-2
@@ -6,10 +6,10 @@
|
||||
package org.jetbrains.kotlin.gradle.report.data
|
||||
|
||||
import org.jetbrains.kotlin.build.report.metrics.BuildMetrics
|
||||
import org.jetbrains.kotlin.build.report.statistic.GradleBuildStartParameters
|
||||
import org.jetbrains.kotlin.build.report.statistics.BuildStartParameters
|
||||
|
||||
class BuildExecutionData(
|
||||
val startParameters: GradleBuildStartParameters,
|
||||
val startParameters: BuildStartParameters,
|
||||
val failureMessages: List<String?>,
|
||||
val buildOperationRecord: Collection<BuildOperationRecord>
|
||||
) {
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ import org.gradle.tooling.events.task.TaskFinishEvent
|
||||
import org.gradle.tooling.events.task.TaskSkippedResult
|
||||
import org.gradle.tooling.events.task.TaskSuccessResult
|
||||
import org.jetbrains.kotlin.build.report.metrics.*
|
||||
import org.jetbrains.kotlin.build.report.statistic.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.CompileStatisticsData
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.gradle.report.data.BuildOperationRecord
|
||||
import org.jetbrains.kotlin.incremental.ChangedFiles
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
+1
-2
@@ -115,9 +115,8 @@ internal fun getAllDependencies(dependency: ResolvedDependencyResult): Set<Resol
|
||||
internal class GradleLoggerAdapter(private val gradleLogger: Logger) : org.jetbrains.kotlin.util.Logger {
|
||||
override fun log(message: String) = gradleLogger.info(message)
|
||||
override fun warning(message: String) = gradleLogger.warn(message)
|
||||
override fun error(message: String, throwable: Throwable?) = kotlin.error(message)
|
||||
override fun error(message: String) = kotlin.error(message)
|
||||
override fun fatal(message: String): Nothing = kotlin.error(message)
|
||||
override fun lifecycle(message: String) = gradleLogger.lifecycle(message)
|
||||
}
|
||||
|
||||
private fun libraryFilter(artifact: ResolvedArtifactResult): Boolean = artifact.file.absolutePath.endsWith(".klib")
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import org.gradle.tooling.events.task.TaskFinishEvent
|
||||
import org.gradle.tooling.events.task.TaskOperationDescriptor
|
||||
import org.gradle.tooling.events.task.TaskOperationResult
|
||||
import org.jetbrains.kotlin.build.report.metrics.*
|
||||
import org.jetbrains.kotlin.build.report.statistic.StatTag
|
||||
import org.jetbrains.kotlin.build.report.statistics.StatTag
|
||||
import org.jetbrains.kotlin.gradle.report.TaskRecord
|
||||
import org.jetbrains.kotlin.gradle.report.prepareData
|
||||
import org.junit.Ignore
|
||||
|
||||
@@ -20,15 +20,13 @@ internal class CliLoggerAdapter(
|
||||
|
||||
override fun warning(message: String) = printlnIndented("Warning: $message", *CommonizerLogLevel.values())
|
||||
|
||||
override fun error(message: String, throwable: Throwable?) = fatal(message)
|
||||
override fun error(message: String) = fatal(message)
|
||||
|
||||
override fun fatal(message: String): Nothing {
|
||||
printlnIndented("Error: $message\n", *CommonizerLogLevel.values())
|
||||
exitProcess(1)
|
||||
}
|
||||
|
||||
override fun lifecycle(message: String) = log(message)
|
||||
|
||||
private fun printlnIndented(text: String, vararg levels: CommonizerLogLevel) {
|
||||
if (level in levels) {
|
||||
if (indent.isEmpty()) println(text)
|
||||
|
||||
+1
-2
@@ -205,7 +205,7 @@ include ":kotlin-imports-dumper-compiler-plugin",
|
||||
":kotlin-gradle-plugin-test-utils-embeddable",
|
||||
":kotlin-gradle-plugin-integration-tests",
|
||||
":kotlin-gradle-plugins-bom",
|
||||
":kotlin-build-statistic",
|
||||
":compiler:build-tools:kotlin-build-statistics",
|
||||
":gradle:android-test-fixes",
|
||||
":gradle:gradle-warnings-detector",
|
||||
":gradle:kotlin-compiler-args-properties",
|
||||
@@ -808,7 +808,6 @@ project(':kotlin-scripting-ide-services-unshaded').projectDir = "$rootDir/plugin
|
||||
project(':kotlin-scripting-ide-services-test').projectDir = "$rootDir/plugins/scripting/scripting-ide-services-test" as File
|
||||
project(':kotlin-scripting-ide-services').projectDir = "$rootDir/plugins/scripting/scripting-ide-services-embeddable" as File
|
||||
project(':kotlin-scripting-ide-common').projectDir = "$rootDir/plugins/scripting/scripting-ide-common" as File
|
||||
project(':kotlin-build-statistic').projectDir ="$rootDir/kotlin-build-statistic" as File
|
||||
|
||||
// Uncomment to use locally built protobuf-relocated
|
||||
// includeBuild("dependencies/protobuf")
|
||||
|
||||
Reference in New Issue
Block a user