Skip to content

using dependencyLock and propertiesFile providers together #71

@gracew

Description

@gracew

I primarily use nebula-dependency-recommender on multi-project repositories and have found the properties file provider to be really helpful for consolidating versions in a single place. I've recently been exploring using the gradle-dependency-lock-plugin so that I can upgrade dependencies regularly.

However, it appears that in order to gain both benefits, I need to define the extension in an if/else block as follows:

if (System.env.UPDATE_LOCKS == "true" /* can equivalently check a gradle property */) {
    dependencyRecommendations {
        propertiesFile file: project.rootProject.file('versions.props')
    }
} else {
    dependencyRecommendations {
        dependencyLock file: project.file('dependencies.lock')
    }
}

I'm looking for suggestions on a better way to achieve this behavior. I looked through some repositories in the Netflix org but it appears that most repositories inline dependency versions, even for multi-project repositories.

One idea is to define my own plugin, with an extension wrapping the dependencyRecommendations block:

generateLocks {
    dependencyRecommendations {
        propertiesFile file: project.rootProject.file('versions.props')
    }
}

The plugin would then set the actual dependencyRecommendations extension to a convention-based lock file location in most cases, and to the specified providers if a certain environment variable/gradle property is set.

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