@@ -18,38 +18,47 @@ import de.undercouch.gradle.tasks.download.Download
18
18
* specific language governing permissions and limitations
19
19
* under the License.
20
20
*/
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
+ }
24
39
25
40
group " org.logstash.filters"
26
41
version " ${ new File("VERSION").text.trim()} "
27
- project. archivesBaseName = " logstash-filter-geoip"
28
42
29
43
String junitVersion = ' 5.9.2'
30
44
String maxmindGeoip2Version = ' 2.17.0'
31
45
String maxmindDbVersion = ' 2.1.0'
32
46
String log4jVersion = ' 2.17.1'
33
47
String jrubyCompleteVersion = ' 9.1.13.0'
34
48
String mockitoVersion = ' 4.11.0'
49
+ var pluginName = " logstash-filter-geoip"
50
+ base {
51
+ archivesName = pluginName
52
+ }
35
53
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
+ }
38
58
39
59
import java.nio.file.Files
40
60
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
41
61
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
-
53
62
repositories {
54
63
mavenCentral()
55
64
}
@@ -93,14 +102,14 @@ configurations {
93
102
94
103
task generateGemJarRequiresFile {
95
104
doLast {
96
- File jars_file = file(" lib/${ project.archivesBaseName } _jars.rb" )
105
+ File jars_file = file(" lib/${ pluginName } _jars.rb" )
97
106
jars_file. newWriter(). withWriter { w ->
98
107
w << " # AUTOGENERATED BY THE GRADLE SCRIPT. DO NOT EDIT.\n\n "
99
108
w << " require \' jar_dependencies\'\n "
100
109
configurations. runtimeClasspath. allDependencies. each {
101
110
w << " require_jar(\' ${ it.group} \' , \' ${ it.name} \' , \' ${ it.version} \' )\n "
102
111
}
103
- w << " require_jar(\' ${ project.group} \' , \' ${ project.archivesBaseName } \' , \' ${ project.version} \' )\n "
112
+ w << " require_jar(\' ${ project.group} \' , \' ${ pluginName } \' , \' ${ project.version} \' )\n "
104
113
}
105
114
}
106
115
}
@@ -116,9 +125,9 @@ task vendor {
116
125
Files . copy(f. toPath(), newJarFile. toPath(), REPLACE_EXISTING )
117
126
}
118
127
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" )
120
129
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 )
122
131
}
123
132
}
124
133
0 commit comments