@@ -23,10 +23,16 @@ import org.gradle.util.GradleVersion
2323plugins {
2424 id ' java-gradle-plugin'
2525 id ' groovy'
26+ id ' java-test-fixtures'
2627}
2728
2829group = ' org.elasticsearch.gradle'
2930
31+ String minimumGradleVersion = file(' src/main/resources/minimumGradleVersion' ). text. trim()
32+ if (GradleVersion . current() < GradleVersion . version(minimumGradleVersion)) {
33+ throw new GradleException (" Gradle ${ minimumGradleVersion} + is required to build elasticsearch" )
34+ }
35+
3036if (project == rootProject) {
3137 // change the build dir used during build init, so that doing a clean
3238 // won't wipe out the buildscript jar
@@ -64,6 +70,11 @@ if (JavaVersion.current() < JavaVersion.VERSION_11) {
6470sourceSets {
6571 // We have a few classes that need to be compiled for older java versions
6672 minimumRuntime {}
73+
74+ integTest {
75+ compileClasspath + = sourceSets[" main" ]. output + configurations[" testRuntimeClasspath" ]
76+ runtimeClasspath + = output + compileClasspath
77+ }
6778}
6879
6980configurations {
@@ -117,8 +128,10 @@ dependencies {
117128 compile ' com.networknt:json-schema-validator:1.0.36'
118129 compileOnly " com.puppycrawl.tools:checkstyle:${ props.getProperty('checkstyle')} "
119130 testCompile " com.puppycrawl.tools:checkstyle:${ props.getProperty('checkstyle')} "
120- testCompile " junit:junit:${ props.getProperty('junit')} "
121- testCompile " com.carrotsearch.randomizedtesting:randomizedtesting-runner:${ props.getProperty('randomizedrunner')} "
131+ testFixturesApi " junit:junit:${ props.getProperty('junit')} "
132+ testFixturesApi " com.carrotsearch.randomizedtesting:randomizedtesting-runner:${ props.getProperty('randomizedrunner')} "
133+ testFixturesApi gradleApi()
134+ testFixturesApi gradleTestKit()
122135 testCompile ' com.github.tomakehurst:wiremock-jre8-standalone:2.23.2'
123136 testCompile ' org.mockito:mockito-core:1.9.5'
124137 minimumRuntimeCompile " junit:junit:${ props.getProperty('junit')} "
@@ -165,10 +178,11 @@ if (project != rootProject) {
165178 // build-tools is not ready for primetime with these...
166179 dependencyLicenses. enabled = false
167180 dependenciesInfo. enabled = false
168- disableTasks(' forbiddenApisMain' , ' forbiddenApisMinimumRuntime' , ' forbiddenApisTest' )
181+ disableTasks(' forbiddenApisMain' , ' forbiddenApisMinimumRuntime' ,
182+ ' forbiddenApisTest' , ' forbiddenApisIntegTest' , ' forbiddenApisTestFixtures' )
169183 jarHell. enabled = false
170184 thirdPartyAudit. enabled = false
171- if (Boolean . parseBoolean(System . getProperty(" tests.fips.enabled" ))){
185+ if (Boolean . parseBoolean(System . getProperty(" tests.fips.enabled" ))) {
172186 test. enabled = false
173187 }
174188
@@ -237,6 +251,8 @@ if (project != rootProject) {
237251 systemProperty ' test.version_under_test' , version
238252 onlyIf { org.elasticsearch.gradle.info.BuildParams . inFipsJvm == false }
239253 maxParallelForks = System . getProperty(' tests.jvms' , org.elasticsearch.gradle.info.BuildParams . defaultParallel. toString()) as Integer
254+ testClassesDirs = sourceSets. integTest. output. classesDirs
255+ classpath = sourceSets. integTest. runtimeClasspath
240256 }
241257 check. dependsOn(" integTest" )
242258
@@ -252,6 +268,11 @@ if (project != rootProject) {
252268 afterEvaluate {
253269 generatePomFileForPluginMavenPublication. enabled = false
254270 }
271+
272+ publishing. publications. named(" nebula" ). configure {
273+ suppressPomMetadataWarningsFor(" testFixturesApiElements" )
274+ suppressPomMetadataWarningsFor(" testFixturesRuntimeElements" )
275+ }
255276}
256277
257278// Define this here because we need it early.
0 commit comments