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