Gradle 2.9 has changed the behavior of Gradle profiling. We depended on ProfileListener being called, so we could capture build performance data, without requiring that all Gradle invocations include --profile
. Could this please be considered for 2.10, it’s blocking us from upgrading to Gradle 2.9 as it’s not possible to enable profiling programatically.
commit 81024e422c3fec814bcdd626bbc56789b67fdcb9
Author: Lari Hotari <lari.hotari@gradle.com>
Date: Tue Sep 22 18:12:37 2015 -0400
register ProfileEventAdapter only when profiling is enabled
diff --git a/subprojects/core/src/main/groovy/org/gradle/initialization/DefaultGradleLauncherFactory.java b/subprojects/core/src/main/groovy/org/gradle/initialization/DefaultGradleLauncherFactory.java
index 7c8d5a0..b8f513d 100644
--- a/subprojects/core/src/main/groovy/org/gradle/initialization/DefaultGradleLauncherFactory.java
+++ b/subprojects/core/src/main/groovy/org/gradle/initialization/DefaultGradleLauncherFactory.java
@@ -125,8 +125,8 @@ public class DefaultGradleLauncherFactory implements GradleLauncherFactory {
}
listenerManager.addListener(tracker);
- listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
if (startParameter.isProfile()) {
+ listenerManager.addListener(serviceRegistry.get(ProfileEventAdapter.class));
listenerManager.addListener(new ReportGeneratingProfileListener());
}
ScriptUsageLocationReporter usageLocationReporter = new ScriptUsageLocationReporter();