All Downloads are FREE. Search and download functionalities are using the official Maven repository.

netflix.nebula.dependency.recommender.provider.DependencyLockProvider.groovy Maven / Gradle / Ivy

Go to download

Allows projects to leave off version numbers in dependencies section and have versions recommended by other sources

There is a newer version: 12.5.1
Show newest version
package netflix.nebula.dependency.recommender.provider

import groovy.json.JsonSlurper
import org.gradle.api.Project

class DependencyLockProvider extends FileBasedRecommendationProvider {
    Map recommendations

    DependencyLockProvider() {}

    DependencyLockProvider(Project project) {
        super(project)
    }

    @Override
    String getVersion(String org, String name) throws Exception {
        if(!recommendations) {
            final locks = new JsonSlurper().parse(input)
            final isDependencyLock4Format = locks.every {
                it.value.every {
                    it.value instanceof Map
                }
            }

            recommendations = (isDependencyLock4Format ? locks.collectEntries { it.value } : locks).collectEntries {
                [(it.key) : it.value.locked]
            }
        }
        recommendations[org + ':' + name]
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy