1+
12import com.github.gradle.node.NodeExtension
23import com.github.gradle.node.NodePlugin
34import io.gitlab.arturbosch.detekt.Detekt
4- import kotlinx.html.FlowContent
5- import kotlinx.html.a
6- import kotlinx.html.body
7- import kotlinx.html.div
8- import kotlinx.html.h2
9- import kotlinx.html.head
10- import kotlinx.html.html
11- import kotlinx.html.id
12- import kotlinx.html.link
13- import kotlinx.html.meta
14- import kotlinx.html.p
15- import kotlinx.html.span
16- import kotlinx.html.stream.createHTML
17- import kotlinx.html.style
18- import kotlinx.html.title
19- import kotlinx.html.unsafe
205import org.jetbrains.dokka.base.DokkaBase
216import org.jetbrains.dokka.base.DokkaBaseConfiguration
227import org.jetbrains.dokka.gradle.DokkaTaskPartial
@@ -25,12 +10,10 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
2510import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
2611import org.jetbrains.kotlin.gradle.plugin.KotlinMultiplatformPluginWrapper
2712import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformJvmPlugin
28- import org.semver.Version
2913
3014buildscript {
3115 dependencies {
32- classpath(libs.dokka.versioning)
33- classpath(libs.semver)
16+ classpath(libs.dokka.base)
3417 }
3518}
3619
@@ -68,8 +51,6 @@ fun computeVersion(): Any {
6851}
6952
7053dependencies {
71- dokkaPlugin(libs.dokka.versioning)
72-
7354 // Generate a combined coverage report
7455 project.subprojects.forEach {
7556 kover(it)
@@ -89,7 +70,7 @@ subprojects {
8970
9071 tasks.withType<DokkaTaskPartial >().configureEach {
9172 pluginConfiguration<DokkaBase , DokkaBaseConfiguration > {
92- footerMessage = createFooterMessage()
73+ footerMessage = dokkaFooterMessage
9374 }
9475 }
9576
@@ -246,141 +227,25 @@ fun MavenPublication.setMetadata() {
246227tasks.withType< org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask > {
247228 dependsOn(" :ts-model-api:npm_run_build" )
248229}
249- val docsDir = project.layout.buildDirectory.dir(" dokka" ).get().asFile
250230
251231tasks.dokkaHtmlMultiModule {
252- outputDirectory.set(docsDir.resolve(" $version " ))
232+ val docsDir = project.layout.buildDirectory.dir(" dokka" ).get().asFile
233+ outputDirectory.set(docsDir)
253234 pluginConfiguration<DokkaBase , DokkaBaseConfiguration > {
254235 customAssets + = file(projectDir.resolve(" dokka/logo-dark.svg" ))
255236 customAssets + = file(projectDir.resolve(" dokka/logo-icon.svg" ))
256237 customStyleSheets + = file(projectDir.resolve(" dokka/logo-styles.css" ))
257- footerMessage = createFooterMessage()
258- }
259- doLast {
260- val index = file(docsDir.resolve(" index.html" ))
261- index.writeText(createDocsIndexPage())
238+ footerMessage = dokkaFooterMessage
262239 }
263240}
264241
265- fun createFooterMessage (): String {
266- return createHTML().span {
267- createFooter()
268- }
269- }
270-
271- fun FlowContent.createFooter () {
272- p {
273- + " For more information visit "
274- a(" https://modelix.org" ) { + " modelix.org" }
275- + " , for further documentation visit "
276- a(" https://docs.modelix.org" ) { + " docs.modelix.org" }
277- + " ."
278- }
279- p {
280- + " Copyright \u00A9 2021-present by the "
281- a(" https://modelix.org" ) { + " modelix open source project" }
282- + " and the individual contributors. All Rights reserved."
283- }
284- p {
285- + " Except where otherwise noted, "
286- a(" https://api.modelix.org" ) { + " api.modelix.org" }
287- + " , modelix, and the modelix framework, are licensed under the "
288- a(" https://www.apache.org/licenses/LICENSE-2.0.html" ) { + " Apache-2.0 license" }
289- + " ."
290- }
291- }
292-
293- fun createDocsIndexPage (): String {
294- return createHTML().html {
295- head {
296- meta(charset = " utf-8" )
297- link(href = " ./$version /styles/style.css" , rel = " Stylesheet" )
298- link(href = " ./$version /styles/logo-styles.css" , rel = " Stylesheet" )
299- link(href = " ./$version /images/logo-icon.svg" , rel = " icon" )
300- title(" modelix.core API Reference" )
301- style {
302- unsafe {
303- + """
304- .library-name {
305- padding-top: 6px;
306- padding-bottom: 6px;
307- }
308- """ .trimIndent()
309- }
310- }
311- }
312- body {
313- div(" navigation-wrapper" ) {
314- id = " navigation-wrapper"
315- div(" library-name" ) {
316- a { + " modelix.core API Reference" }
317- }
318- }
319- div(" wrapper" ) {
320- id = " container"
321- div {
322- id = " leftColumn"
323- }
324- div {
325- id = " main"
326- div(" main-content" ) {
327- id = " content"
328- div(" breadcrumbs" )
329- div(" cover" ) {
330- h2 { + " Available versions:" }
331- div(" table" ) {
332- val versionDirs = docsDir.listFiles()
333- ?.filter {
334- it.isDirectory && ! it.name.startsWith(' .' ) && it.name != " latest"
335- }
336- ?.sortedByDescending { Version .parse(it.name) }
337- if (versionDirs != null ) {
338- div(" table-row" ) {
339- div(" main-subrow" ) {
340- div(" w-100" ) {
341- span(" inline-flex" ) {
342- a(href = " /latest" ) {
343- + " modelix.core LATEST"
344- }
345- }
346- }
347- }
348- }
349- for (versionDir in versionDirs) {
350- val versionIndex = versionDir.resolve(" index.html" )
351- if (versionIndex.exists()) {
352- div(" table-row" ) {
353- div(" main-subrow" ) {
354- div(" w-100" ) {
355- span(" inline-flex" ) {
356- a(href = versionIndex.relativeTo(docsDir).path) {
357- + " modelix.core ${versionDir.name} "
358- }
359- }
360- }
361- }
362- }
363- }
364- }
365- }
366- }
367- }
368- }
369- div(" footer" ) {
370- span(" go-to-top-icon" ) {
371- a(" #content" ) {
372- id = " go-to-top-link"
373- }
374- }
375- span {
376- createFooter()
377- }
378- }
379- }
380- }
381- }
382- }
383- }
242+ val dokkaFooterMessage = """
243+ <span>
244+ <p>For more information visit <a href="https://modelix.org">modelix.org</a>, for further documentation visit <a href="https://docs.modelix.org">docs.modelix.org</a>.</p>
245+ <p>Copyright ${" \u00A9 " } 2021-present by the <a href="https://modelix.org">modelix open source project</a> and the individual contributors. All Rights reserved.</p>
246+ <p>Except where otherwise noted, <a href="https://api.modelix.org">api.modelix.org</a>, modelix, and the modelix framework, are licensed under the <a href="https://www.apache.org/licenses/LICENSE-2.0.html">Apache-2.0 license</a>.</p>
247+ </span>
248+ """ .trimIndent()
384249
385250catalog {
386251 versionCatalog {
0 commit comments