Skip to content

Extension properties should be lazily configured #154

Open
@netvl

Description

@netvl

Right now, the extension object directly configures default values of its properties in the constructor:

        dataDir = project.objects.property(File)
        dataDir.set(new File(project.buildDir, 'scoverage'))

This is, however, a problem, because project.buildDir may be changed by other plugins. This results in the plugin producing output in unexpected places if the plugins are applied in a certain order.

Instead, the lazy properties API has the "convention" mechanism accepting providers, which is supposed to be be used for default values:

    dataDir = project.objects.property(File)
        .convention(project.layout.buildDirectory.dir('scoverage'))  // dynamic default values should be providers

    highlighting = project.objects.property(Boolean)
        .convention(true)  // static default values can be immediate

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions