-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
151 lines (133 loc) · 5.12 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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
import java.nio.file.Files
import static java.nio.file.StandardCopyOption.REPLACE_EXISTING
apply plugin: 'java'
apply plugin: 'kotlin'
apply from: LOGSTASH_CORE_PATH + "/../rubyUtils.gradle"
// ===========================================================================
// plugin info
// ===========================================================================
group 'net.p1kachu.logstash.input.grpc' // must match the package of the main plugin class
version "${file("VERSION").text.trim()}" // read from required VERSION file
description = "Logstash input plugin for gRPC (stream)"
pluginInfo.licenses = ['Apache-2.0'] // list of SPDX license IDs
pluginInfo.longDescription = "This gem is a Logstash plugin 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"
pluginInfo.authors = ['pikatenor']
pluginInfo.email = ['[email protected]']
pluginInfo.homepage = "https://github.com/pikatenor/logstash-input-grpc"
pluginInfo.pluginType = "input"
pluginInfo.pluginClass = "Grpc"
pluginInfo.pluginName = "grpc" // must match the @LogstashPlugin annotation in the main plugin class
// ===========================================================================
sourceCompatibility = 1.8
targetCompatibility = 1.8
buildscript {
ext.kotlin_version = '1.9.25'
repositories {
mavenCentral()
gradlePluginPortal()
}
dependencies {
classpath 'gradle.plugin.com.github.johnrengelman:shadow:8.0.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.9.4'
}
}
repositories {
mavenCentral()
}
apply plugin: 'com.github.johnrengelman.shadow'
shadowJar {
archiveClassifier = null
mergeServiceFiles()
}
apply plugin: 'com.google.protobuf'
protobuf {
protoc {
artifact = 'com.google.protobuf:protoc:3.25.5'
}
plugins {
grpc {
artifact = 'io.grpc:protoc-gen-grpc-java:1.68.1'
}
}
generateProtoTasks {
all().each { task ->
task.plugins {
grpc { }
}
task.generateDescriptorSet = true
task.descriptorSetOptions.includeImports = true
}
}
}
dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation 'org.apache.commons:commons-lang3:3.17.0'
implementation 'org.apache.logging.log4j:log4j-api:2.24.1'
implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
implementation 'com.google.protobuf:protobuf-java:3.25.5'
implementation 'com.google.protobuf:protobuf-java-util:3.25.5'
implementation 'com.google.guava:guava:33.3.1-jre'
implementation "io.grpc:grpc-core:1.68.1"
implementation "io.grpc:grpc-stub:1.68.1"
implementation "io.grpc:grpc-netty-shaded:1.68.1"
implementation fileTree(dir: LOGSTASH_CORE_PATH, include: "**/logstash-core-?.*.*.jar")
testImplementation 'junit:junit:4.13.2'
testImplementation "io.grpc:grpc-protobuf:1.68.1"
testImplementation "javax.annotation:javax.annotation-api:1.3.2"
testImplementation "org.jetbrains.kotlin:kotlin-script-runtime:$kotlin_version"
}
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'
}
tasks.register("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)
}
}
tasks.register("generateRubySupportFiles") {
doLast {
generateRubySupportFilesForPlugin(project.description, project.group, version)
}
}
tasks.register("removeObsoleteJars") {
doLast {
new FileNameFinder().getFileNames(
projectDir.toString(),
"vendor/**/" + pluginInfo.pluginFullName() + "*.jar",
"vendor/**/" + pluginInfo.pluginFullName() + "-" + version + ".jar").each { f ->
delete f
}
}
}
tasks.register("gem"){
dependsOn = [downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]
doLast {
buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec")
}
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}