2018-02-14 01:49:53 -05:00
|
|
|
/*
|
|
|
|
* Licensed to Elasticsearch under one or more contributor
|
|
|
|
* license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright
|
|
|
|
* ownership. Elasticsearch licenses this file to you under
|
|
|
|
* the Apache License, Version 2.0 (the "License"); you may
|
|
|
|
* not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
|
|
* KIND, either express or implied. See the License for the
|
|
|
|
* specific language governing permissions and limitations
|
|
|
|
* under the License.
|
|
|
|
*/
|
|
|
|
|
2019-10-04 01:41:06 -04:00
|
|
|
|
2018-02-14 01:49:53 -05:00
|
|
|
import org.apache.tools.ant.taskdefs.condition.Os
|
|
|
|
import org.elasticsearch.gradle.BuildPlugin
|
|
|
|
import org.elasticsearch.gradle.EmptyDirTask
|
2018-03-08 22:46:54 -05:00
|
|
|
import org.elasticsearch.gradle.LoggedExec
|
2018-02-14 01:49:53 -05:00
|
|
|
import org.elasticsearch.gradle.MavenFilteringHack
|
2018-04-24 12:10:51 -04:00
|
|
|
import org.elasticsearch.gradle.VersionProperties
|
2020-04-08 19:47:02 -04:00
|
|
|
import org.elasticsearch.gradle.info.BuildParams
|
2018-02-21 20:46:40 -05:00
|
|
|
import org.elasticsearch.gradle.plugin.PluginBuildPlugin
|
2019-09-17 16:40:35 -04:00
|
|
|
import org.elasticsearch.gradle.tar.SymbolicLinkPreservingTar
|
2018-02-14 01:49:53 -05:00
|
|
|
|
2018-04-24 12:10:51 -04:00
|
|
|
import java.nio.file.Files
|
|
|
|
import java.nio.file.Path
|
2019-11-14 06:01:23 -05:00
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
// need this so Zip/Tar tasks get basic defaults...
|
|
|
|
apply plugin: 'base'
|
|
|
|
|
|
|
|
// CopySpec does not make it easy to create an empty directory so we
|
|
|
|
// create the directory that we want, and then point CopySpec to its
|
|
|
|
// parent to copy to the root of the distribution
|
|
|
|
ext.logsDir = new File(buildDir, 'logs-hack/logs')
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('createLogsDir', EmptyDirTask) {
|
2019-06-13 05:17:45 -04:00
|
|
|
dir = "${logsDir}"
|
|
|
|
dirMode = 0755
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
2019-11-14 06:01:23 -05:00
|
|
|
ext.pluginsDir = new File(buildDir, 'plugins-hack/plugins')
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('createPluginsDir', EmptyDirTask) {
|
2019-06-13 05:17:45 -04:00
|
|
|
dir = "${pluginsDir}"
|
|
|
|
dirMode = 0755
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
2020-02-08 18:50:14 -05:00
|
|
|
ext.jvmOptionsDir = new File(buildDir, 'jvm-options-hack/jvm.options.d')
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('createJvmOptionsDir', EmptyDirTask) {
|
2020-02-08 18:50:14 -05:00
|
|
|
dir = "${jvmOptionsDir}"
|
|
|
|
dirMode = 0750
|
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
|
2020-03-22 11:58:11 -04:00
|
|
|
CopySpec archiveFiles(CopySpec modulesFiles, String distributionType, String platform, String architecture, boolean oss, boolean jdk) {
|
2018-02-21 20:46:40 -05:00
|
|
|
return copySpec {
|
2018-02-14 01:49:53 -05:00
|
|
|
into("elasticsearch-${version}") {
|
2018-05-25 07:56:35 -04:00
|
|
|
into('lib') {
|
2018-07-20 17:03:58 -04:00
|
|
|
with libFiles(oss)
|
2018-05-25 07:56:35 -04:00
|
|
|
}
|
2018-02-14 01:49:53 -05:00
|
|
|
into('config') {
|
|
|
|
dirMode 0750
|
|
|
|
fileMode 0660
|
2019-03-29 08:24:52 -04:00
|
|
|
with configFiles(distributionType, oss, jdk)
|
2020-02-08 18:50:14 -05:00
|
|
|
from {
|
|
|
|
dirMode 0750
|
|
|
|
jvmOptionsDir.getParent()
|
|
|
|
}
|
2018-02-14 01:49:53 -05:00
|
|
|
}
|
|
|
|
into('bin') {
|
2019-03-29 08:24:52 -04:00
|
|
|
with binFiles(distributionType, oss, jdk)
|
2018-02-14 01:49:53 -05:00
|
|
|
}
|
2019-03-15 03:55:15 -04:00
|
|
|
if (jdk) {
|
2019-10-31 15:28:30 -04:00
|
|
|
into("darwin".equals(platform) ? 'jdk.app' : 'jdk') {
|
2020-03-22 11:58:11 -04:00
|
|
|
with jdkFiles(project, platform, architecture)
|
2019-03-08 14:04:18 -05:00
|
|
|
}
|
|
|
|
}
|
2018-02-14 01:49:53 -05:00
|
|
|
into('') {
|
|
|
|
from {
|
|
|
|
dirMode 0755
|
2018-02-21 20:46:40 -05:00
|
|
|
logsDir.getParent()
|
2018-02-14 01:49:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
into('') {
|
|
|
|
from {
|
|
|
|
dirMode 0755
|
2018-02-21 20:46:40 -05:00
|
|
|
pluginsDir.getParent()
|
2018-02-14 01:49:53 -05:00
|
|
|
}
|
|
|
|
}
|
2018-04-10 16:58:49 -04:00
|
|
|
from(rootProject.projectDir) {
|
2019-12-19 18:55:38 -05:00
|
|
|
include 'README.asciidoc'
|
2018-04-10 16:58:49 -04:00
|
|
|
}
|
|
|
|
from(rootProject.file('licenses')) {
|
|
|
|
include oss ? 'APACHE-LICENSE-2.0.txt' : 'ELASTIC-LICENSE.txt'
|
|
|
|
rename { 'LICENSE.txt' }
|
|
|
|
}
|
|
|
|
|
2019-03-29 17:20:53 -04:00
|
|
|
with noticeFile(oss, jdk)
|
2018-02-23 11:03:17 -05:00
|
|
|
into('modules') {
|
|
|
|
with modulesFiles
|
2018-02-14 01:49:53 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
// common config across all zip/tar
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.withType(AbstractArchiveTask).configureEach {
|
2020-02-08 18:50:14 -05:00
|
|
|
dependsOn createLogsDir, createPluginsDir, createJvmOptionsDir
|
2018-02-23 11:03:17 -05:00
|
|
|
String subdir = it.name.substring('build'.size()).replaceAll(/[A-Z]/) { '-' + it.toLowerCase() }.substring(1)
|
|
|
|
destinationDir = file("${subdir}/build/distributions")
|
2019-03-07 10:48:49 -05:00
|
|
|
baseName = "elasticsearch${subdir.contains('oss') ? '-oss' : ''}"
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
|
2018-05-29 20:32:06 -04:00
|
|
|
Closure commonZipConfig = {
|
|
|
|
dirMode 0755
|
|
|
|
fileMode 0644
|
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildIntegTestZip', Zip) {
|
2018-05-29 20:32:06 -04:00
|
|
|
configure(commonZipConfig)
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(transportModulesFiles, 'zip', null, 'x64', true, false)
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildWindowsZip', Zip) {
|
2018-05-29 20:32:06 -04:00
|
|
|
configure(commonZipConfig)
|
2019-01-29 14:18:30 -05:00
|
|
|
archiveClassifier = 'windows-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'windows'), 'zip', 'windows', 'x64', false, true)
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssWindowsZip', Zip) {
|
2018-05-29 20:32:06 -04:00
|
|
|
configure(commonZipConfig)
|
2019-01-29 14:18:30 -05:00
|
|
|
archiveClassifier = 'windows-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'windows'), 'zip', 'windows', 'x64', true, true)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildNoJdkWindowsZip', Zip) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonZipConfig)
|
|
|
|
archiveClassifier = 'no-jdk-windows-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'windows'), 'zip', 'windows', 'x64', false, false)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssNoJdkWindowsZip', Zip) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonZipConfig)
|
|
|
|
archiveClassifier = 'no-jdk-windows-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'windows'), 'zip', 'windows', 'x64', true, false)
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
Closure commonTarConfig = {
|
2018-02-21 20:46:40 -05:00
|
|
|
extension = 'tar.gz'
|
|
|
|
compression = Compression.GZIP
|
|
|
|
dirMode 0755
|
|
|
|
fileMode 0644
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildDarwinTar', SymbolicLinkPreservingTar) {
|
2018-02-23 11:03:17 -05:00
|
|
|
configure(commonTarConfig)
|
2019-01-29 14:18:30 -05:00
|
|
|
archiveClassifier = 'darwin-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'darwin'), 'tar', 'darwin', 'x64', false, true)
|
2018-02-23 11:03:17 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssDarwinTar', SymbolicLinkPreservingTar) {
|
2018-02-23 11:03:17 -05:00
|
|
|
configure(commonTarConfig)
|
2019-01-29 14:18:30 -05:00
|
|
|
archiveClassifier = 'darwin-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'darwin'), 'tar', 'darwin', 'x64', true, true)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildNoJdkDarwinTar', SymbolicLinkPreservingTar) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'no-jdk-darwin-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'darwin'), 'tar', 'darwin', 'x64', false, false)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssNoJdkDarwinTar', SymbolicLinkPreservingTar) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'no-jdk-darwin-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'darwin'), 'tar', 'darwin', 'x64', true, false)
|
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildLinuxAarch64Tar', SymbolicLinkPreservingTar) {
|
2020-03-22 11:58:11 -04:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'linux-aarch64'
|
|
|
|
with archiveFiles(modulesFiles(false, 'linux'), 'tar', 'linux', 'aarch64', false, true)
|
2019-01-29 14:18:30 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildLinuxTar', SymbolicLinkPreservingTar) {
|
2019-01-29 14:18:30 -05:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'linux-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'linux'), 'tar', 'linux', 'x64', false, true)
|
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssLinuxAarch64Tar', SymbolicLinkPreservingTar) {
|
2020-03-22 11:58:11 -04:00
|
|
|
configure(commonTarConfig)
|
2020-03-23 18:17:53 -04:00
|
|
|
archiveClassifier = 'linux-aarch64'
|
2020-03-23 15:06:47 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'linux'), 'tar', 'linux', 'aarch64', true, true)
|
2019-01-29 14:18:30 -05:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssLinuxTar', SymbolicLinkPreservingTar) {
|
2019-01-29 14:18:30 -05:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'linux-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'linux'), 'tar', 'linux', 'x64', true, true)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildNoJdkLinuxTar', SymbolicLinkPreservingTar) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'no-jdk-linux-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(false, 'linux'), 'tar', 'linux', 'x64', false, false)
|
2019-03-15 03:55:15 -04:00
|
|
|
}
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('buildOssNoJdkLinuxTar', SymbolicLinkPreservingTar) {
|
2019-03-15 03:55:15 -04:00
|
|
|
configure(commonTarConfig)
|
|
|
|
archiveClassifier = 'no-jdk-linux-x86_64'
|
2020-03-22 11:58:11 -04:00
|
|
|
with archiveFiles(modulesFiles(true, 'linux'), 'tar', 'linux', 'x64', true, false)
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
|
2018-04-24 12:10:51 -04:00
|
|
|
Closure tarExists = { it -> new File('/bin/tar').exists() || new File('/usr/bin/tar').exists() || new File('/usr/local/bin/tar').exists() }
|
|
|
|
Closure unzipExists = { it -> new File('/bin/unzip').exists() || new File('/usr/bin/unzip').exists() || new File('/usr/local/bin/unzip').exists() }
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
// This configures the default artifact for the distribution specific
|
|
|
|
// subprojects. We have subprojects for two reasons:
|
|
|
|
// 1. Gradle project substitutions can only bind to the default
|
|
|
|
// configuration of a project
|
|
|
|
// 2. The integ-test-zip and zip distributions have the exact same
|
|
|
|
// filename, so they must be placed in different directories.
|
|
|
|
subprojects {
|
|
|
|
apply plugin: 'distribution'
|
|
|
|
|
|
|
|
String buildTask = "build${it.name.replaceAll(/-[a-z]/) { it.substring(1).toUpperCase() }.capitalize()}"
|
2020-04-08 19:47:02 -04:00
|
|
|
ext.buildDist = parent.tasks.named(buildTask)
|
2018-02-21 20:46:40 -05:00
|
|
|
artifacts {
|
|
|
|
'default' buildDist
|
|
|
|
}
|
2018-03-08 22:46:54 -05:00
|
|
|
|
2018-04-24 12:10:51 -04:00
|
|
|
// sanity checks if archives can be extracted
|
2018-12-05 07:06:11 -05:00
|
|
|
File archiveExtractionDir
|
2018-04-24 12:10:51 -04:00
|
|
|
if (project.name.contains('tar')) {
|
|
|
|
archiveExtractionDir = new File(buildDir, 'tar-extracted')
|
|
|
|
} else {
|
|
|
|
assert project.name.contains('zip')
|
|
|
|
archiveExtractionDir = new File(buildDir, 'zip-extracted')
|
|
|
|
}
|
2020-04-08 19:47:02 -04:00
|
|
|
def checkExtraction = tasks.register('checkExtraction', LoggedExec) {
|
2018-03-08 22:46:54 -05:00
|
|
|
dependsOn buildDist
|
|
|
|
doFirst {
|
2018-04-24 12:10:51 -04:00
|
|
|
project.delete(archiveExtractionDir)
|
|
|
|
archiveExtractionDir.mkdirs()
|
2018-03-08 22:46:54 -05:00
|
|
|
}
|
|
|
|
}
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.named('check').configure { dependsOn checkExtraction }
|
2018-04-24 12:10:51 -04:00
|
|
|
if (project.name.contains('tar')) {
|
2020-04-08 19:47:02 -04:00
|
|
|
checkExtraction.configure {
|
2018-04-24 12:10:51 -04:00
|
|
|
onlyIf tarExists
|
2020-04-08 19:47:02 -04:00
|
|
|
commandLine 'tar', '-xvzf', "${-> buildDist.get().outputs.files.singleFile}", '-C', archiveExtractionDir
|
2018-03-08 22:46:54 -05:00
|
|
|
}
|
2018-04-24 12:10:51 -04:00
|
|
|
} else {
|
|
|
|
assert project.name.contains('zip')
|
2020-04-08 19:47:02 -04:00
|
|
|
checkExtraction.configure {
|
2018-04-24 12:10:51 -04:00
|
|
|
onlyIf unzipExists
|
2020-04-08 19:47:02 -04:00
|
|
|
commandLine 'unzip', "${-> buildDist.get().outputs.files.singleFile}", '-d', archiveExtractionDir
|
2018-03-08 22:46:54 -05:00
|
|
|
}
|
|
|
|
}
|
2018-04-24 12:10:51 -04:00
|
|
|
|
2018-12-05 07:06:11 -05:00
|
|
|
Closure toolExists
|
2018-04-24 12:10:51 -04:00
|
|
|
if (project.name.contains('tar')) {
|
|
|
|
toolExists = tarExists
|
|
|
|
} else {
|
|
|
|
assert project.name.contains('zip')
|
|
|
|
toolExists = unzipExists
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('checkLicense') {
|
2018-04-24 12:10:51 -04:00
|
|
|
dependsOn buildDist, checkExtraction
|
|
|
|
onlyIf toolExists
|
|
|
|
doLast {
|
2018-12-05 07:06:11 -05:00
|
|
|
String licenseFilename = null
|
2018-07-06 14:41:19 -04:00
|
|
|
if (project.name.contains('oss-') || project.name == 'integ-test-zip') {
|
2018-04-24 12:10:51 -04:00
|
|
|
licenseFilename = "APACHE-LICENSE-2.0.txt"
|
|
|
|
} else {
|
|
|
|
licenseFilename = "ELASTIC-LICENSE.txt"
|
|
|
|
}
|
|
|
|
final List<String> licenseLines = Files.readAllLines(rootDir.toPath().resolve("licenses/" + licenseFilename))
|
|
|
|
final Path licensePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/LICENSE.txt")
|
2018-04-25 09:38:31 -04:00
|
|
|
assertLinesInFile(licensePath, licenseLines)
|
2018-04-24 12:10:51 -04:00
|
|
|
}
|
|
|
|
}
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.named('check').configure { dependsOn checkLicense }
|
2018-04-24 12:10:51 -04:00
|
|
|
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.register('checkNotice') {
|
2018-04-24 12:10:51 -04:00
|
|
|
dependsOn buildDist, checkExtraction
|
|
|
|
onlyIf toolExists
|
|
|
|
doLast {
|
|
|
|
final List<String> noticeLines = Arrays.asList("Elasticsearch", "Copyright 2009-2018 Elasticsearch")
|
|
|
|
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/NOTICE.txt")
|
2018-04-25 09:38:31 -04:00
|
|
|
assertLinesInFile(noticePath, noticeLines)
|
2018-04-24 12:10:51 -04:00
|
|
|
}
|
|
|
|
}
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.named('check').configure { dependsOn checkNotice }
|
2018-04-24 12:10:51 -04:00
|
|
|
|
2018-04-30 15:05:27 -04:00
|
|
|
if (project.name == 'zip' || project.name == 'tar') {
|
2018-06-14 16:22:00 -04:00
|
|
|
project.ext.licenseName = 'Elastic License'
|
|
|
|
project.ext.licenseUrl = ext.elasticLicenseUrl
|
2020-04-08 19:47:02 -04:00
|
|
|
def checkMlCppNotice = tasks.register('checkMlCppNotice') {
|
2018-04-30 15:05:27 -04:00
|
|
|
dependsOn buildDist, checkExtraction
|
|
|
|
onlyIf toolExists
|
|
|
|
doLast {
|
|
|
|
// this is just a small sample from the C++ notices, the idea being that if we've added these lines we've probably added all the required lines
|
|
|
|
final List<String> expectedLines = Arrays.asList("Apache log4cxx", "Boost Software License - Version 1.0 - August 17th, 2003")
|
2018-05-16 18:35:57 -04:00
|
|
|
final Path noticePath = archiveExtractionDir.toPath().resolve("elasticsearch-${VersionProperties.elasticsearch}/modules/x-pack-ml/NOTICE.txt")
|
2018-04-30 15:05:27 -04:00
|
|
|
final List<String> actualLines = Files.readAllLines(noticePath)
|
|
|
|
for (final String expectedLine : expectedLines) {
|
|
|
|
if (actualLines.contains(expectedLine) == false) {
|
|
|
|
throw new GradleException("expected [${noticePath}] to contain [${expectedLine}] but it did not")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-04-08 19:47:02 -04:00
|
|
|
tasks.named('check').configure { dependsOn checkMlCppNotice }
|
2018-04-30 15:05:27 -04:00
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
|
2019-05-08 07:00:11 -04:00
|
|
|
subprojects {
|
|
|
|
group = "org.elasticsearch.distribution.${name.startsWith("oss-") ? "oss" : "default"}"
|
|
|
|
}
|
|
|
|
|
2018-02-21 20:46:40 -05:00
|
|
|
/*****************************************************************************
|
|
|
|
* Rest test config *
|
|
|
|
*****************************************************************************/
|
2018-03-08 22:46:54 -05:00
|
|
|
configure(subprojects.findAll { it.name == 'integ-test-zip' }) {
|
2018-02-21 20:46:40 -05:00
|
|
|
apply plugin: 'elasticsearch.standalone-rest-test'
|
|
|
|
apply plugin: 'elasticsearch.rest-test'
|
|
|
|
|
2019-05-08 07:00:11 -04:00
|
|
|
group = "org.elasticsearch.distribution.integ-test-zip"
|
|
|
|
|
2020-02-26 09:13:41 -05:00
|
|
|
restResources {
|
|
|
|
restTests {
|
|
|
|
includeCore '*'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-03-08 22:46:54 -05:00
|
|
|
integTest {
|
2018-02-21 20:46:40 -05:00
|
|
|
dependsOn assemble
|
2019-10-07 04:43:57 -04:00
|
|
|
runner {
|
|
|
|
if (Os.isFamily(Os.FAMILY_WINDOWS) && System.getProperty('tests.timeoutSuite') == null) {
|
|
|
|
// override the suite timeout to 30 mins for windows, because it has the most inefficient filesystem known to man
|
|
|
|
systemProperty 'tests.timeoutSuite', '1800000!'
|
|
|
|
}
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
processTestResources {
|
|
|
|
inputs.properties(project(':distribution').restTestExpansions)
|
|
|
|
MavenFilteringHack.filter(it, project(':distribution').restTestExpansions)
|
|
|
|
}
|
|
|
|
|
2019-05-08 07:00:11 -04:00
|
|
|
|
|
|
|
// The integ-test-distribution is published to maven
|
2018-02-21 20:46:40 -05:00
|
|
|
BuildPlugin.configurePomGeneration(project)
|
|
|
|
apply plugin: 'nebula.maven-base-publish'
|
|
|
|
apply plugin: 'nebula.maven-scm'
|
|
|
|
|
2018-02-23 11:03:17 -05:00
|
|
|
// make the pom file name use elasticsearch instead of the project name
|
|
|
|
archivesBaseName = "elasticsearch${it.name.contains('oss') ? '-oss' : ''}"
|
2018-02-21 20:46:40 -05:00
|
|
|
|
|
|
|
publishing {
|
|
|
|
publications {
|
|
|
|
nebula {
|
2018-02-23 11:03:17 -05:00
|
|
|
artifactId archivesBaseName
|
2020-04-08 19:47:02 -04:00
|
|
|
artifact(buildDist.flatMap { it.archiveFile })
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
/*
|
|
|
|
* HUGE HACK: the underlying maven publication library refuses to
|
|
|
|
* deploy any attached artifacts when the packaging type is set to
|
|
|
|
* 'pom'. But Sonatype's OSS repositories require source files for
|
|
|
|
* artifacts that are of type 'zip'. We already publish the source
|
|
|
|
* and javadoc for Elasticsearch under the various other subprojects.
|
|
|
|
* So here we create another publication using the same name that
|
|
|
|
* has the "real" pom, and rely on the fact that gradle will execute
|
|
|
|
* the publish tasks in alphabetical order. This lets us publish the
|
|
|
|
* zip file and even though the pom says the type is 'pom' instead of
|
|
|
|
* 'zip'. We cannot setup a dependency between the tasks because the
|
|
|
|
* publishing tasks are created *extremely* late in the configuration
|
|
|
|
* phase, so that we cannot get ahold of the actual task. Furthermore,
|
|
|
|
* this entire hack only exists so we can make publishing to maven
|
|
|
|
* local work, since we publish to maven central externally.
|
|
|
|
*/
|
|
|
|
nebulaRealPom(MavenPublication) {
|
2018-02-23 11:03:17 -05:00
|
|
|
artifactId archivesBaseName
|
2018-02-21 20:46:40 -05:00
|
|
|
pom.packaging = 'pom'
|
|
|
|
pom.withXml { XmlProvider xml ->
|
|
|
|
Node root = xml.asNode()
|
|
|
|
root.appendNode('name', 'Elasticsearch')
|
|
|
|
root.appendNode('description', 'A Distributed RESTful Search Engine')
|
2020-04-08 19:47:02 -04:00
|
|
|
root.appendNode('url', PluginBuildPlugin.urlFromOrigin(BuildParams.gitOrigin))
|
2018-02-21 20:46:40 -05:00
|
|
|
Node scmNode = root.appendNode('scm')
|
2020-04-08 19:47:02 -04:00
|
|
|
scmNode.appendNode('url', BuildParams.gitOrigin)
|
2018-02-21 20:46:40 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|