-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
149 lines (122 loc) · 4.76 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
description = 'YDB LogStash plugins'
allprojects {
group = 'tech.ydb.logstash'
version = '0.9.7'
}
buildscript {
repositories {
mavenCentral()
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "gradle.plugin.com.github.johnrengelman:shadow:7.1.2"
}
ext.snakeYamlVersion = '1.29'
}
subprojects {
apply plugin: 'java'
apply from: LOGSTASH_CORE_PATH + '/../rubyUtils.gradle'
apply plugin: 'com.github.johnrengelman.shadow'
// ===========================================================================
// plugin info
// ===========================================================================
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 = ['Mike Lukashev', 'Sergey Provolovich', 'Alexandr Gorshenin']
pluginInfo.email = ['[email protected]']
pluginInfo.homepage = "https://ydb.tech/"
// ===========================================================================
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
shadowJar {
archiveClassifier = null
mergeServiceFiles()
}
dependencies {
implementation fileTree(dir: LOGSTASH_CORE_PATH, include: "**/logstash-core.jar")
testImplementation group: 'org.jruby', name: 'jruby-complete', version: '9.2.11.0'
testRuntimeOnly group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: '2.21.1'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
}
clean {
delete "${projectDir}/Gemfile"
delete "${projectDir}/lib/"
delete "${projectDir}/vendor/"
delete "${projectDir}/VERSION"
fileTree(dir: projectDir, includes: ["*.gemspec"]).each { file ->
file.delete()
}
fileTree(dir: projectDir, includes: ["*.gem"]).each { file ->
file.delete()
}
}
test {
// Enable JUnit 5 (Gradle 4.6+).
useJUnitPlatform()
// Hide warning from JRuby 9.2
jvmArgs '--add-opens', 'java.base/sun.nio.ch=ALL-UNNAMED'
// Always run tests, even when nothing changed.
dependsOn 'cleanTest'
// Pass special tests parameters
if (project.hasProperty('YDB_ENDPOINT')) {
systemProperty 'YDB_ENDPOINT', project.getProperty('YDB_ENDPOINT')
}
if (project.hasProperty('YDB_DATABASE')) {
systemProperty 'YDB_DATABASE', project.getProperty('YDB_DATABASE')
}
// Show test results.
testLogging {
exceptionFormat org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
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()
java.nio.file.Files.copy(
file("$buildDir/libs/${project.name}-${project.version}.jar").toPath(),
projectJarFile.toPath(),
java.nio.file.StandardCopyOption.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("createVersionFile") {
doLast {
def versionFile = file("${projectDir}/VERSION")
versionFile.text = version
}
}
tasks.register("gem") {
dependsOn = [createVersionFile, downloadAndInstallJRuby, removeObsoleteJars, vendor, generateRubySupportFiles]
doLast {
buildGem(projectDir, buildDir, pluginInfo.pluginFullName() + ".gemspec")
}
}
}