-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
112 lines (95 loc) · 4.28 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
apply plugin: 'java'
apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"
// ===========================================================================
// plugin info
// ===========================================================================
group 'com.scientiamobile.logstash' // must match the package of the main plugin class
version "${file("VERSION").text.trim()}" // read from required VERSION file
description = "Filter that augments stream with WURFL device detection data"
pluginInfo.licenses = ['Apache-2.0'] // list of SPDX license IDs
pluginInfo.longDescription = "This gem is a Logstash plugin that augments stream with WURFL device detection data and is required to be installed on top of the Logstash core pipeline using \$LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program. \n Please note that this plugin requires a running instance of WURFL Microservice (https://www.scientiamobile.com/products/wurfl-microservice)"
pluginInfo.authors = ['ScientiaMobile Inc.']
pluginInfo.email = ['[email protected]']
pluginInfo.homepage = "http://www.scientiamobile.com"
pluginInfo.pluginType = "filter"
pluginInfo.pluginClass = "WurflDeviceDetection"
pluginInfo.pluginName = "wurfl_device_detection" // must match the @LogstashPlugin annotation in the main plugin class
// ===========================================================================
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath 'com.github.jengelman.gradle.plugins:shadow:5.2.0'
classpath 'com.scientiamobile.wurflmicroservice:wurfl-microservice:2.0.2'
classpath 'org.slf4j:slf4j-api:1.7.26'
}
}
repositories {
mavenCentral()
}
/*
task wrapper(type: Wrapper) {
gradleVersion = '5.2.1'
}*/
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
classifier = null
}
dependencies {
compile 'org.apache.commons:commons-lang3:3.7'
compile group: 'org.elasticsearch.client', name: 'transport', version: '5.1.2'
compile group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.7'
compile group: 'org.slf4j', name: 'slf4j-api', version: '1.7.21'
compile 'com.scientiamobile.wurflmicroservice:wurfl-microservice:2.0.2'
compile fileTree(dir: LOGSTASH_CORE_PATH, include: "build/libs/logstash-core-?.?.?.jar")
testCompile 'junit:junit:4.12'
testCompile 'org.jruby:jruby-complete:9.2.7.0'
}
clean {
delete "${projectDir}/Gemfile"
delete "${projectDir}/" + pluginInfo.pluginFullName() + ".gemspec"
delete "${projectDir}/lib/"
delete "${projectDir}/vendor/"
new FileNameFinder().getFileNames(projectDir.toString(), pluginInfo.pluginFullName() + "-?.?.?.gem").each { filename ->
delete filename
}
}
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
task vendor(dependsOn: shadowJar) {
doLast {
String vendorPathPrefix = "vendor/jar-dependencies"
String projectGroupPath = project.group.replaceAll('\\.', '/')
File projectJarFile = file("${vendorPathPrefix}/${projectGroupPath}/${pluginInfo.pluginFullName()}/${project.version}/${pluginInfo.pluginFullName()}-${project.version}.jar")
projectJarFile.mkdirs()
Files.copy(file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(), projectJarFile.toPath(), REPLACE_EXISTING)
validatePluginJar(projectJarFile, project.group)
}
}
task generateRubySupportFiles() {
doLast {
generateRubySupportFilesForPlugin(project.description, project.group, version)
}
}
task removeObsoleteJars() {
doLast {
new FileNameFinder().getFileNames(
projectDir.toString(),
"vendor/**/" + pluginInfo.pluginFullName() + "*.jar",
"vendor/**/" + pluginInfo.pluginFullName() + "-" + version + ".jar").each { f ->
delete f
}
}
}
task gem(dependsOn: [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]) {
doLast {
buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec")
}
}