This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val buildReporterService = gradle.sharedServices.registerIfAbsent("build-reporter-service", BuildReporterService::class.java) { service -> | |
service.parameters.getBuildTaskNames().set(gradle.startParameter.taskNames.joinToString()) | |
service.parameters.getGradleVersion().set(gradle.gradleVersion) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildReporterService : BuildService<BuildReporterService.Params>, AutoCloseable { | |
interface Params : BuildServiceParameters { | |
fun getBuildTaskNames(): Property<String> | |
fun getGradleVersion(): Property<String> | |
} | |
override fun close() { | |
val buildTaskNames = parameters.getBuildTaskNames().get() | |
val gradleVersion = parameters.getGradleVersion().get() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuildTimeLoggerPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
val gradle = project.gradle | |
val buildDurationService = registerBuildDurationService(gradle) | |
val buildTaskService = registerBuildTaskService(gradle) | |
registerBuildReporterService(gradle, buildDurationService, buildTaskService) | |
} | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildReporterService : BuildService<BuildReporterService.Params>, BuildOperationListener, AutoCloseable { | |
interface Params : BuildServiceParameters { | |
fun getBuildDurationServiceProvider(): Property<Provider<BuildDurationService>> | |
fun getBuildTaskServiceProvider(): Property<Provider<BuildTaskService>> | |
} | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuildTimeLoggerPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
val gradle = project.gradle | |
val buildTaskService = registerBuildTaskService(gradle) | |
} | |
private fun registerBuildTaskService(gradle: Gradle): Provider<BuildTaskService> { | |
val registry = gradle.serviceRegistry()[BuildEventListenerRegistryInternal::class.java] | |
val buildTaskService = gradle.sharedServices.registerIfAbsent("build-task-service", BuildTaskService::class.java) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildTaskService : BuildService<BuildServiceParameters.None>, OperationCompletionListener { | |
var fromCacheTasksCount = 0 | |
var upToDateTasksCount = 0 | |
var executedTasksCount = 0 | |
var buildPhaseFailureMessage: String? = null | |
val buildPhaseFailed: Boolean | |
get() = buildPhaseFailureMessage != null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildDurationService : BuildService<BuildServiceParameters.None>, BuildOperationListener, AutoCloseable { | |
var buildDuration: Long? = null | |
var configurationDuration: Long? = null | |
var configurationPhaseFailed = true | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
abstract class BuildDurationService : BuildService<BuildServiceParameters.None>, BuildOperationListener, AutoCloseable { | |
var buildDuration: Long? = null | |
override fun started(p0: BuildOperationDescriptor, p1: OperationStartEvent) {} | |
override fun progress(p0: OperationIdentifier, p1: OperationProgressEvent) {} | |
override fun finished(buildOperationDescriptor: BuildOperationDescriptor, operationFinishEvent: OperationFinishEvent) { | |
if (buildOperationDescriptor.details is RunRootBuildWorkBuildOperationType.Details) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BuildTimeLoggerPlugin : Plugin<Project> { | |
override fun apply(project: Project) { | |
val gradle = project.gradle | |
val buildDurationService = registerBuildDurationService(gradle) | |
} | |
private fun registerBuildDurationService(gradle: Gradle): Provider<BuildDurationService> { | |
val registry = gradle.serviceRegistry()[BuildEventListenerRegistryInternal::class.java] | |
val buildDurationService = gradle.sharedServices.registerIfAbsent("build-duration-service", BuildDurationService::class.java) { } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.dropbox.affectedmoduledetector | |
import java.io.File | |
class AffectedModuleConfiguration { | |
/** | |
* Folder to place the log in | |
*/ | |
var logFolder: String? = null |
NewerOlder