-
Notifications
You must be signed in to change notification settings - Fork 64
/
build.gradle.kts
151 lines (130 loc) · 5.24 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
/*
* Copyright (c) 2019-2021, Fraunhofer AISEC. All rights reserved.
*
* 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.
*
* $$$$$$\ $$$$$$$\ $$$$$$\
* $$ __$$\ $$ __$$\ $$ __$$\
* $$ / \__|$$ | $$ |$$ / \__|
* $$ | $$$$$$$ |$$ |$$$$\
* $$ | $$ ____/ $$ |\_$$ |
* $$ | $$\ $$ | $$ | $$ |
* \$$$$$ |$$ | \$$$$$ |
* \______/ \__| \______/
*
*/
//
// configure multi module dokka documentation
//
plugins {
id("org.jetbrains.dokka")
id("io.github.gradle-nexus.publish-plugin")
}
// this is needed for the plugins block
repositories {
mavenCentral()
}
allprojects {
plugins.apply("org.jetbrains.dokka")
group = "de.fraunhofer.aisec"
val dokkaPlugin by configurations
dependencies {
dokkaPlugin("org.jetbrains.dokka:versioning-plugin:1.9.0")
}
}
// configure dokka for the multi-module cpg project
// this works together with the dokka configuration in the common-conventions plugin
tasks.dokkaHtmlMultiModule {
val configuredVersion = project.version.toString()
if(configuredVersion.isNotEmpty() && configuredVersion != "unspecified") {
generateDokkaWithVersionTag(this, configuredVersion)
} else {
generateDokkaWithVersionTag(this, "main")
}
}
/**
* Takes the old dokka sites in build/dokkaCustomMultiModuleOutput/versions and generates a new site.
* This new site contains the old ones, so copying the newly generated site to the gh page is enough.
* Currently, the mkdocs plugin expects it in docs/dokka/latest. The tags in the dropdown will be
* named based on what we configured here.
*/
fun generateDokkaWithVersionTag(dokkaMultiModuleTask: org.jetbrains.dokka.gradle.AbstractDokkaParentTask, tag: String) {
val oldOutputPath = projectDir.resolve("previousDocs")
val id = "org.jetbrains.dokka.versioning.VersioningPlugin"
val config = """{ "version": "$tag", "olderVersionsDir":"${oldOutputPath.path}" }"""
val mapOf = mapOf(id to config)
dokkaMultiModuleTask.outputDirectory.set(file(layout.buildDirectory.asFile.get().resolve("dokkaCustomMultiModuleOutput").resolve(tag)))
dokkaMultiModuleTask.pluginsMapConfiguration.set(mapOf)
}
/**
* Publishing to maven central
*/
nexusPublishing {
repositories {
sonatype() {
val mavenCentralUsername: String? by project
val mavenCentralPassword: String? by project
username.set(mavenCentralUsername)
password.set(mavenCentralPassword)
}
}
}
//
// Load the properties that define which frontends to include
//
// this code block also exists in settings.gradle.kts
val enableJavaFrontend: Boolean by extra {
val enableJavaFrontend: String? by project
enableJavaFrontend.toBoolean()
}
project.logger.lifecycle("Java frontend is ${if (enableJavaFrontend) "enabled" else "disabled"}")
val enableCXXFrontend: Boolean by extra {
val enableCXXFrontend: String? by project
enableCXXFrontend.toBoolean()
}
project.logger.lifecycle("C/C++ frontend is ${if (enableCXXFrontend) "enabled" else "disabled"}")
val enableGoFrontend: Boolean by extra {
val enableGoFrontend: String? by project
enableGoFrontend.toBoolean()
}
project.logger.lifecycle("Go frontend is ${if (enableGoFrontend) "enabled" else "disabled"}")
val enablePythonFrontend: Boolean by extra {
val enablePythonFrontend: String? by project
enablePythonFrontend.toBoolean()
}
project.logger.lifecycle("Python frontend is ${if (enablePythonFrontend) "enabled" else "disabled"}")
val enableLLVMFrontend: Boolean by extra {
val enableLLVMFrontend: String? by project
enableLLVMFrontend.toBoolean()
}
project.logger.lifecycle("LLVM frontend is ${if (enableLLVMFrontend) "enabled" else "disabled"}")
val enableTypeScriptFrontend: Boolean by extra {
val enableTypeScriptFrontend: String? by project
enableTypeScriptFrontend.toBoolean()
}
project.logger.lifecycle("TypeScript frontend is ${if (enableTypeScriptFrontend) "enabled" else "disabled"}")
val enableRubyFrontend: Boolean by extra {
val enableRubyFrontend: String? by project
enableRubyFrontend.toBoolean()
}
project.logger.lifecycle("Ruby frontend is ${if (enableRubyFrontend) "enabled" else "disabled"}")
val enableJVMFrontend: Boolean by extra {
val enableJVMFrontend: String? by project
enableJVMFrontend.toBoolean()
}
project.logger.lifecycle("JVM frontend is ${if (enableJVMFrontend) "enabled" else "disabled"}")
val enableINIFrontend: Boolean by extra {
val enableINIFrontend: String? by project
enableINIFrontend.toBoolean()
}
project.logger.lifecycle("INI frontend is ${if (enableINIFrontend) "enabled" else "disabled"}")