OpenSearch/settings.gradle

51 lines
1.7 KiB
Groovy

rootProject.name = 'x-plugins'
apply plugin: 'elasticsearch.project-settings-attachment'
String prefix = ''
if (rootProject.children.isEmpty() == false) {
// we are attached to another project, make a fake root
rootProject.name = 'x-plugins and attachments'
rootProject.projectDir = new File(settingsDir, 'build/fake-root')
if (rootProject.projectDir.exists()) {
rootProject.projectDir.delete()
}
rootProject.projectDir.mkdirs()
// the fake root's build file just needs to know about attachments
File rootBuild = new File(rootProject.projectDir, 'build.gradle')
rootBuild.setText('apply plugin: "elasticsearch.project-attachment"', 'UTF-8')
String attachPrefix = org.elasticsearch.gradle.attachment.ProjectAttachmentPlugin.ATTACHMENT_PREFIX
settingsDir.eachFile { file ->
if (file.getName().startsWith(org.elasticsearch.gradle.attachment.ProjectAttachmentPlugin.ATTACHMENT_PREFIX)) {
new File(rootProject.projectDir, file.getName()).setText(file.getText('UTF-8'), 'UTF-8')
}
}
// add x-plugins as an attachment
File xpluginsAttachment = new File(rootProject.projectDir, "${attachPrefix}x-plugins")
xpluginsAttachment.setText(settingsDir.getPath(), 'UTF-8')
// and add x-plugins root project
prefix = 'x-plugins:'
include 'x-plugins'
project(':x-plugins').projectDir = settingsDir
}
String[] projects = [
'license:core2',
'license:licensor',
'license:plugin-api',
'license:plugin',
'license:found-plugin',
'shield',
'watcher',
'marvel'
]
if (prefix.isEmpty() == false) {
projects = projects.collect { "${prefix}${it}" }
}
include projects
project(":${prefix}license:core2").projectDir = new File(project(":${prefix}license").projectDir, 'core')