Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extension properties should be lazily configured #154

Open
netvl opened this issue May 25, 2021 · 0 comments
Open

Extension properties should be lazily configured #154

netvl opened this issue May 25, 2021 · 0 comments

Comments

@netvl
Copy link

netvl commented May 25, 2021

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant