build.gradle 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import org.elasticsearch.gradle.BuildPlugin
  2. import org.elasticsearch.gradle.plugin.PluginBuildPlugin
  3. import org.elasticsearch.gradle.Version
  4. import org.elasticsearch.gradle.precommit.LicenseHeadersTask
  5. Project xpackRootProject = project
  6. apply plugin: 'nebula.info-scm'
  7. final String licenseCommit
  8. if (version.endsWith('-SNAPSHOT')) {
  9. licenseCommit = xpackRootProject.scminfo.change ?: "master" // leniency for non git builds
  10. } else {
  11. licenseCommit = "v${version}"
  12. }
  13. subprojects {
  14. group = 'org.elasticsearch.plugin'
  15. ext.xpackRootProject = xpackRootProject
  16. ext.xpackProject = { String projectName -> xpackRootProject.project(projectName) }
  17. // helper method to find the path to a module
  18. ext.xpackModule = { String moduleName -> xpackProject("plugin:${moduleName}").path }
  19. ext.licenseName = 'Elastic License'
  20. ext.licenseUrl = "https://raw.githubusercontent.com/elastic/elasticsearch/${licenseCommit}/licenses/ELASTIC-LICENSE.txt"
  21. project.ext.licenseFile = rootProject.file('licenses/ELASTIC-LICENSE.txt')
  22. project.ext.noticeFile = xpackRootProject.file('NOTICE.txt')
  23. plugins.withType(PluginBuildPlugin).whenPluginAdded {
  24. project.esplugin.licenseFile = rootProject.file('licenses/ELASTIC-LICENSE.txt')
  25. project.esplugin.noticeFile = xpackRootProject.file('NOTICE.txt')
  26. }
  27. }
  28. File checkstyleSuppressions = file('dev-tools/checkstyle_suppressions.xml')
  29. subprojects {
  30. tasks.withType(Checkstyle) {
  31. inputs.file(checkstyleSuppressions)
  32. // Use x-pack-elasticsearch specific suppressions file rather than the open source one.
  33. configProperties = [
  34. suppressions: checkstyleSuppressions
  35. ]
  36. }
  37. tasks.withType(LicenseHeadersTask.class) {
  38. approvedLicenses = ['Elastic License', 'Generated']
  39. additionalLicense 'ELAST', 'Elastic License', 'Licensed under the Elastic License'
  40. }
  41. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-core:${version}": xpackModule('core')]
  42. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-deprecation:${version}": xpackModule('deprecation')]
  43. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-graph:${version}": xpackModule('graph')]
  44. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-logstash:${version}": xpackModule('logstash')]
  45. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-ml:${version}": xpackModule('ml')]
  46. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-monitoring:${version}": xpackModule('monitoring')]
  47. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-security:${version}": xpackModule('security')]
  48. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-upgrade:${version}": xpackModule('upgrade')]
  49. ext.projectSubstitutions += [ "org.elasticsearch.plugin:x-pack-watcher:${version}": xpackModule('watcher')]
  50. }