-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
144 lines (125 loc) · 3.56 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
import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
mavenCentral()
}
dependencies {
classpath "org.asciidoctor:asciidoctor-gradle-jvm:3.3.2"
}
}
plugins {
id 'application'
id 'java'
id 'groovy'
id 'org.asciidoctor.jvm.convert'
id 'com.palantir.graal'
}
apply plugin: 'org.asciidoctor.jvm.convert'
wrapper {
gradleVersion = '7.4'
}
group 'io.github.brianwyka'
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
compileOnly "org.projectlombok:lombok:${lombokVersion}"
runtimeOnly "ch.qos.logback:logback-classic:${logbackVersion}"
implementation "org.slf4j:slf4j-api:${slf4jVersion}"
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
annotationProcessor "info.picocli:picocli-codegen:${picocliVersion}"
}
dependencies {
testImplementation "org.codehaus.groovy:groovy:${groovyVersion}"
testImplementation platform("org.spockframework:spock-bom:${spockVersion}")
testImplementation "org.spockframework:spock-core"
}
compileJava {
options.compilerArgs += ["-Aproject=${project.group}/${project.name}"]
}
test {
useJUnitPlatform()
testLogging {
events "passed", "skipped", "failed"
}
}
application {
mainClass.set("$mainClassFqn")
}
jar {
manifest {
attributes "Main-Class": application.mainClass.get()
}
}
task fatJar(type: Jar) {
manifest {
attributes "Main-Class": application.mainClass.get()
}
archiveClassifier.set('') // Overwrites original JAR
from sourceSets.main.output
dependsOn configurations.runtimeClasspath
from {
configurations.runtimeClasspath.findAll { it.name.endsWith('jar') }.collect { zipTree(it) }
}
}
task generateManpageAsciiDoc(type: JavaExec) {
dependsOn(classes)
group = "Documentation"
description = "Generate AsciiDoc manpage"
classpath(configurations.compileClasspath, configurations.annotationProcessor, sourceSets.main.runtimeClasspath)
mainClass.set('picocli.codegen.docgen.manpage.ManPageGenerator')
args application.mainClass.get(), "--outdir=${project.buildDir}/generated-picocli-docs", "-v"
}
task copyResources(type: Copy) {
from ("src/main/asciidoc") {
include '**/*.css'
}
into("${rootDir}/gh-pages")
}
asciidoctor.dependsOn copyResources
apply plugin: 'org.asciidoctor.jvm.convert'
asciidoctor {
dependsOn(generateManpageAsciiDoc)
sourceDir = file("${rootDir}/src/main/asciidoc")
outputDir = file("${rootDir}/gh-pages")
logDocuments = true
attributes([
generateddocs: "${project.buildDir}/generated-picocli-docs"
])
outputOptions {
backends = ['html5']
}
}
asciidoctor {
dependsOn(generateManpageAsciiDoc)
sourceDir = file("${project.buildDir}/generated-picocli-docs")
outputDir = file("${rootDir}/gh-pages/manpages")
logDocuments = true
outputOptions {
backends = ['manpage']
}
}
assemble.dependsOn(asciidoctor)
build.finalizedBy(fatJar)
graal {
mainClass application.mainClass.get()
outputName "$nativeImageOutputName"
graalVersion "22.0.0.2"
javaVersion "$sourceCompatibility"
option '-H:+ReportExceptionStackTraces'
option '--allow-incomplete-classpath'
if (DefaultNativePlatform.currentOperatingSystem.isLinux()) {
option '--static'
}
}
tasks {
nativeImage {
dependsOn(fatJar)
}
}