|
@@ -20,6 +20,8 @@ import org.elasticsearch.gradle.transform.FilteringJarTransform
|
|
|
import java.nio.file.Files
|
|
|
import java.nio.file.Path
|
|
|
|
|
|
+import static org.elasticsearch.gradle.internal.toolchain.EarlyAccessCatalogJdkToolchainResolver.findLatestPreReleaseBuildNumber
|
|
|
+
|
|
|
plugins {
|
|
|
id 'base'
|
|
|
id 'elasticsearch.distro'
|
|
@@ -48,9 +50,9 @@ dependencies {
|
|
|
|
|
|
def thisProj = project
|
|
|
rootProject.allprojects { proj ->
|
|
|
- proj.plugins.withType(DependenciesInfoPlugin) {
|
|
|
- thisProj.dependencies.add("dependencyInfos", project.dependencies.project(path: proj.path))
|
|
|
- }
|
|
|
+ proj.plugins.withType(DependenciesInfoPlugin) {
|
|
|
+ thisProj.dependencies.add("dependencyInfos", project.dependencies.project(path: proj.path))
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
/*****************************************************************************
|
|
@@ -61,9 +63,10 @@ rootProject.allprojects { proj ->
|
|
|
tasks.register("generateDependenciesReport", ConcatFilesTask) {
|
|
|
files = configurations.dependencyInfos
|
|
|
headerLine = "name,version,url,license,sourceURL"
|
|
|
- target = new File(providers.systemProperty('csv')
|
|
|
- .orElse("${project.buildDir}/reports/dependencies/es-dependencies.csv")
|
|
|
- .get()
|
|
|
+ target = new File(
|
|
|
+ providers.systemProperty('csv')
|
|
|
+ .orElse("${project.buildDir}/reports/dependencies/es-dependencies.csv")
|
|
|
+ .get()
|
|
|
)
|
|
|
// explicitly add our dependency on the JDK
|
|
|
String jdkVersion = VersionProperties.versions.get('bundled_jdk').split('@')[0]
|
|
@@ -246,20 +249,46 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
apply plugin: 'elasticsearch.jdk-download'
|
|
|
apply plugin: 'elasticsearch.repositories'
|
|
|
|
|
|
- // Setup all required JDKs
|
|
|
- project.jdks {
|
|
|
- ['darwin', 'windows', 'linux'].each { platform ->
|
|
|
- (platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64'] : ['x64']).each { architecture ->
|
|
|
- "bundled_${platform}_${architecture}" {
|
|
|
- it.platform = platform
|
|
|
- it.version = VersionProperties.bundledJdkVersion
|
|
|
- it.vendor = VersionProperties.bundledJdkVendor
|
|
|
- it.architecture = architecture
|
|
|
+ if (buildParams.runtimeJava.preRelease) {
|
|
|
+ Integer buildNumber = Integer.getInteger("runtime.java.build")
|
|
|
+ String preReleaseType = buildParams.runtimeJava.preReleaseType
|
|
|
+ def runtimeJavaMajorVersion = Integer.parseInt(buildParams.runtimeJavaVersion.get().getMajorVersion())
|
|
|
+ if (buildNumber == null) {
|
|
|
+ buildNumber = findLatestPreReleaseBuildNumber(runtimeJavaMajorVersion, preReleaseType);
|
|
|
+ }
|
|
|
+ String preReleaseVersionString = String.format("%d-%s+%d", runtimeJavaMajorVersion, preReleaseType, buildNumber);
|
|
|
+
|
|
|
+ project.jdks {
|
|
|
+ ['darwin', 'windows', 'linux'].each { platform ->
|
|
|
+ (platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64'] : ['x64']).each { architecture ->
|
|
|
+ "bundled_${platform}_${architecture}" {
|
|
|
+ it.version = preReleaseVersionString;
|
|
|
+ it.vendor = "openjdk"
|
|
|
+ it.platform = platform
|
|
|
+ it.architecture = architecture
|
|
|
+ it.distributionVersion = preReleaseType
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ // Setup all required JDKs
|
|
|
+ project.jdks {
|
|
|
+ ['darwin', 'windows', 'linux'].each { platform ->
|
|
|
+ (platform == 'linux' || platform == 'darwin' ? ['x64', 'aarch64'] : ['x64']).each { architecture ->
|
|
|
+ "bundled_${platform}_${architecture}" {
|
|
|
+ it.platform = platform
|
|
|
+ it.version = VersionProperties.bundledJdkVersion
|
|
|
+ it.vendor = VersionProperties.bundledJdkVendor
|
|
|
+ it.architecture = architecture
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
+
|
|
|
// TODO: the map needs to be an input of the tasks, so that when it changes, the task will re-run...
|
|
|
/*****************************************************************************
|
|
|
* Properties to expand when copying packaging files *
|
|
@@ -288,7 +317,8 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
}
|
|
|
all {
|
|
|
resolutionStrategy.dependencySubstitution {
|
|
|
- substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:log4j") because "patched to remove JndiLookup class"}
|
|
|
+ substitute module("org.apache.logging.log4j:log4j-core") using project(":libs:log4j") because "patched to remove JndiLookup class"
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -354,7 +384,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
into('platform') {
|
|
|
from(configurations.libsNative)
|
|
|
if (os != null) {
|
|
|
- include (os + '-' + architecture + '/*')
|
|
|
+ include(os + '-' + architecture + '/*')
|
|
|
}
|
|
|
}
|
|
|
into('entitlement-agent') {
|
|
@@ -416,7 +446,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
// main config files, processed with distribution specific substitutions
|
|
|
from '../src/config'
|
|
|
exclude 'log4j2.properties' // this is handled separately below
|
|
|
- filter("tokens" : expansionsForDistribution(distributionType, isTestDistro), ReplaceTokens.class)
|
|
|
+ filter("tokens": expansionsForDistribution(distributionType, isTestDistro), ReplaceTokens.class)
|
|
|
}
|
|
|
from buildDefaultLog4jConfigTaskProvider
|
|
|
from isTestDistro ? integTestConfigFiles : defaultConfigFiles
|
|
@@ -431,11 +461,11 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
exclude '*.exe'
|
|
|
exclude '*.bat'
|
|
|
eachFile {
|
|
|
- it.permissions{
|
|
|
+ it.permissions {
|
|
|
unix(0755)
|
|
|
}
|
|
|
}
|
|
|
- filter("tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
|
|
|
+ filter("tokens": expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
|
|
|
}
|
|
|
// windows files, only for zip
|
|
|
if (distributionType == 'zip') {
|
|
@@ -443,7 +473,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
from '../src/bin'
|
|
|
include '*.bat'
|
|
|
filter(FixCrLfFilter, eol: FixCrLfFilter.CrLf.newInstance('crlf'))
|
|
|
- filter("tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
|
|
|
+ filter("tokens": expansionsForDistribution(distributionType, testDistro), ReplaceTokens.class)
|
|
|
}
|
|
|
with copySpec {
|
|
|
from '../src/bin'
|
|
@@ -466,7 +496,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
|
|
|
if (testDistro) {
|
|
|
from buildServerNoticeTaskProvider
|
|
|
} else {
|
|
|
- from (buildDefaultNoticeTaskProvider) {
|
|
|
+ from(buildDefaultNoticeTaskProvider) {
|
|
|
filePermissions {
|
|
|
unix(0644)
|
|
|
}
|
|
@@ -547,57 +577,57 @@ subprojects {
|
|
|
String footer = "# Built for ${project.name}-${project.version} " +
|
|
|
"(${distributionType})"
|
|
|
Map<String, Object> expansions = [
|
|
|
- 'project.name': project.name,
|
|
|
- 'project.version': version,
|
|
|
+ 'project.name' : project.name,
|
|
|
+ 'project.version' : version,
|
|
|
'project.minor.version': "${VersionProperties.elasticsearchVersion.major}.${VersionProperties.elasticsearchVersion.minor}",
|
|
|
|
|
|
- 'path.conf': [
|
|
|
+ 'path.conf' : [
|
|
|
'deb': '/etc/elasticsearch',
|
|
|
'rpm': '/etc/elasticsearch',
|
|
|
'def': '"$ES_HOME"/config'
|
|
|
],
|
|
|
- 'path.data': [
|
|
|
+ 'path.data' : [
|
|
|
'deb': packagingPathData,
|
|
|
'rpm': packagingPathData,
|
|
|
'def': '#path.data: /path/to/data'
|
|
|
],
|
|
|
- 'path.env': [
|
|
|
+ 'path.env' : [
|
|
|
'deb': '/etc/default/elasticsearch',
|
|
|
'rpm': '/etc/sysconfig/elasticsearch',
|
|
|
/* There isn't one of these files for tar or zip but its important to
|
|
|
make an empty string here so the script can properly skip it. */
|
|
|
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done',
|
|
|
],
|
|
|
- 'source.path.env': [
|
|
|
+ 'source.path.env' : [
|
|
|
'deb': 'source /etc/default/elasticsearch',
|
|
|
'rpm': 'source /etc/sysconfig/elasticsearch',
|
|
|
'def': 'if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi',
|
|
|
],
|
|
|
- 'path.logs': [
|
|
|
+ 'path.logs' : [
|
|
|
'deb': packagingPathLogs,
|
|
|
'rpm': packagingPathLogs,
|
|
|
'def': '#path.logs: /path/to/logs'
|
|
|
],
|
|
|
|
|
|
- 'scripts.footer': [
|
|
|
+ 'scripts.footer' : [
|
|
|
/* Debian needs exit 0 on these scripts so we add it here and preserve
|
|
|
the pretty footer. */
|
|
|
'deb': "exit 0\n${footer}",
|
|
|
'def': footer
|
|
|
],
|
|
|
|
|
|
- 'es.distribution.type': [
|
|
|
+ 'es.distribution.type' : [
|
|
|
'deb': 'deb',
|
|
|
'rpm': 'rpm',
|
|
|
'tar': 'tar',
|
|
|
'zip': 'zip'
|
|
|
],
|
|
|
|
|
|
- 'license.name': [
|
|
|
+ 'license.name' : [
|
|
|
'deb': 'Elastic-License'
|
|
|
],
|
|
|
|
|
|
- 'license.text': [
|
|
|
+ 'license.text' : [
|
|
|
'deb': licenseText,
|
|
|
],
|
|
|
]
|