Skip to content

Commit

Permalink
Calculate projects configurationMetrics after project evaluation
Browse files Browse the repository at this point in the history
This configuration metrics calculation allows
- to avoid metrics calculation on build close and CME
- to get clear stack trace and error message in case of exception

Delete unnecessary ProjectConfigurationFusService services.

#KTI-1611 Fixed

Merge-request: KT-MR-16382
Merged-by: Nataliya Valtman <Nataliya.Valtman@jetbrains.com>
(cherry picked from commit 363cbac)
  • Loading branch information
nav-nav committed Jul 5, 2024
1 parent 351f801 commit d0984cc
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 49 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,6 @@ abstract class BuildFusService : BuildService<BuildFusService.Parameters>, AutoC
val isConfigurationCacheRequested = project.isConfigurationCacheRequested
val isProjectIsolationRequested = project.isProjectIsolationRequested

ProjectConfigurationFusService.registerIfAbsent(project)

project.gradle.sharedServices.registrations.findByName(serviceName)?.let {
@Suppress("UNCHECKED_CAST")
return (it.service as Provider<BuildFusService>)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,9 @@ import org.jetbrains.kotlin.gradle.plugin.await
internal val FinalizeConfigurationFusMetricAction = KotlinProjectSetupCoroutine {
KotlinPluginLifecycle.Stage.ReadyForExecution.await()

val projectConfigurationService =
project.gradle.sharedServices.registrations.findByName(ProjectConfigurationFusService.getServiceName(project))?.also {
val parameters = it.parameters as ProjectConfigurationFusService.Parameters
parameters.configurationMetrics.finalizeValue()
}

project.gradle.sharedServices.registrations.findByName(BuildFusService.serviceName)?.also {
val parameters = it.parameters as BuildFusService.Parameters
parameters.generalConfigurationMetrics.finalizeValue()
projectConfigurationService?.service?.orNull?.also {
parameters.configurationMetrics.add((it.parameters as ProjectConfigurationFusService.Parameters).configurationMetrics)
}
parameters.configurationMetrics.add(KotlinProjectConfigurationMetrics.collectMetrics(project))
}
}

This file was deleted.

0 comments on commit d0984cc

Please sign in to comment.