Skip to content

Commit 8f6c074

Browse files
authored
Revert "Make build Gradle 2.14 / 3.x compatible (elastic#22669)"
This reverts commit 652cb7d. Relates elastic#22727
1 parent 3bf06d1 commit 8f6c074

File tree

10 files changed

+19
-81
lines changed

10 files changed

+19
-81
lines changed

buildSrc/build.gradle

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,14 @@ apply plugin: 'groovy'
2323

2424
group = 'org.elasticsearch.gradle'
2525

26-
if (GradleVersion.current() < GradleVersion.version('2.13')) {
27-
throw new GradleException('Gradle 2.13+ is required to build elasticsearch')
26+
// TODO: remove this when upgrading to a version that supports ProgressLogger
27+
// gradle 2.14 made internal apis unavailable to plugins, and gradle considered
28+
// ProgressLogger to be an internal api. Until this is made available again,
29+
// we can't upgrade without losing our nice progress logging
30+
// NOTE that this check duplicates that in BuildPlugin, but we need to check
31+
// early here before trying to compile the broken classes in buildSrc
32+
if (GradleVersion.current() != GradleVersion.version('2.13')) {
33+
throw new GradleException('Gradle 2.13 is required to build elasticsearch')
2834
}
2935

3036
if (project == rootProject) {
@@ -90,25 +96,9 @@ dependencies {
9096
compile 'com.perforce:p4java:2012.3.551082' // THIS IS SUPPOSED TO BE OPTIONAL IN THE FUTURE....
9197
compile 'de.thetaphi:forbiddenapis:2.2'
9298
compile 'org.apache.rat:apache-rat:0.11'
99+
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1'
93100
}
94101

95-
// Gradle version-specific options (allows build to run with Gradle 2.13 as well as 2.14+/3.+)
96-
if (GradleVersion.current() == GradleVersion.version("2.13")) {
97-
// ProgressLogger(-Factory) classes are part of the public Gradle API
98-
// Add default imports for (org.gradle.logging)
99-
compileGroovy.groovyOptions.configurationScript = file('src/compile/groovy/gradle-2.13-loggers.groovy')
100-
dependencies {
101-
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.0.1' // last version compatible with Gradle 2.13
102-
}
103-
} else {
104-
// Gradle 2.14+ removed ProgressLogger(-Factory) classes from the public APIs
105-
// Use logging dependency and add default imports for "org.gradle.internal.logging.progress"
106-
compileGroovy.groovyOptions.configurationScript = file('src/compile/groovy/gradle-2.14-loggers.groovy')
107-
dependencies {
108-
compileOnly "org.gradle:gradle-logging:${GradleVersion.current().getVersion()}"
109-
compile 'ru.vyarus:gradle-animalsniffer-plugin:1.2.0' // Gradle 2.14 requires a version > 1.0.1
110-
}
111-
}
112102

113103
/*****************************************************************************
114104
* Bootstrap repositories *

buildSrc/src/compile/groovy/gradle-2.13-loggers.groovy

Lines changed: 0 additions & 26 deletions
This file was deleted.

buildSrc/src/compile/groovy/gradle-2.14-loggers.groovy

Lines changed: 0 additions & 26 deletions
This file was deleted.

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/RandomizedTestingTask.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import org.gradle.api.tasks.Optional
1919
import org.gradle.api.tasks.TaskAction
2020
import org.gradle.api.tasks.util.PatternFilterable
2121
import org.gradle.api.tasks.util.PatternSet
22+
import org.gradle.logging.ProgressLoggerFactory
2223
import org.gradle.util.ConfigureUtil
2324

2425
import javax.inject.Inject

buildSrc/src/main/groovy/com/carrotsearch/gradle/junit4/TestProgressLogger.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedStartEvent
2525
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedSuiteResultEvent
2626
import com.carrotsearch.ant.tasks.junit4.events.aggregated.AggregatedTestResultEvent
2727
import com.carrotsearch.ant.tasks.junit4.listeners.AggregatedEventListener
28+
import org.gradle.logging.ProgressLogger
29+
import org.gradle.logging.ProgressLoggerFactory
2830

2931
import static com.carrotsearch.ant.tasks.junit4.FormattingUtils.formatDurationInSeconds
3032
import static com.carrotsearch.ant.tasks.junit4.events.aggregated.TestStatus.ERROR

buildSrc/src/main/groovy/org/elasticsearch/gradle/BuildPlugin.groovy

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -419,10 +419,8 @@ class BuildPlugin implements Plugin<Project> {
419419
// hack until gradle supports java 9's new "--release" arg
420420
assert minimumJava == JavaVersion.VERSION_1_8
421421
options.compilerArgs << '--release' << '8'
422-
doFirst{
423-
sourceCompatibility = null
424-
targetCompatibility = null
425-
}
422+
project.sourceCompatibility = null
423+
project.targetCompatibility = null
426424
}
427425
}
428426
}

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/TapLoggerOutputStream.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ import com.carrotsearch.gradle.junit4.LoggingOutputStream
2222
import groovy.transform.PackageScope
2323
import org.gradle.api.GradleScriptException
2424
import org.gradle.api.logging.Logger
25+
import org.gradle.logging.ProgressLogger
26+
import org.gradle.logging.ProgressLoggerFactory
2527

2628
import java.util.regex.Matcher
2729

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantCommandTask.groovy

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ package org.elasticsearch.gradle.vagrant
2121
import org.apache.commons.io.output.TeeOutputStream
2222
import org.elasticsearch.gradle.LoggedExec
2323
import org.gradle.api.tasks.Input
24+
import org.gradle.logging.ProgressLoggerFactory
2425

2526
import javax.inject.Inject
2627

buildSrc/src/main/groovy/org/elasticsearch/gradle/vagrant/VagrantLoggerOutputStream.groovy

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ package org.elasticsearch.gradle.vagrant
2020

2121
import com.carrotsearch.gradle.junit4.LoggingOutputStream
2222
import org.gradle.api.logging.Logger
23+
import org.gradle.logging.ProgressLogger
24+
import org.gradle.logging.ProgressLoggerFactory
2325

2426
/**
2527
* Adapts an OutputStream being written to by vagrant into a ProcessLogger. It

plugins/repository-hdfs/build.gradle

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,9 +368,3 @@ thirdPartyAudit.excludes = [
368368
'org.apache.log4j.helpers.ISO8601DateFormat',
369369
'org.apache.log4j.spi.ThrowableInformation'
370370
]
371-
372-
// Gradle 2.13 bundles org.slf4j.impl.StaticLoggerBinder in its core.jar which leaks into the forbidden APIs ant task
373-
// Gradle 2.14+ does not bundle this class anymore so we need to properly exclude it here.
374-
if (GradleVersion.current() > GradleVersion.version("2.13")) {
375-
thirdPartyAudit.excludes += ['org.slf4j.impl.StaticLoggerBinder']
376-
}

0 commit comments

Comments
 (0)