@@ -20,6 +20,8 @@ import org.elasticsearch.gradle.transform.FilteringJarTransform
2020import java.nio.file.Files
2121import java.nio.file.Path
2222
23+ import static org.elasticsearch.gradle.internal.toolchain.EarlyAccessCatalogJdkToolchainResolver.findLatestEABuildNumber
24+
2325plugins {
2426 id ' base'
2527 id ' elasticsearch.distro'
@@ -48,9 +50,9 @@ dependencies {
4850
4951def thisProj = project
5052rootProject. allprojects { proj ->
51- proj. plugins. withType(DependenciesInfoPlugin ) {
52- thisProj. dependencies. add(" dependencyInfos" , project. dependencies. project(path : proj. path))
53- }
53+ proj. plugins. withType(DependenciesInfoPlugin ) {
54+ thisProj. dependencies. add(" dependencyInfos" , project. dependencies. project(path : proj. path))
55+ }
5456}
5557
5658/* ****************************************************************************
@@ -61,9 +63,10 @@ rootProject.allprojects { proj ->
6163tasks. register(" generateDependenciesReport" , ConcatFilesTask ) {
6264 files = configurations. dependencyInfos
6365 headerLine = " name,version,url,license,sourceURL"
64- target = new File (providers. systemProperty(' csv' )
65- .orElse(" ${ project.buildDir} /reports/dependencies/es-dependencies.csv" )
66- .get()
66+ target = new File (
67+ providers. systemProperty(' csv' )
68+ .orElse(" ${ project.buildDir} /reports/dependencies/es-dependencies.csv" )
69+ .get()
6770 )
6871 // explicitly add our dependency on the JDK
6972 String jdkVersion = VersionProperties . versions. get(' bundled_jdk' ). split(' @' )[0 ]
@@ -246,20 +249,45 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
246249 apply plugin : ' elasticsearch.jdk-download'
247250 apply plugin : ' elasticsearch.repositories'
248251
249- // Setup all required JDKs
250- project. jdks {
251- [' darwin' , ' windows' , ' linux' ]. each { platform ->
252- (platform == ' linux' || platform == ' darwin' ? [' x64' , ' aarch64' ] : [' x64' ]). each { architecture ->
253- " bundled_${ platform} _${ architecture} " {
254- it. platform = platform
255- it. version = VersionProperties . bundledJdkVersion
256- it. vendor = VersionProperties . bundledJdkVendor
257- it. architecture = architecture
252+ if (buildParams. getIsEarlyAccessRuntimeJavaVersion()) {
253+ Integer buildNumber = Integer . getInteger(" runtime.java.build" );
254+ def runtimeJavaMajorVersion = Integer . parseInt(buildParams. runtimeJavaVersion. get(). getMajorVersion())
255+ if (buildNumber == null ) {
256+ buildNumber = findLatestEABuildNumber(runtimeJavaMajorVersion);
257+ }
258+ String eaVersionString = String . format(" %d-ea+%d" , runtimeJavaMajorVersion, buildNumber);
259+
260+ project. jdks {
261+ [' darwin' , ' windows' , ' linux' ]. each { platform ->
262+ (platform == ' linux' || platform == ' darwin' ? [' x64' , ' aarch64' ] : [' x64' ]). each { architecture ->
263+ " bundled_${ platform} _${ architecture} " {
264+ it. version = eaVersionString;
265+ it. vendor = " openjdk"
266+ it. platform = platform
267+ it. architecture = architecture
268+ it. distributionVersion = " ea"
269+ }
270+ }
271+ }
272+ }
273+ } else {
274+ // Setup all required JDKs
275+ project. jdks {
276+ [' darwin' , ' windows' , ' linux' ]. each { platform ->
277+ (platform == ' linux' || platform == ' darwin' ? [' x64' , ' aarch64' ] : [' x64' ]). each { architecture ->
278+ " bundled_${ platform} _${ architecture} " {
279+ it. platform = platform
280+ it. version = VersionProperties . bundledJdkVersion
281+ it. vendor = VersionProperties . bundledJdkVendor
282+ it. architecture = architecture
283+ }
258284 }
259285 }
260286 }
287+
261288 }
262289
290+
263291 // TODO: the map needs to be an input of the tasks, so that when it changes, the task will re-run...
264292 /* ****************************************************************************
265293 * Properties to expand when copying packaging files *
@@ -288,7 +316,8 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
288316 }
289317 all {
290318 resolutionStrategy. dependencySubstitution {
291- substitute module(" org.apache.logging.log4j:log4j-core" ) using project(" :libs:log4j" ) because " patched to remove JndiLookup class" }
319+ substitute module(" org.apache.logging.log4j:log4j-core" ) using project(" :libs:log4j" ) because " patched to remove JndiLookup class"
320+ }
292321 }
293322 }
294323
@@ -354,7 +383,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
354383 into(' platform' ) {
355384 from(configurations. libsNative)
356385 if (os != null ) {
357- include (os + ' -' + architecture + ' /*' )
386+ include(os + ' -' + architecture + ' /*' )
358387 }
359388 }
360389 into(' entitlement-agent' ) {
@@ -416,7 +445,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
416445 // main config files, processed with distribution specific substitutions
417446 from ' ../src/config'
418447 exclude ' log4j2.properties' // this is handled separately below
419- filter(" tokens" : expansionsForDistribution(distributionType, isTestDistro), ReplaceTokens . class)
448+ filter(" tokens" : expansionsForDistribution(distributionType, isTestDistro), ReplaceTokens . class)
420449 }
421450 from buildDefaultLog4jConfigTaskProvider
422451 from isTestDistro ? integTestConfigFiles : defaultConfigFiles
@@ -431,19 +460,19 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
431460 exclude ' *.exe'
432461 exclude ' *.bat'
433462 eachFile {
434- it. permissions{
463+ it. permissions {
435464 unix(0755 )
436465 }
437466 }
438- filter(" tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens . class)
467+ filter(" tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens . class)
439468 }
440469 // windows files, only for zip
441470 if (distributionType == ' zip' ) {
442471 with copySpec {
443472 from ' ../src/bin'
444473 include ' *.bat'
445474 filter(FixCrLfFilter , eol : FixCrLfFilter.CrLf . newInstance(' crlf' ))
446- filter(" tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens . class)
475+ filter(" tokens" : expansionsForDistribution(distributionType, testDistro), ReplaceTokens . class)
447476 }
448477 with copySpec {
449478 from ' ../src/bin'
@@ -466,7 +495,7 @@ configure(subprojects.findAll { ['archives', 'packages'].contains(it.name) }) {
466495 if (testDistro) {
467496 from buildServerNoticeTaskProvider
468497 } else {
469- from (buildDefaultNoticeTaskProvider) {
498+ from(buildDefaultNoticeTaskProvider) {
470499 filePermissions {
471500 unix(0644 )
472501 }
@@ -547,57 +576,57 @@ subprojects {
547576 String footer = " # Built for ${ project.name} -${ project.version} " +
548577 " (${ distributionType} )"
549578 Map<String , Object > expansions = [
550- ' project.name' : project. name,
551- ' project.version' : version,
579+ ' project.name' : project. name,
580+ ' project.version' : version,
552581 ' project.minor.version' : " ${ VersionProperties.elasticsearchVersion.major} .${ VersionProperties.elasticsearchVersion.minor} " ,
553582
554- ' path.conf' : [
583+ ' path.conf' : [
555584 ' deb' : ' /etc/elasticsearch' ,
556585 ' rpm' : ' /etc/elasticsearch' ,
557586 ' def' : ' "$ES_HOME"/config'
558587 ],
559- ' path.data' : [
588+ ' path.data' : [
560589 ' deb' : packagingPathData,
561590 ' rpm' : packagingPathData,
562591 ' def' : ' #path.data: /path/to/data'
563592 ],
564- ' path.env' : [
593+ ' path.env' : [
565594 ' deb' : ' /etc/default/elasticsearch' ,
566595 ' rpm' : ' /etc/sysconfig/elasticsearch' ,
567596 /* There isn't one of these files for tar or zip but its important to
568597 make an empty string here so the script can properly skip it. */
569598 ' def' : ' if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; done' ,
570599 ],
571- ' source.path.env' : [
600+ ' source.path.env' : [
572601 ' deb' : ' source /etc/default/elasticsearch' ,
573602 ' rpm' : ' source /etc/sysconfig/elasticsearch' ,
574603 ' def' : ' if [ -z "$ES_PATH_CONF" ]; then ES_PATH_CONF="$ES_HOME"/config; fi' ,
575604 ],
576- ' path.logs' : [
605+ ' path.logs' : [
577606 ' deb' : packagingPathLogs,
578607 ' rpm' : packagingPathLogs,
579608 ' def' : ' #path.logs: /path/to/logs'
580609 ],
581610
582- ' scripts.footer' : [
611+ ' scripts.footer' : [
583612 /* Debian needs exit 0 on these scripts so we add it here and preserve
584613 the pretty footer. */
585614 ' deb' : " exit 0\n ${ footer} " ,
586615 ' def' : footer
587616 ],
588617
589- ' es.distribution.type' : [
618+ ' es.distribution.type' : [
590619 ' deb' : ' deb' ,
591620 ' rpm' : ' rpm' ,
592621 ' tar' : ' tar' ,
593622 ' zip' : ' zip'
594623 ],
595624
596- ' license.name' : [
625+ ' license.name' : [
597626 ' deb' : ' Elastic-License'
598627 ],
599628
600- ' license.text' : [
629+ ' license.text' : [
601630 ' deb' : licenseText,
602631 ],
603632 ]
0 commit comments