2021-04-09 15:28:18 -04:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
|
|
*
|
|
|
|
* The OpenSearch Contributors require contributions made to
|
|
|
|
* this file be licensed under the Apache-2.0 license or a
|
|
|
|
* compatible open source license.
|
|
|
|
*
|
|
|
|
* Modifications Copyright OpenSearch Contributors. See
|
|
|
|
* GitHub history for details.
|
|
|
|
*/
|
|
|
|
|
2020-04-08 02:20:17 -04:00
|
|
|
|
|
|
|
// we do not want any of these dependencies on the compilation classpath
|
2021-03-12 13:49:28 -05:00
|
|
|
// because they could then be used within OpenSearch
|
2020-04-08 02:20:17 -04:00
|
|
|
List<String> FORBIDDEN_DEPENDENCIES = [
|
|
|
|
'guava'
|
|
|
|
]
|
|
|
|
|
2020-06-14 16:30:44 -04:00
|
|
|
Closure checkDeps = { Configuration configuration ->
|
2020-04-08 02:20:17 -04:00
|
|
|
configuration.resolutionStrategy.eachDependency {
|
|
|
|
String artifactName = it.target.name
|
|
|
|
if (FORBIDDEN_DEPENDENCIES.contains(artifactName)) {
|
|
|
|
throw new GradleException("Dependency '${artifactName}' on configuration '${configuration.name}' is not allowed. " +
|
|
|
|
"If it is needed as a transitive depenency, try adding it to the runtime classpath")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
if (project.path.startsWith(':test:fixtures:') || project.path.equals(':build-tools')) {
|
|
|
|
// fixtures are allowed to use whatever dependencies they want...
|
|
|
|
return
|
|
|
|
}
|
|
|
|
pluginManager.withPlugin('java') {
|
|
|
|
checkDeps(configurations.compileClasspath)
|
|
|
|
checkDeps(configurations.testCompileClasspath)
|
|
|
|
}
|
|
|
|
}
|