-
Notifications
You must be signed in to change notification settings - Fork 6
/
build.gradle.kts
129 lines (107 loc) · 3.54 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
import ch.nomisp.confluence.publisher.PublishToConfluenceTask
import org.asciidoctor.gradle.editorconfig.AsciidoctorEditorConfigGenerator
import org.asciidoctor.gradle.jvm.AsciidoctorTask
import org.springframework.boot.gradle.tasks.bundling.BootJar
import java.text.SimpleDateFormat
import java.util.Date
plugins {
kotlin("jvm") version "1.7.10"
id("org.springframework.boot") version "2.7.5"
id("io.spring.dependency-management") version "1.0.15.RELEASE"
id("org.asciidoctor.jvm.convert") version "4.0.0"
id("org.asciidoctor.editorconfig") version "4.0.0"
id("ch.nomisp.confluence.publisher") version "0.2.0"
}
group = "com.github.chriskn"
version = "1.0-SNAPSHOT"
repositories {
mavenCentral()
}
tasks.getByName<BootJar>("bootJar") {
enabled = false
}
sourceSets {
create("docs") {
kotlin {
compileClasspath += main.get().output
runtimeClasspath += output + compileClasspath
}
}
val docs by getting {
dependencies {
"docsImplementation"("io.github.chriskn:structurizr-c4puml-extension:0.8.0")
"docsImplementation"("com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:2.14.1")
"docsImplementation"("com.fasterxml.jackson.module:jackson-module-kotlin:2.14.1")
"docsImplementation"("com.structurizr:structurizr-analysis:1.3.5")
"docsImplementation"("com.structurizr:structurizr-spring:1.3.5")
// make spring annotations available to use it with AnnotationTypeMatcher
"docsImplementation"("org.springframework.boot:spring-boot-starter")
}
}
}
dependencies {
implementation("org.springframework.boot:spring-boot-starter")
implementation("com.structurizr:structurizr-annotations:1.3.5")
}
tasks {
compileKotlin {
kotlinOptions.jvmTarget = "11"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
}
}
// Asciidoctor
val asciiAttributes = mapOf(
"imagesdir" to ".",
"plantUmlDir" to "./plantuml",
"toc" to "left",
"toclevels" to 3,
"max-width" to "100%",
"projectName" to rootProject.name,
"dateTime" to SimpleDateFormat("dd-MM-yyyy HH:mm:ssZ").format(Date())
)
tasks.withType(AsciidoctorTask::class) {
setSourceDir(file("./src/docs/resources"))
setBaseDir(file("./src/docs/resources"))
setOutputDir(file("build/docs"))
attributes(asciiAttributes)
options(mapOf("doctype" to "book"))
isLogDocuments = true
dependsOn("generateDiagramsAndDocs")
}
tasks.withType(AsciidoctorEditorConfigGenerator::class) {
setAttributes(asciiAttributes)
setDestinationDir("./src/docs/resources")
group = "documentation"
}
tasks.named("processDocsResources") {
dependsOn("asciidoctorEditorConfig")
}
// Diagrams
tasks.register("generateDiagramsAndDocs", JavaExec::class) {
classpath += sourceSets["docs"].runtimeClasspath
mainClass.set("docsascode.GenerateDiagramsAndDocsKt")
group = "documentation"
}
asciidoctorj {
modules {
diagram.use()
diagram.setVersion("2.2.1")
}
}
// Confluence publisher
confluencePublisher {
asciiDocRootFolder.set(tasks.asciidoctor.get().sourceDir)
setAttributes(tasks.asciidoctor.get().attributes)
rootConfluenceUrl.set("YOUR_CONFLUENCE_URL")
spaceKey.set("YOUR_SPACE_KEY")
ancestorId.set("ID_OF_PARENT_PAGE")
// set username and password
username.set("")
password.set(System.getenv("CONFLUENCE_TOKEN"))
notifyWatchers.set(false)
}
tasks.withType(PublishToConfluenceTask::class) {
dependsOn("generateDiagramsAndDocs")
}