@@ -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
2540group " org.logstash.filters"
2641version " ${ new File("VERSION").text.trim()} "
27- project. archivesBaseName = " logstash-filter-geoip"
2842
2943String junitVersion = ' 5.9.2'
3044String maxmindGeoip2Version = ' 2.17.0'
3145String maxmindDbVersion = ' 2.1.0'
3246String log4jVersion = ' 2.17.1'
3347String jrubyCompleteVersion = ' 9.1.13.0'
3448String 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
3959import java.nio.file.Files
4060import 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-
5362repositories {
5463 mavenCentral()
5564}
@@ -93,14 +102,14 @@ configurations {
93102
94103task 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
0 commit comments