Skip to content

Commit d622e3b

Browse files
authored
Upgrade Gradle to 8.7 and fix deprecations (#224)
Update Gradle to 8.7 and fixes deprecation warnings. In particular this commit: - avoid to set `project.archivesBaseName` property, and use the new syntax - avoid to read `project.archivesBaseName` property and leverage a local variable to store the artifact name
1 parent a53f34b commit d622e3b

File tree

5 files changed

+317
-219
lines changed

5 files changed

+317
-219
lines changed

build.gradle

Lines changed: 30 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,38 +18,47 @@ import de.undercouch.gradle.tasks.download.Download
1818
* specific language governing permissions and limitations
1919
* under the License.
2020
*/
21-
apply plugin: "java"
22-
apply plugin: "distribution"
23-
apply plugin: "idea"
21+
22+
buildscript {
23+
repositories {
24+
mavenCentral()
25+
}
26+
27+
dependencies {
28+
classpath group: 'org.jruby', name: 'jruby-complete', version: "1.7.26"
29+
classpath 'de.undercouch:gradle-download-task:3.2.0'
30+
}
31+
}
32+
33+
plugins {
34+
id "java"
35+
id "distribution"
36+
id "idea"
37+
id "base"
38+
}
2439

2540
group "org.logstash.filters"
2641
version "${new File("VERSION").text.trim()}"
27-
project.archivesBaseName = "logstash-filter-geoip"
2842

2943
String junitVersion = '5.9.2'
3044
String maxmindGeoip2Version = '2.17.0'
3145
String maxmindDbVersion = '2.1.0'
3246
String log4jVersion = '2.17.1'
3347
String jrubyCompleteVersion = '9.1.13.0'
3448
String mockitoVersion = '4.11.0'
49+
var pluginName = "logstash-filter-geoip"
50+
base {
51+
archivesName = pluginName
52+
}
3553

36-
sourceCompatibility = JavaVersion.VERSION_1_8
37-
targetCompatibility = JavaVersion.VERSION_1_8
54+
java {
55+
sourceCompatibility = JavaVersion.VERSION_1_8
56+
targetCompatibility = JavaVersion.VERSION_1_8
57+
}
3858

3959
import java.nio.file.Files
4060
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
4161

42-
buildscript {
43-
repositories {
44-
mavenCentral()
45-
}
46-
47-
dependencies {
48-
classpath group: 'org.jruby', name: 'jruby-complete', version: "1.7.26"
49-
classpath 'de.undercouch:gradle-download-task:3.2.0'
50-
}
51-
}
52-
5362
repositories {
5463
mavenCentral()
5564
}
@@ -93,14 +102,14 @@ configurations {
93102

94103
task generateGemJarRequiresFile {
95104
doLast {
96-
File jars_file = file("lib/${project.archivesBaseName}_jars.rb")
105+
File jars_file = file("lib/${pluginName}_jars.rb")
97106
jars_file.newWriter().withWriter { w ->
98107
w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n"
99108
w << "require \'jar_dependencies\'\n"
100109
configurations.runtimeClasspath.allDependencies.each {
101110
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
102111
}
103-
w << "require_jar(\'${project.group}\', \'${project.archivesBaseName}\', \'${project.version}\')\n"
112+
w << "require_jar(\'${project.group}\', \'${pluginName}\', \'${project.version}\')\n"
104113
}
105114
}
106115
}
@@ -116,9 +125,9 @@ task vendor {
116125
Files.copy(f.toPath(), newJarFile.toPath(), REPLACE_EXISTING)
117126
}
118127
String projectGroupPath = project.group.replaceAll('\\.', '/')
119-
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.archivesBaseName}/${project.version}/${project.archivesBaseName}-${project.version}.jar")
128+
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${pluginName}/${project.version}/${pluginName}-${project.version}.jar")
120129
projectJarFile.mkdirs()
121-
Files.copy(file("$buildDir/libs/${project.archivesBaseName}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
130+
Files.copy(file("$buildDir/libs/${pluginName}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
122131
}
123132
}
124133

gradle/wrapper/gradle-wrapper.jar

-9.25 KB
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
#Tue Jan 12 14:21:00 CET 2021
21
distributionBase=GRADLE_USER_HOME
32
distributionPath=wrapper/dists
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
4+
networkTimeout=10000
5+
validateDistributionUrl=true
46
zipStoreBase=GRADLE_USER_HOME
57
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip

0 commit comments

Comments
 (0)