1- import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask
2- import org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
31import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2+ import org.radarbase.gradle.plugin.radarKotlin
43import java.time.Duration
54
65plugins {
7- kotlin(" jvm" )
8- application
9- `maven- publish`
10- signing
11- id(" org.jetbrains.dokka" )
12- id(" com.avast.gradle.docker-compose" )
13- id(" com.github.ben-manes.versions" )
14- id(" io.github.gradle-nexus.publish-plugin" )
15- id(" org.jlleitschuh.gradle.ktlint" ) version " 11.0.0"
6+ id(" application" )
7+ id(" org.radarbase.radar-root-project" ) version Versions .radarCommons
8+ id(" org.radarbase.radar-dependency-management" ) version Versions .radarCommons
9+ id(" org.radarbase.radar-kotlin" ) version Versions .radarCommons
10+ id(" com.avast.gradle.docker-compose" ) version Versions .dockerCompose
1611}
1712
18- group = " org.radarbase"
19- version = " 2.3.3-SNAPSHOT"
13+ description = " RADAR-base output restructuring"
2014
21- repositories {
22- mavenCentral()
15+ radarRootProject {
16+ projectVersion.set(Versions .project)
17+ gradleVersion.set(Versions .wrapper)
2318}
2419
25- description = " RADAR-base output restructuring"
26- val website = " https://radar-base.org"
27- val githubRepoName = " RADAR-base/radar-output-restructure"
28- val githubUrl = " https://github.com/$githubRepoName "
29- val issueUrl = " $githubUrl /issues"
20+ radarKotlin {
21+ kotlinVersion.set(Versions .kotlin)
22+ javaVersion.set(Versions .java)
23+ log4j2Version.set(Versions .log4j2)
24+ slf4jVersion.set(Versions .slf4j)
25+ }
3026
3127sourceSets {
3228 create(" integrationTest" ) {
@@ -37,100 +33,61 @@ sourceSets {
3733
3834configurations[" integrationTestImplementation" ].extendsFrom(
3935 configurations.implementation.get(),
40- configurations.testImplementation.get()
36+ configurations.testImplementation.get(),
4137)
4238configurations[" integrationTestRuntimeOnly" ].extendsFrom(
4339 configurations.runtimeOnly.get(),
44- configurations.testRuntimeOnly.get()
40+ configurations.testRuntimeOnly.get(),
4541)
4642
4743dependencies {
48- val avroVersion: String by project
49- api(" org.apache.avro:avro:$avroVersion " )
50- val snappyVersion: String by project
51- runtimeOnly(" org.xerial.snappy:snappy-java:$snappyVersion " )
44+ api(" org.apache.avro:avro:${Versions .avro} " )
45+ runtimeOnly(" org.xerial.snappy:snappy-java:${Versions .snappy} " )
5246
5347 implementation(kotlin(" reflect" ))
54- val coroutinesVersion: String by project
55- implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesVersion " )
48+ implementation(" org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions .coroutines} " )
5649
57- val jacksonVersion: String by project
58- api(platform(" com.fasterxml.jackson:jackson-bom:$jacksonVersion " ))
50+ api(platform(" com.fasterxml.jackson:jackson-bom:${Versions .jackson} " ))
5951 implementation(" com.fasterxml.jackson.core:jackson-databind" )
6052 implementation(" com.fasterxml.jackson.dataformat:jackson-dataformat-yaml" ) {
61- val snakeYamlVersion: String by project
62- runtimeOnly(" org.yaml:snakeyaml:$snakeYamlVersion " )
53+ runtimeOnly(" org.yaml:snakeyaml:${Versions .snakeYaml} " )
6354 }
6455 implementation(" com.fasterxml.jackson.dataformat:jackson-dataformat-csv" )
6556 implementation(" com.fasterxml.jackson.module:jackson-module-kotlin" )
6657 implementation(" com.fasterxml.jackson.datatype:jackson-datatype-jsr310" )
6758
68- val jedisVersion: String by project
69- implementation(" redis.clients:jedis:$jedisVersion " )
70-
71- val jCommanderVersion: String by project
72- implementation(" com.beust:jcommander:$jCommanderVersion " )
59+ implementation(" redis.clients:jedis:${Versions .jedis} " )
7360
74- val almworksVersion: String by project
75- implementation(" com.almworks.integers:integers:$almworksVersion " )
61+ implementation(" com.beust:jcommander:${Versions .jCommander} " )
7662
77- val minioVersion: String by project
78- implementation(" io.minio:minio:$minioVersion " ) {
79- val guavaVersion: String by project
80- runtimeOnly(" com.google.guava:guava:$guavaVersion " )
63+ implementation(" com.almworks.integers:integers:${Versions .almworks} " )
8164
82- val okhttpVersion: String by project
83- runtimeOnly(" com.squareup.okhttp3:okhttp:$okhttpVersion " )
65+ implementation(" io.minio:minio:${Versions .minio} " ) {
66+ runtimeOnly(" com.google.guava:guava:${Versions .guava} " )
67+ runtimeOnly(" com.squareup.okhttp3:okhttp:${Versions .okhttp} " )
8468 }
8569
86- val azureStorageVersion: String by project
87- implementation(" com.azure:azure-storage-blob:$azureStorageVersion " ) {
88- val nettyVersion: String by project
89- runtimeOnly(platform(" io.netty:netty-bom:$nettyVersion " ))
90- val projectReactorNettyVersion: String by project
91- runtimeOnly(" io.projectreactor.netty:reactor-netty-http:$projectReactorNettyVersion " )
70+ implementation(" com.azure:azure-storage-blob:${Versions .azureStorage} " ) {
71+ runtimeOnly(platform(" io.netty:netty-bom:${Versions .netty} " ))
72+ runtimeOnly(" io.projectreactor.netty:reactor-netty-http:${Versions .projectReactorNetty} " )
9273 }
93- val opencsvVersion: String by project
94- implementation(" com.opencsv:opencsv:$opencsvVersion " ) {
95- val apacheCommonsTextVersion: String by project
96- runtimeOnly(" org.apache.commons:commons-text:$apacheCommonsTextVersion " )
74+ implementation(" com.opencsv:opencsv:${Versions .opencsv} " ) {
75+ runtimeOnly(" org.apache.commons:commons-text:${Versions .apacheCommonsText} " )
9776 }
77+ implementation(" org.radarbase:managementportal-client:${Versions .managementPortal} " )
78+ implementation(" org.radarbase:radar-commons-kotlin:${Versions .radarCommons} " )
9879
99- val slf4jVersion: String by project
100- implementation(" org.slf4j:slf4j-api:$slf4jVersion " )
101-
102- val log4jVersion: String by project
103- runtimeOnly(" org.apache.logging.log4j:log4j-core:$log4jVersion " )
104- runtimeOnly(" org.apache.logging.log4j:log4j-slf4j2-impl:$log4jVersion " )
105- runtimeOnly(" org.apache.logging.log4j:log4j-jul:$log4jVersion " )
106-
107- val radarSchemasVersion: String by project
108- testImplementation(" org.radarbase:radar-schemas-commons:$radarSchemasVersion " )
109- testImplementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:$coroutinesVersion " )
110-
111- val junitVersion: String by project
112- testImplementation(" org.junit.jupiter:junit-jupiter-api:$junitVersion " )
113- testImplementation(" org.junit.jupiter:junit-jupiter-params:$junitVersion " )
114- testRuntimeOnly(" org.junit.jupiter:junit-jupiter-engine:$junitVersion " )
115- testImplementation(" org.hamcrest:hamcrest:2.2" )
116- val mockitoKotlinVersion: String by project
117- testImplementation(" org.mockito.kotlin:mockito-kotlin:$mockitoKotlinVersion " )
80+ testImplementation(" org.radarbase:radar-schemas-commons:${Versions .radarSchemas} " )
81+ testImplementation(" org.jetbrains.kotlinx:kotlinx-coroutines-test:${Versions .coroutines} " )
11882
119- val dokkaVersion: String by project
120- dokkaHtmlPlugin(" org.jetbrains.dokka:kotlin-as-java-plugin:$dokkaVersion " )
121-
122- val jsoupVersion: String by project
123- dokkaPlugin(" org.jsoup:jsoup:$jsoupVersion " )
124- dokkaRuntime(" org.jsoup:jsoup:$jsoupVersion " )
125- dokkaPlugin(platform(" com.fasterxml.jackson:jackson-bom:$jacksonVersion " ))
126- dokkaRuntime(platform(" com.fasterxml.jackson:jackson-bom:$jacksonVersion " ))
83+ testImplementation(" org.hamcrest:hamcrest:${Versions .hamcrest} " )
84+ testImplementation(" org.mockito.kotlin:mockito-kotlin:${Versions .mockitoKotlin} " )
12785}
12886
12987application {
13088 mainClass.set(" org.radarbase.output.Application" )
13189 applicationDefaultJvmArgs = listOf (
13290 " -Djava.security.egd=file:/dev/./urandom" ,
133- " -Djava.util.logging.manager=org.apache.logging.log4j.jul.LogManager" ,
13491 )
13592}
13693
@@ -146,40 +103,10 @@ distributions {
146103
147104tasks.withType<KotlinCompile > {
148105 kotlinOptions {
149- jvmTarget = " 17"
150- apiVersion = " 1.6"
151- languageVersion = " 1.6"
152106 freeCompilerArgs = listOf (" -opt-in=kotlin.RequiresOptIn" )
153107 }
154108}
155109
156- // custom tasks for creating source/javadoc jars
157- val sourcesJar by tasks.registering(Jar ::class ) {
158- archiveClassifier.set(" sources" )
159- from(sourceSets.main.get().allSource)
160- dependsOn(tasks.classes)
161- }
162-
163- val dokkaJar by tasks.registering(Jar ::class ) {
164- archiveClassifier.set(" javadoc" )
165- from(" $buildDir /dokka/javadoc/" )
166- dependsOn(tasks.dokkaJavadoc)
167- }
168-
169- tasks.withType<Tar > {
170- compression = Compression .GZIP
171- archiveExtension.set(" tar.gz" )
172- }
173-
174- tasks.withType<Jar > {
175- manifest {
176- attributes(
177- " Implementation-Title" to project.name,
178- " Implementation-Version" to project.version
179- )
180- }
181- }
182-
183110tasks.startScripts {
184111 classpath = classpath?.let { it + files(" lib/PlaceHolderForPluginPath" ) }
185112
@@ -189,77 +116,6 @@ tasks.startScripts {
189116 }
190117}
191118
192- publishing {
193- publications {
194- create<MavenPublication >(" mavenJar" ) {
195- from(components[" java" ])
196- artifact(sourcesJar)
197- artifact(dokkaJar)
198- pom {
199- name.set(project.name)
200- url.set(githubUrl)
201- description.set(project.description)
202-
203- licenses {
204- license {
205- name.set(" The Apache Software License, Version 2.0" )
206- url.set(" https://www.apache.org/licenses/LICENSE-2.0.txt" )
207- distribution.set(" repo" )
208- }
209- }
210- developers {
211- developer {
212- id.set(" blootsvoets" )
213- name.set(" Joris Borgdorff" )
214- 215- organization.set(" The Hyve" )
216- }
217- }
218- issueManagement {
219- system.set(" GitHub" )
220- url.set(issueUrl)
221- }
222- organization {
223- name.set(" RADAR-base" )
224- url.set(website)
225- }
226- scm {
227- connection.set(" scm:git:$githubUrl " )
228- url.set(githubUrl)
229- }
230- }
231- }
232- }
233- }
234-
235- signing {
236- useGpgCmd()
237- isRequired = true
238- sign(tasks[" sourcesJar" ], tasks[" dokkaJar" ])
239- sign(publishing.publications[" mavenJar" ])
240- }
241-
242- tasks.withType<Sign > {
243- onlyIf { gradle.taskGraph.hasTask(project.tasks[" publish" ]) }
244- }
245-
246- fun Project.propertyOrEnv (propertyName : String , envName : String ): String? {
247- return if (hasProperty(propertyName)) {
248- property(propertyName)?.toString()
249- } else {
250- System .getenv(envName)
251- }
252- }
253-
254- nexusPublishing {
255- repositories {
256- sonatype {
257- username.set(propertyOrEnv(" ossrh.user" , " OSSRH_USER" ))
258- password.set(propertyOrEnv(" ossrh.password" , " OSSRH_PASSWORD" ))
259- }
260- }
261- }
262-
263119val integrationTest by tasks.registering(Test ::class ) {
264120 description = " Runs integration tests."
265121 group = " verification"
@@ -280,48 +136,3 @@ dockerCompose {
280136tasks[" composeUp" ].dependsOn(" composePull" )
281137
282138tasks[" check" ].dependsOn(integrationTest)
283-
284- tasks.withType<Test > {
285- useJUnitPlatform()
286- testLogging {
287- events(" passed" , " skipped" , " failed" )
288- showStandardStreams = true
289- exceptionFormat = FULL
290- }
291- }
292-
293- tasks.register(" downloadDependencies" ) {
294- doLast {
295- description = " Pre-downloads dependencies"
296- configurations.compileClasspath.get().files
297- configurations.runtimeClasspath.get().files
298- }
299- outputs.upToDateWhen { false }
300- }
301-
302- tasks.register<Copy >(" copyDependencies" ) {
303- from(configurations.runtimeClasspath.get().files)
304- into(" $buildDir /third-party/" )
305- }
306-
307- fun isNonStable (version : String ): Boolean {
308- val stableKeyword = listOf (" RELEASE" , " FINAL" , " GA" , " JRE" ).any { version.toUpperCase().contains(it) }
309- val regex = " ^[0-9,.v-]+(-r)?$" .toRegex()
310- val isStable = stableKeyword || regex.matches(version)
311- return isStable.not ()
312- }
313-
314- tasks.named<DependencyUpdatesTask >(" dependencyUpdates" ).configure {
315- rejectVersionIf {
316- isNonStable(candidate.version)
317- }
318- }
319-
320- ktlint {
321- version.set(" 0.45.2" )
322- disabledRules.set(setOf (" no-wildcard-imports" ))
323- }
324-
325- tasks.wrapper {
326- gradleVersion = " 7.6"
327- }
0 commit comments