mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[gradle] [IDEA-334242] Disable gradle.import.performance.statistics by default; Added deprecation notes;
GitOrigin-RevId: 6d2c1db75bed5471a15b183a859456e446788b8a
This commit is contained in:
committed by
intellij-monorepo-bot
parent
4ed1073695
commit
b2b800e977
@@ -16,6 +16,7 @@ import com.intellij.openapi.externalSystem.task.TaskCallback
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemApiUtil
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil
|
||||
import com.intellij.openapi.externalSystem.util.ExternalSystemUtil.runTask
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import com.intellij.testFramework.ExtensionTestUtil
|
||||
import com.jetbrains.fus.reporting.model.lion3.LogEvent
|
||||
import junit.framework.AssertionFailedError
|
||||
@@ -35,6 +36,7 @@ class GradleTasksExecutionTest : GradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
fun `test fus contains only well known task metrics`() {
|
||||
Registry.get("gradle.import.performance.statistics").setValue("true", testRootDisposable)
|
||||
ExtensionTestUtil.maskExtensions(ExternalEventLogSettings.EP_NAME, listOf(object : ExternalEventLogSettings {
|
||||
override fun forceLoggingAlwaysEnabled(): Boolean = true
|
||||
override fun getExtraLogUploadHeaders(): Map<String, String> = emptyMap()
|
||||
|
||||
@@ -202,7 +202,7 @@
|
||||
description="Enable experimental support of version catalogs based on after-sync gradle models"/>
|
||||
<registryKey key="gradle.download.sources" defaultValue="false"
|
||||
description="Download sources of project dependencies during import"/>
|
||||
<registryKey key="gradle.import.performance.statistics" defaultValue="true"
|
||||
<registryKey key="gradle.import.performance.statistics" defaultValue="false"
|
||||
description="Collect performance-related statistics of Gradle import"/>
|
||||
<commandLineInspectionProjectConfigurator implementation="org.jetbrains.plugins.gradle.GradleCommandLineProjectConfigurator"/>
|
||||
<warmupConfigurator implementation="org.jetbrains.plugins.gradle.GradleWarmupConfigurator"/>
|
||||
|
||||
+7
-8
@@ -3,13 +3,13 @@ package org.jetbrains.plugins.gradle.service.execution
|
||||
|
||||
import com.intellij.internal.statistic.utils.StatisticsUploadAssistant
|
||||
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskId
|
||||
import com.intellij.openapi.externalSystem.model.task.ExternalSystemTaskType
|
||||
import com.intellij.openapi.util.registry.Registry
|
||||
import org.gradle.tooling.LongRunningOperation
|
||||
import org.gradle.tooling.events.OperationType
|
||||
import org.gradle.tooling.events.ProgressListener
|
||||
import org.gradle.tooling.model.build.BuildEnvironment
|
||||
import org.gradle.util.GradleVersion
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.gradle.frameworkSupport.buildscript.isGradleOlderThan
|
||||
import org.jetbrains.plugins.gradle.service.execution.statistics.GradleExecutionStageFusHandler
|
||||
import org.jetbrains.plugins.gradle.service.project.GradleOperationHelperExtension
|
||||
@@ -17,13 +17,15 @@ import org.jetbrains.plugins.gradle.service.project.ProjectResolverContext
|
||||
import org.jetbrains.plugins.gradle.settings.GradleExecutionSettings
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
class GradleExecutionMeasuringExtension : GradleOperationHelperExtension {
|
||||
|
||||
override fun prepareForExecution(id: ExternalSystemTaskId,
|
||||
operation: LongRunningOperation,
|
||||
gradleExecutionSettings: GradleExecutionSettings,
|
||||
buildEnvironment: BuildEnvironment?) {
|
||||
if (isSkipExecution(id, buildEnvironment)) {
|
||||
if (isSkipExecution(buildEnvironment)) {
|
||||
return
|
||||
}
|
||||
val handler = GradleExecutionStageFusHandler(id.id, WeakReference(id.findProject()))
|
||||
@@ -40,17 +42,14 @@ class GradleExecutionMeasuringExtension : GradleOperationHelperExtension {
|
||||
|
||||
private fun BuildEnvironment.gradleVersion(): GradleVersion? = gradle?.gradleVersion?.let { GradleVersion.version(it) }
|
||||
|
||||
private fun isSkipExecution(id: ExternalSystemTaskId, buildEnvironment: BuildEnvironment?): Boolean {
|
||||
private fun isSkipExecution(buildEnvironment: BuildEnvironment?): Boolean {
|
||||
if (!StatisticsUploadAssistant.isCollectAllowedOrForced()) {
|
||||
return true
|
||||
}
|
||||
if (id.type == ExternalSystemTaskType.RESOLVE_PROJECT && !Registry.`is`("gradle.import.performance.statistics", true)) {
|
||||
if (!Registry.`is`("gradle.import.performance.statistics", false)) {
|
||||
return true
|
||||
}
|
||||
val gradleVersion = buildEnvironment?.gradleVersion()
|
||||
if (gradleVersion == null || gradleVersion.isGradleOlderThan("5.1")) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
return gradleVersion == null || gradleVersion.isGradleOlderThan("5.1")
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -6,11 +6,14 @@ import org.gradle.tooling.events.internal.DefaultFinishEvent
|
||||
import org.gradle.tooling.events.lifecycle.internal.DefaultBuildPhaseFinishEvent
|
||||
import org.gradle.tooling.events.task.internal.DefaultTaskFailureResult
|
||||
import org.gradle.tooling.events.task.internal.DefaultTaskFinishEvent
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.gradle.service.execution.statistics.AggregatedTaskReport
|
||||
import org.jetbrains.plugins.gradle.service.execution.statistics.GradleExecutionStageHandler
|
||||
import org.jetbrains.plugins.gradle.service.execution.statistics.TaskGraphExecutionReport
|
||||
import org.jetbrains.plugins.gradle.util.GradleTaskClassifier
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
class TaskExecutionAggregatedRouter(val handler: GradleExecutionStageHandler) {
|
||||
|
||||
private companion object {
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.gradle.service.execution.statistics
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
data class AggregatedTaskReport(
|
||||
val name: String,
|
||||
val plugin: String,
|
||||
|
||||
+3
@@ -5,9 +5,12 @@ import com.intellij.internal.statistic.eventLog.events.EventFields
|
||||
import com.intellij.internal.statistic.eventLog.events.EventId2
|
||||
import com.intellij.internal.statistic.eventLog.events.VarargEventId
|
||||
import com.intellij.openapi.project.Project
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.gradle.statistics.GradleExecutionPerformanceCollector
|
||||
import java.lang.ref.WeakReference
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
class GradleExecutionStageFusHandler(val taskId: Long, val project: WeakReference<Project>) : GradleExecutionStageHandler {
|
||||
|
||||
override fun onGradleExecutionCompleted(duration: Long) = duration.emit(GradleExecutionPerformanceCollector.EXECUTION_COMPLETED)
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.gradle.service.execution.statistics
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
interface GradleExecutionStageHandler {
|
||||
|
||||
fun onGradleExecutionCompleted(duration: Long)
|
||||
|
||||
+4
@@ -1,6 +1,10 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.gradle.service.execution.statistics
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
data class TaskGraphExecutionReport(
|
||||
val durationMs: Long,
|
||||
val executed: Int,
|
||||
|
||||
+3
@@ -7,8 +7,11 @@ import com.intellij.internal.statistic.eventLog.validator.ValidationResultType
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.EventContext
|
||||
import com.intellij.internal.statistic.eventLog.validator.rules.impl.CustomValidationRule
|
||||
import com.intellij.internal.statistic.service.fus.collectors.CounterUsagesCollector
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import org.jetbrains.plugins.gradle.util.GradleTaskClassifier
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
class GradleExecutionPerformanceCollector : CounterUsagesCollector() {
|
||||
|
||||
override fun getGroup(): EventLogGroup = GROUP
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
// Copyright 2000-2023 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package org.jetbrains.plugins.gradle.util
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus
|
||||
import java.util.*
|
||||
import java.util.regex.Pattern
|
||||
|
||||
@Deprecated(message = "Obsolete")
|
||||
@ApiStatus.ScheduledForRemoval
|
||||
object GradleTaskClassifier {
|
||||
|
||||
private const val OTHER: String = "other"
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@ class GradleImportPerformanceFusTest : GradleImportingTestCase() {
|
||||
|
||||
@Test
|
||||
@TargetVersions("5.1+")
|
||||
fun `test gradle import performance events collected by default`() {
|
||||
fun `test gradle import performance events not collected by default`() {
|
||||
toggleFus(true)
|
||||
assertThat(collectGradleImportPerformanceEvents()).isNotEmpty()
|
||||
assertThat(collectGradleImportPerformanceEvents()).isEmpty()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user