elasticsearch/x-pack/build.gradle
Rene Groeschke ab89ffbdf7
Differentiate qa project group ids from in production projects (#96536)
* Differentiate qa project group ids from in production projects

We need to avoid duplicate GADs of gradle subprojects as we have duplicates otherwise.

Ideally we have a notion of a qa project or internal use project mold into our gradle logic. but for now thats probably enough. in the non xpack modules and plugin folder we workaround this issue by only applying the groupId for direct child projects
2023-06-05 10:28:13 +02:00

56 lines
2.2 KiB
Groovy

import org.elasticsearch.gradle.plugin.PluginBuildPlugin
import org.elasticsearch.gradle.internal.conventions.precommit.LicenseHeadersTask
Project xpackRootProject = project
subprojects {
// We define a specific repository for opensaml since the shibboleth project doesn't publish to maven central and the
// artifacts that are located there are not curated/updated by the project
// see: https://wiki.shibboleth.net/confluence/display/DEV/Use+of+Maven+Central
repositories {
maven {
name "opensaml"
url "https://artifactory.elstc.co/artifactory/shibboleth-releases/"
content {
includeGroup "org.opensaml"
includeGroup "net.shibboleth.utilities"
includeGroup "net.shibboleth"
}
}
}
group = xpackProjectGroup(path)
// helper method to find the path to a module
ext.xpackModule = { String moduleName -> ":x-pack:plugin:${moduleName}" }
plugins.withType(PluginBuildPlugin).whenPluginAdded {
project.esplugin.licenseFile = rootProject.file('licenses/ELASTIC-LICENSE-2.0.txt')
project.esplugin.noticeFile = xpackRootProject.file('NOTICE.txt')
}
tasks.withType(LicenseHeadersTask.class).configureEach {
approvedLicenses = ['Elastic License 2.0', 'Generated', 'Vendored']
additionalLicense 'ELAST', 'Elastic License 2.0', '2.0; you may not use this file except in compliance with the Elastic License'
}
project.pluginManager.withPlugin("elasticsearch.licensing") {
ext.projectLicenses.set(['Elastic License 2.0': ext.elasticLicenseUrl.get()])
}
project.pluginManager.withPlugin("elasticsearch.build") {
project.ext.licenseFile.set(rootProject.file('licenses/ELASTIC-LICENSE-2.0.txt'))
project.ext.noticeFile.set(xpackRootProject.file('NOTICE.txt'))
}
}
// helper method to calculate unique group id for qa projects and
// use org.elasticsearch.plugin for all productive projects
// generates e.g. for path `x-pack:plugin:ccr:qa:rest` the project group id `org.elasticsearch.plugin.ccr.qa`
def xpackProjectGroup(String path) {
return path.contains(":qa:") ?
'org.elasticsearch' + path.substring(":x-pack".length(), path.lastIndexOf(":")).replace(":", ".") :
'org.elasticsearch.plugin'
}