Skip to content

Commit a862f13

Browse files
committed
Fix Gradle deprecation warnings (#1608)
This PR fixes deprecation warnings that will turn into errors when migrating to gradle 7.0 - Enforce the build to fail when a deprecation occurs
1 parent da8ee51 commit a862f13

File tree

5 files changed

+16
-13
lines changed

5 files changed

+16
-13
lines changed

buildSrc/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,16 @@ repositories {
6565
}
6666

6767
dependencies {
68-
compile gradleApi()
69-
compile localGroovy()
68+
compileOnly gradleApi()
69+
compileOnly localGroovy()
7070

7171
if (localRepo) {
72-
compile name: "build-tools-${buildToolsVersion}"
72+
implementation name: "build-tools-${buildToolsVersion}"
7373
// Required for dependency licenses task (explicitly added in case of localRepo missing transitive dependencies)
74-
compile group: 'commons-codec', name: 'commons-codec', version: '1.12'
75-
compile group: 'org.apache.rat', name: 'apache-rat', version: '0.11'
74+
implementation group: 'commons-codec', name: 'commons-codec', version: '1.12'
75+
implementation group: 'org.apache.rat', name: 'apache-rat', version: '0.11'
7676
} else {
77-
compile group: 'org.elasticsearch.gradle', name: 'build-tools', version: buildToolsVersion
77+
implementation group: 'org.elasticsearch.gradle', name: 'build-tools', version: buildToolsVersion
7878
}
7979
}
8080

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/BaseBuildPlugin.groovy

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ class BaseBuildPlugin implements Plugin<Project> {
185185
for (String repo : ['snapshots', 'artifacts']) {
186186
project.repositories.ivy {
187187
url "https://${repo}.elastic.co/downloads"
188-
layout "pattern", {
188+
patternLayout {
189189
artifact "elasticsearch/[module]-[revision](-[classifier]).[ext]"
190190
}
191191
// TODO: Forward Port

buildSrc/src/main/groovy/org/elasticsearch/hadoop/gradle/RootBuildPlugin.groovy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,13 @@ class RootBuildPlugin implements Plugin<Project> {
6868
Zip distZip = project.getTasks().create('distZip', Zip.class)
6969
distZip.dependsOn(project.getTasks().getByName('pack'))
7070
distZip.setGroup('Distribution')
71-
distZip.setDescription("Builds -${distZip.getClassifier()} archive, containing all jars and docs, suitable for download page.")
71+
distZip.setDescription("Builds -${distZip.archiveClassifier.get()} archive, containing all jars and docs, suitable for download page.")
7272

7373
Task distribution = project.getTasks().getByName('distribution')
7474
distribution.dependsOn(distZip)
7575

7676
// Location of the zip dir
77-
project.rootProject.ext.folderName = "${distZip.baseName}" + "-" + "${project.version}"
77+
project.rootProject.ext.folderName = "${distZip.archiveBaseName.get()}" + "-" + "${project.version}"
7878

7979
// Copy root directory files to zip
8080
distZip.from(project.rootDir) { CopySpec spec ->

buildSrc/src/main/java/org/elasticsearch/hadoop/gradle/scala/SparkVariantPlugin.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@
6060
import static org.gradle.api.plugins.JavaBasePlugin.VERIFICATION_GROUP;
6161
import static org.gradle.api.plugins.JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME;
6262
import static org.gradle.api.plugins.JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME;
63-
import static org.gradle.api.plugins.JavaPlugin.COMPILE_CONFIGURATION_NAME;
63+
// import static org.gradle.api.plugins.JavaPlugin.COMPILE_CONFIGURATION_NAME;
6464
import static org.gradle.api.plugins.JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME;
6565
import static org.gradle.api.plugins.JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME;
66-
import static org.gradle.api.plugins.JavaPlugin.RUNTIME_CONFIGURATION_NAME;
66+
// import static org.gradle.api.plugins.JavaPlugin.RUNTIME_CONFIGURATION_NAME;
6767
import static org.gradle.api.plugins.JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME;
6868
import static org.gradle.api.plugins.JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME;
6969
import static org.gradle.api.plugins.JavaPlugin.TEST_TASK_NAME;
@@ -282,9 +282,9 @@ public void execute(ComponentMetadataContext componentMetadataContext) {
282282

283283
// TODO: address deprecated configuration names
284284
private static List<String> TEST_CONFIGURATIONS_EXTENDED = Arrays.asList(
285-
COMPILE_CONFIGURATION_NAME,
285+
// TODO compile only
286286
IMPLEMENTATION_CONFIGURATION_NAME,
287-
RUNTIME_CONFIGURATION_NAME,
287+
// RUNTIME_CONFIGURATION_NAME,
288288
RUNTIME_ONLY_CONFIGURATION_NAME
289289
);
290290

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Enforce the build to fail on deprecated gradle api usage
2+
systemProp.org.gradle.warning.mode=fail
3+
14
## Settings
25
org.gradle.daemon=false
36

0 commit comments

Comments
 (0)