Skip to content

Use convention method to set task property defaults - #5272

Merged
3flex merged 1 commit into
detekt:mainfrom
3flex:gradle-property-conventions
Sep 4, 2022
Merged

Use convention method to set task property defaults#5272
3flex merged 1 commit into
detekt:mainfrom
3flex:gradle-property-conventions

Conversation

@3flex

@3flex 3flex commented Sep 4, 2022

Copy link
Copy Markdown
Member

https://docs.gradle.org/7.5.1/userguide/lazy_configuration.html#applying_conventions

Often you want to apply some convention, or default value, to a property to be used if no value has been configured for the property. You can use the convention() method for this. This method accepts either a value or a Provider and this will be used as the value until some other value is configured.

This means that whenever the plugin is applied, it will apply only default values, and if the value was set anywhere else in the build script, the convention will not overwrite it.

@schalkms schalkms added this to the 1.22.0 milestone Sep 4, 2022
@3flex
3flex merged commit 9c7a491 into detekt:main Sep 4, 2022
@3flex
3flex deleted the gradle-property-conventions branch September 4, 2022 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants