janbarari / gradle-analytics-plugin

A free Gradle plugin to analyze your project builds. It provides unique visual and text metrics in HTML format.
MIT License
155 stars 5 forks source link

Use Lazy Configuration for plugin DSL #140

Open EdricChan03 opened 1 month ago

EdricChan03 commented 1 month ago

It would be great if Gradle's Lazy Configuration model was supported (via the plugin DSL), such that values that might be set via other computed values could be used and they would only be evaluated when actually used:

gradleAnalyticsPlugin {
  // Example: Conditionally enabling via providers.environmentVariable (returns Provider<String>)
  enabled = providers.environmentVariable("CI").map { it == "true" } // Provider<Boolean>
}
janbarari commented 1 month ago

Hey @EdricChan03,

Thanks for reporting this feature. I will investigate and update you here.

By the way, if you want to enable or disable the plugin specifically for CI environments, you don't need to do it manually. You can configure the CI database settings to ensure the plugin is active only on the CI server.

Best regards, Mehdi