@@ -31,22 +31,12 @@ if (GradleVersion.current() < GradleVersion.version(minimumGradleVersion)) {
31
31
throw new GradleException (" Gradle ${ minimumGradleVersion} + is required to build elasticsearch" )
32
32
}
33
33
34
- if (JavaVersion . current() < JavaVersion . VERSION_1_8 ) {
35
- throw new GradleException (' Java 1.8 is required to build elasticsearch gradle tools' )
36
- }
37
-
38
34
if (project == rootProject) {
39
35
// change the build dir used during build init, so that doing a clean
40
36
// won't wipe out the buildscript jar
41
37
buildDir = ' build-bootstrap'
42
38
}
43
39
44
- // Make sure :buildSrc: doesn't generate classes incompatible with RUNTIME_JAVA_HOME
45
- // We can't use BuildPlugin here, so read from file
46
- String minimumRuntimeVersion = file(' src/main/resources/minimumRuntimeVersion' ). text. trim()
47
- targetCompatibility = minimumRuntimeVersion
48
- sourceCompatibility = minimumRuntimeVersion
49
-
50
40
/* ****************************************************************************
51
41
* Propagating version.properties to the rest of the build *
52
42
*****************************************************************************/
@@ -82,6 +72,45 @@ processResources {
82
72
from tempPropertiesFile
83
73
}
84
74
75
+
76
+ if (JavaVersion . current() < JavaVersion . VERSION_1_10 ) {
77
+ throw new GradleException (' At least Java 10 is required to build elasticsearch gradle tools' )
78
+ }
79
+
80
+ /* ****************************************************************************
81
+ * Java version *
82
+ *****************************************************************************/
83
+
84
+ // Gradle 4.10 does not support setting this to 11 yet
85
+ targetCompatibility = " 10"
86
+ sourceCompatibility = " 10"
87
+
88
+ // We have a few classes that need to be compiled for older java versions because these are used to run checks against
89
+ // those
90
+ sourceSets {
91
+ minimumRuntime {
92
+ // We only want Java here, but the Groovy doesn't configure javadoc correctly if we don't define this as groovy
93
+ groovy {
94
+ srcDirs = [' src/main/minimumRuntime' ]
95
+ }
96
+ }
97
+ }
98
+ compileMinimumRuntimeGroovy {
99
+ // We can't use BuildPlugin here, so read from file
100
+ String minimumRuntimeVersion = file(' src/main/resources/minimumRuntimeVersion' ). text. trim()
101
+ targetCompatibility = minimumRuntimeVersion
102
+ sourceCompatibility = minimumRuntimeVersion
103
+ }
104
+ dependencies {
105
+ compile sourceSets. minimumRuntime. output
106
+ minimumRuntimeCompile " junit:junit:${ props.getProperty('junit')} "
107
+ minimumRuntimeCompile localGroovy()
108
+ }
109
+ jar {
110
+ from sourceSets. minimumRuntime. output
111
+ }
112
+
113
+
85
114
/* ****************************************************************************
86
115
* Dependencies used by the entire build *
87
116
*****************************************************************************/
@@ -94,10 +123,7 @@ dependencies {
94
123
compile localGroovy()
95
124
compile " com.carrotsearch.randomizedtesting:junit4-ant:${ props.getProperty('randomizedrunner')} "
96
125
compile " com.carrotsearch.randomizedtesting:randomizedtesting-runner:${ props.getProperty('randomizedrunner')} "
97
-
98
- compile(" junit:junit:${ props.getProperty('junit')} " ) {
99
- transitive = false
100
- }
126
+
101
127
compile ' com.netflix.nebula:gradle-extra-configurations-plugin:3.0.3'
102
128
compile ' com.netflix.nebula:nebula-publishing-plugin:4.4.4'
103
129
compile ' com.netflix.nebula:gradle-info-plugin:3.0.3'
@@ -156,6 +182,7 @@ if (project != rootProject) {
156
182
dependenciesInfo. enabled = false
157
183
forbiddenApisMain. enabled = false
158
184
forbiddenApisTest. enabled = false
185
+ forbiddenApisMinimumRuntime. enabled = false
159
186
jarHell. enabled = false
160
187
thirdPartyAudit. enabled = false
161
188
0 commit comments