Skip to content

Commit

Permalink
Upgrade Gradle to 8.7 and fix deprecations (#224)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andsel authored May 22, 2024
1 parent a53f34b commit d622e3b
Show file tree
Hide file tree
Showing 5 changed files with 317 additions and 219 deletions.
51 changes: 30 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,38 +18,47 @@ import de.undercouch.gradle.tasks.download.Download
* specific language governing permissions and limitations
* under the License.
*/
apply plugin: "java"
apply plugin: "distribution"
apply plugin: "idea"

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath group: 'org.jruby', name: 'jruby-complete', version: "1.7.26"
classpath 'de.undercouch:gradle-download-task:3.2.0'
}
}

plugins {
id "java"
id "distribution"
id "idea"
id "base"
}

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

String junitVersion = '5.9.2'
String maxmindGeoip2Version = '2.17.0'
String maxmindDbVersion = '2.1.0'
String log4jVersion = '2.17.1'
String jrubyCompleteVersion = '9.1.13.0'
String mockitoVersion = '4.11.0'
var pluginName = "logstash-filter-geoip"
base {
archivesName = pluginName
}

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING

buildscript {
repositories {
mavenCentral()
}

dependencies {
classpath group: 'org.jruby', name: 'jruby-complete', version: "1.7.26"
classpath 'de.undercouch:gradle-download-task:3.2.0'
}
}

repositories {
mavenCentral()
}
Expand Down Expand Up @@ -93,14 +102,14 @@ configurations {

task generateGemJarRequiresFile {
doLast {
File jars_file = file("lib/${project.archivesBaseName}_jars.rb")
File jars_file = file("lib/${pluginName}_jars.rb")
jars_file.newWriter().withWriter { w ->
w << "# AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n"
w << "require \'jar_dependencies\'\n"
configurations.runtimeClasspath.allDependencies.each {
w << "require_jar(\'${it.group}\', \'${it.name}\', \'${it.version}\')\n"
}
w << "require_jar(\'${project.group}\', \'${project.archivesBaseName}\', \'${project.version}\')\n"
w << "require_jar(\'${project.group}\', \'${pluginName}\', \'${project.version}\')\n"
}
}
}
Expand All @@ -116,9 +125,9 @@ task vendor {
Files.copy(f.toPath(), newJarFile.toPath(), REPLACE_EXISTING)
}
String projectGroupPath = project.group.replaceAll('\\.', '/')
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${project.archivesBaseName}/${project.version}/${project.archivesBaseName}-${project.version}.jar")
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${pluginName}/${project.version}/${pluginName}-${project.version}.jar")
projectJarFile.mkdirs()
Files.copy(file("$buildDir/libs/${project.archivesBaseName}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
Files.copy(file("$buildDir/libs/${pluginName}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
}
}

Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
5 changes: 3 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#Tue Jan 12 14:21:00 CET 2021
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
Loading

0 comments on commit d622e3b

Please sign in to comment.