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

using dependencyLock and propertiesFile providers together #71

Open
gracew opened this issue Sep 21, 2017 · 1 comment
Open

using dependencyLock and propertiesFile providers together #71

gracew opened this issue Sep 21, 2017 · 1 comment

Comments

@gracew
Copy link

gracew commented Sep 21, 2017

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.

@jmcampanini
Copy link
Contributor

@DanielThomas any thoughts?

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

2 participants