This repository has been archived by the owner on Aug 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle.kts
183 lines (156 loc) · 5.87 KB
/
build.gradle.kts
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
@file:Suppress("GradlePackageUpdate", "GradlePackageVersionRange")
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import java.util.*
plugins {
java
application
`maven-publish`
id("nebula.release") version "17.1.0"
id("org.owasp.dependencycheck") version "latest.release"
id("java-library-distribution")
id("org.asciidoctor.jvm.convert") version "3.3.2"
id("com.github.hierynomus.license") version "0.16.1"
}
configure<nebula.plugin.release.git.base.ReleasePluginExtension> {
defaultVersionStrategy = nebula.plugin.release.NetflixOssStrategies.SNAPSHOT(project)
}
license {
ext.set("year", Calendar.getInstance().get(Calendar.YEAR))
skipExistingHeaders = true
header = project.rootProject.file("gradle/licenseHeader.txt")
strictCheck = true
include("**/*.java")
}
dependencyCheck {
analyzers.assemblyEnabled = false
failBuildOnCVSS = 9.0F
suppressionFile = "suppressions.xml"
nvd.apiKey = System.getenv("NVD_API_KEY")
}
group = "io.moderne"
repositories {
mavenLocal()
maven {
url = uri("https://oss.sonatype.org/content/repositories/snapshots/")
}
mavenCentral()
maven {
url = uri("https://repo.gradle.org/gradle/libs-releases-local/")
}
}
configurations {
all {
resolutionStrategy {
cacheChangingModulesFor(0, TimeUnit.MINUTES)
cacheDynamicVersionsFor(0, TimeUnit.MINUTES)
exclude("ch.qos.logback")
}
}
}
val jacksonVersion = "2.15.3"
dependencies {
implementation("info.picocli:picocli:latest.release")
annotationProcessor("info.picocli:picocli-codegen:latest.release")
runtimeOnly("org.slf4j:slf4j-nop:latest.release")
implementation("org.apache.commons:commons-lang3:latest.release")
implementation("com.konghq:unirest-java:3.14.2") // To support Java 8
implementation ("commons-io:commons-io:latest.release")
implementation(platform("com.fasterxml.jackson:jackson-bom:$jacksonVersion"))
implementation("com.fasterxml.jackson.datatype:jackson-datatype-jsr310")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml")
// Resolve warning: unknown enum constant When.MAYBE
compileOnly("com.google.code.findbugs:jsr305:latest.release")
compileOnly("org.projectlombok:lombok:latest.release")
annotationProcessor("org.projectlombok:lombok:latest.release")
testImplementation("org.junit.jupiter:junit-jupiter-api:latest.release")
testImplementation("org.junit.jupiter:junit-jupiter-params:latest.release")
testImplementation("org.junit-pioneer:junit-pioneer:latest.release")
testImplementation("org.assertj:assertj-core:latest.release")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:latest.release")
testImplementation("org.testcontainers:testcontainers:1.17.6")
testImplementation("org.junit.jupiter:junit-jupiter:5.8.1")
testImplementation("org.testcontainers:junit-jupiter:1.17.6")
testImplementation("org.awaitility:awaitility:4.2.0")
}
tasks.named<Test>("test") {
useJUnitPlatform()
jvmArgs(
"--add-opens", "java.base/java.util=ALL-UNNAMED",
"--add-opens", "java.base/java.lang=ALL-UNNAMED"
)
}
application {
mainClass.set("io.moderne.connect.commands.Connect")
}
java {
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_8
}
tasks {
compileJava {
options.encoding = "UTF-8"
options.compilerArgs.add("-Xlint:unchecked")
options.compilerArgs.add("-parameters")
// Pass group & name to PicoCLI annotation processor as per https://picocli.info/#_using_build_tools
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
// https://github.com/remkop/picocli/tree/main/picocli-codegen#222-other-options
options.compilerArgs.add("-Aother.resource.patterns=.*")
}
compileTestJava {
options.encoding = "UTF-8"
options.compilerArgs.add("-parameters")
// Pass group & name to PicoCLI annotation processor as per https://picocli.info/#_using_build_tools
options.compilerArgs.add("-Aproject=${project.group}/${project.name}")
// https://github.com/remkop/picocli/tree/main/picocli-codegen#222-other-options
options.compilerArgs.add("-Aother.resource.patterns=.*")
sourceCompatibility = JavaVersion.VERSION_17.toString()
targetCompatibility = JavaVersion.VERSION_17.toString()
}
}
tasks.withType<Zip> {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveVersion.set("")
}
tasks.withType<Tar> {
compression = Compression.GZIP
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
archiveExtension.set("tar.gz")
archiveVersion.set("")
}
tasks.withType<CreateStartScripts>{
doLast {
// Solves the windows problem with the input line being too long
val windowsTemplate = windowsScript.readText()
val classpath = windowsTemplate.lines().find { it.startsWith("set CLASSPATH=") }.orEmpty()
windowsScript
.writeText(windowsTemplate.replace(
classpath,
"set CLASSPATH=%APP_HOME%\\lib\\*"))
}
}
distributions {
main {
distributionBaseName.set("mod-connect")
}
}
tasks.withType<JavaExec> {
dependsOn("classes")
group = "Documentation"
description = "Generate AsciiDoc manpage"
classpath(configurations.compileClasspath, configurations.annotationProcessor, "src/main/java")
mainClass.set("picocli.codegen.docgen.manpage.ManPageGenerator")
args("io.moderne.connect.commands.Connect", "--outdir=${buildDir}/asciidoc")
}
tasks.withType<AsciidoctorTask> {
dependsOn("run")
setSourceDir("${buildDir}/asciidoc")
setOutputDir("${buildDir}/docs")
outputOptions {
backends("manpage", "html5")
}
attributes(
mapOf(
"revnumber" to project.version.toString()
)
)
}