elasticsearch/libs/build.gradle

46 lines
1.8 KiB
Groovy

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0 and the Server Side Public License, v 1; you may not use this file except
* in compliance with, at your election, the Elastic License 2.0 or the Server
* Side Public License, v 1.
*/
configure(subprojects - project('elasticsearch-log4j')) {
/*
* All subprojects are java projects using Elasticsearch's standard build
* tools.
*/
apply plugin: 'elasticsearch.build'
/*
* Subprojects may depend on the "core" lib but may not depend on any
* other libs. This keeps our dependencies simpler.
* With the exception that specialised plugin apis can depend on "core" plugin api project
*/
project.afterEvaluate {
configurations.all { Configuration conf ->
dependencies.matching { it instanceof ProjectDependency }.all { ProjectDependency dep ->
Project depProject = dep.dependencyProject
if (depProject != null
&& false == isPluginApi(project, depProject)
&& false == depProject.path.equals(':libs:elasticsearch-x-content')
&& false == depProject.path.equals(':libs:elasticsearch-core')
&& false == depProject.path.equals(':libs:elasticsearch-plugin-api')
&& false == depProject.path.equals(':libs:elasticsearch-logging')
&& depProject.path.startsWith(':libs')
&& depProject.name.startsWith('elasticsearch-')) {
throw new InvalidUserDataException("projects in :libs "
+ "may not depend on other projects libs except "
+ ":libs:elasticsearch-core but "
+ "${project.path} depends on ${depProject.path}")
}
}
}
}
}
boolean isPluginApi(Project project, Project depProject) {
return project.path.matches(".*elasticsearch-plugin-.*api")
}