forked from C0urante/avro-random-generator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
200 lines (170 loc) · 5.85 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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
/*
Copyright 2023 SpecMesh Contributors (https://github.com/specmesh)
Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this file except in compliance with the License. You may obtain a copy of
the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations under
the License.
*/
plugins {
id 'java'
id 'application'
id 'idea'
id 'checkstyle'
id 'signing'
id 'maven-publish'
id 'com.github.johnrengelman.shadow' version '7.1.2'
id 'pl.allegro.tech.build.axion-release' version '1.16.1'
id 'io.github.gradle-nexus.publish-plugin' version '1.3.0'
}
java {
sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
}
mainClassName = 'io.specmesh.avro.random.generator.Main'
group = 'io.specmesh'
project.version = scmVersion.version
version = scmVersion.version
archivesBaseName = 'kafka-random-generator'
repositories {
mavenCentral()
}
dependencies {
checkstyle 'com.puppycrawl.tools:checkstyle:10.0'
implementation 'org.slf4j:slf4j-api:1.7.36'
implementation 'ch.qos.logback:logback-classic:1.4.14'
implementation 'org.apache.avro:avro:1.11.3'
implementation 'org.apache.commons:commons-compress:1.25.0'
implementation 'com.github.mifmif:generex:1.0.2'
implementation 'org.xerial.snappy:snappy-java:1.1.10.5'
// Test dependencies
testImplementation 'junit:junit:4.13.2'
testImplementation("org.hamcrest:hamcrest-all:1.3")
}
jar {
manifest {
attributes(
'Implementation-Title': 'Kafka Random Generator',
'Implementation-Version': archiveVersion,
'Main-Class': 'io.specmesh.avro.random.generator.Main'
)
}
}
shadowJar {
configurations = [project.configurations.runtimeClasspath]
mergeServiceFiles()
}
tasks.register('javadocJar', Jar) {
archiveClassifier.set('javadoc')
from(tasks.named('javadoc'))
}
tasks.register('sourceJar', Jar) {
archiveClassifier.set('sources')
from sourceSets.main.allSource
}
tasks.register('standalone', Jar) {
destinationDirectory.set(file("$rootDir/bin"))
archiveFileName.set('arg.jar')
from(configurations.runtimeClasspath)
manifest {
attributes 'Main-Class': 'io.specmesh.avro.random.generator.Main'
}
with jar
}
clean {
doLast {
file("$rootDir/bin").deleteDir()
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
groupId = 'io.specmesh'
artifactId = 'kafka-random-generator'
version = project.version
artifact sourceJar
artifact javadocJar
pom {
name = 'Kafka Random Generator'
description = 'Kafka Random Generator is a tool for randomly generating data to match Avro schemas'
url = 'https://github.com/specmesh/kafka-random-generator'
scm {
url = 'https://github.com/specmesh/kafka-random-generator'
connection = 'scm:git:ssh://github.com/specmesh/kafka-random-generator.git'
developerConnection = 'scm:git:ssh://github.com/specmesh/kafka-random-generator.git'
}
licenses {
license {
name = 'Apache License 2.0'
url = 'http://www.apache.org/licenses/LICENSE-2.0.html'
}
}
developers {
developer {
id = 'C0urante'
name = 'Chris Egerton'
}
developer {
name.set("Neil Avery")
email.set("[email protected]")
organization.set("SpecMesh Master Builders")
organizationUrl.set("https://www.specmesh.io")
}
}
}
}
}
}
signing {
setRequired {
!project.version.toString().endsWith("-SNAPSHOT") && !project.hasProperty("skipSigning")
}
if (project.hasProperty("signingKey")) {
println "SIGNING"
useInMemoryPgpKeys(project.property("signingKey").toString(), project.property("signingPassword").toString())
} else {
println "NOT SIGNING"
}
sign(publishing.publications["mavenJava"])
}
artifacts {
archives jar, javadocJar, sourceJar
}
checkstyle {
configFile = file("${project.rootDir}/config/checkstyle/checkstyle.xml")
toolVersion = '10.3.3'
}
tasks.register('checkstyleReport', Checkstyle) {
source = fileTree('src/main/java')
classpath = files()
}
javadoc {
options {
addBooleanOption('html5', true)
addStringOption("Xwerror", "-quiet")
addStringOption('Xdoclint:none', '-quiet')
links 'https://docs.oracle.com/en/java/javase/11/docs/api/'
links 'https://avro.apache.org/docs/1.10.2/api/java/'
}
}
// See https://github.com/gradle-nexus/publish-plugin
nexusPublishing {
repositories {
sonatype {
nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
if (project.hasProperty("SONA_USERNAME")) {
username.set(project.property("SONA_USERNAME"))
}
if (project.hasProperty("SONA_PASSWORD")) {
password.set(project.property("SONA_PASSWORD"))
}
}
}
}
release.dependsOn( javadoc, sourceJar)