Skip to content

Commit

Permalink
docs: rework dokka generation
Browse files Browse the repository at this point in the history
  • Loading branch information
utybo committed Oct 20, 2024
1 parent fa42840 commit 69999d8
Show file tree
Hide file tree
Showing 9 changed files with 111 additions and 122 deletions.
8 changes: 0 additions & 8 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,2 @@
plugins {
id 'org.jetbrains.dokka'
}

repositories {
mavenCentral()
}

group = "guru.zoroark.tegral"
version = rootProject.file('version.txt').text.trim()
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dependencies {
def pluginsDef = [
libs.plugins.kotlin,
libs.plugins.kotlinSerialization,
libs.plugins.dokka,
libs.plugins.dokkatoo,
libs.plugins.detekt,
libs.plugins.versions,
libs.plugins.gradleTestLogger,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'guru.zoroark.tegral.kotlin-common-conventions'
id 'guru.zoroark.tegral.publish-conventions'
id 'org.jetbrains.dokka'
id 'dev.adamko.dokkatoo'
id 'org.jetbrains.kotlinx.binary-compatibility-validator'
id 'maven-publish'
id 'signing'
Expand All @@ -14,14 +14,24 @@ detekt {
buildUponDefaultConfig = true
}

tasks.dokkaHtmlPartial {
dokkaSourceSets {
configureEach {
afterEvaluate {
dokkatoo {
//moduleName = project.ext.humanName

dokkatooSourceSets.configureEach {
includes.from("MODULE.md")
}
}
}

//tasks.dokkaHtmlPartial {
// dokkaSourceSets {
// configureEach {
// includes.from("MODULE.md")
// }
// }
//}

java {
withSourcesJar()
withJavadocJar()
Expand Down
37 changes: 1 addition & 36 deletions code-coverage/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,43 +7,8 @@ repositories {
mavenCentral()
}

def projects = [
':tegral-config:tegral-config-core',
':tegral-core',
':tegral-di:tegral-di-core',
':tegral-di:tegral-di-services',
':tegral-di:tegral-di-test',
':tegral-di:tegral-di-test-mockk',
':tegral-featureful',
':tegral-logging',
':tegral-niwen:tegral-niwen-lexer',
':tegral-niwen:tegral-niwen-parser',
':tegral-openapi:tegral-openapi-cli',
':tegral-openapi:tegral-openapi-dsl',
':tegral-openapi:tegral-openapi-feature',
':tegral-openapi:tegral-openapi-ktor',
':tegral-openapi:tegral-openapi-ktor-resources',
':tegral-openapi:tegral-openapi-ktorui',
':tegral-openapi:tegral-openapi-scriptdef',
':tegral-openapi:tegral-openapi-scripthost',
':tegral-prismakt:tegral-prismakt-generator',
':tegral-services:tegral-services-api',
':tegral-services:tegral-services-feature',
':tegral-utils:tegral-utils-logtools',
':tegral-web:tegral-web-appdefaults',
':tegral-web:tegral-web-appdsl',
':tegral-web:tegral-web-apptest',
':tegral-web:tegral-web-config',
':tegral-web:tegral-web-controllers',
':tegral-web:tegral-web-controllers-test',
':tegral-web:tegral-web-greeter',
':e2e-tests:run-with-java-11',
':e2e-tests:run-with-java-17',
':e2e-tests:run-without-config'
]

dependencies {
for (projectPath in projects) {
for (projectPath in gradle.ext.testProjects) {
aggregatedProjects project(projectPath)
}

Expand Down
32 changes: 32 additions & 0 deletions dokka/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
plugins {
id "dev.adamko.dokkatoo"
}

repositories {
mavenCentral()
}

configurations {
dokkaHtml {
canBeConsumed = true
canBeResolved = false
}
}

dokkatoo {
moduleName = "Tegral API reference"
}

version = rootProject.version

dependencies {
for (projectPath in gradle.ext.publicProjects) {
dokkatoo project(projectPath)
}
}

artifacts {
dokkaHtml(tasks.dokkatooGeneratePublicationHtml.outputDirectory) {
builtBy(tasks.dokkatooGeneratePublicationHtml)
}
}
7 changes: 3 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
coroutines = "1.9.0"
detekt = "1.23.6" # waiting for a release with a fix for https://github.com/detekt/detekt/issues/7634
dokka = "1.9.20"
detekt = "1.23.6" # waiting for a release with a fix for https://github.com/detekt/detekt/issues/7634
dokkatoo = "2.3.1"
gradleTestLogger = "4.0.0"
hoplite = "2.8.2"
jackson = "2.18.0"
Expand Down Expand Up @@ -41,7 +41,6 @@ kotlin-scripting-jvmHost = { module = "org.jetbrains.kotlin:kotlin-scripting-jvm
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-host = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-locations = { module = "io.ktor:ktor-server-locations", version.ref = "ktor" }
ktor-server-contentNegotiation = { module = "io.ktor:ktor-server-content-negotiation", version.ref = "ktor" }
ktor-server-test = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
ktor-server-resources = { module = "io.ktor:ktor-server-resources", version.ref = "ktor" }
Expand Down Expand Up @@ -106,7 +105,7 @@ commons-lang3 = { module = "org.apache.commons:commons-lang3", version.ref = "la

kotlin = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinSerialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
dokkatoo = { id = "dev.adamko.dokkatoo", version.ref = "dokkatoo" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versions" }
gradleTestLogger = { id = "com.adarshr.test-logger", version.ref = "gradleTestLogger" }
Expand Down
96 changes: 56 additions & 40 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,67 @@ plugins {
id "com.gradle.enterprise" version "3.12.2"
}

// NOTE: When adding projects here, do not forget to also add them as dependencies in the 'code-coverage' project!
include 'tegral-catalog',
'tegral-config:tegral-config-core',
'tegral-core',
'tegral-di:tegral-di-core',
'tegral-di:tegral-di-services',
'tegral-di:tegral-di-test',
'tegral-di:tegral-di-test-mockk',
'tegral-featureful',
'tegral-logging',
'tegral-niwen:tegral-niwen-lexer',
'tegral-niwen:tegral-niwen-parser',
'tegral-openapi:tegral-openapi-cli',
'tegral-openapi:tegral-openapi-dsl',
'tegral-openapi:tegral-openapi-feature',
'tegral-openapi:tegral-openapi-ktor',
'tegral-openapi:tegral-openapi-ktor-resources',
'tegral-openapi:tegral-openapi-ktorui',
'tegral-openapi:tegral-openapi-scriptdef',
'tegral-openapi:tegral-openapi-scripthost',
'tegral-prismakt:tegral-prismakt-generator',
'tegral-prismakt:tegral-prismakt-generator-tests:mysql-types',
'tegral-prismakt:tegral-prismakt-generator-tests:pgsql-types',
'tegral-prismakt:tegral-prismakt-generator-tests:simple-dao',
'tegral-prismakt:tegral-prismakt-generator-tests:simple-sql',
'tegral-prismakt:tegral-prismakt-generator-tests-support',
'tegral-services:tegral-services-api',
'tegral-services:tegral-services-feature',
'tegral-utils:tegral-utils-logtools',
'tegral-web:tegral-web-appdefaults',
'tegral-web:tegral-web-appdsl',
'tegral-web:tegral-web-apptest',
'tegral-web:tegral-web-config',
'tegral-web:tegral-web-controllers',
'tegral-web:tegral-web-controllers-test',
'tegral-web:tegral-web-greeter',
'e2e-tests:fundef-modules',
'e2e-tests:run-with-java-11',
'e2e-tests:run-with-java-17',
'e2e-tests:run-without-config'
def publicProjects = [
':tegral-catalog',
':tegral-config:tegral-config-core',
':tegral-core',
':tegral-di:tegral-di-core',
':tegral-di:tegral-di-services',
':tegral-di:tegral-di-test',
':tegral-di:tegral-di-test-mockk',
':tegral-featureful',
':tegral-logging',
':tegral-niwen:tegral-niwen-lexer',
':tegral-niwen:tegral-niwen-parser',
':tegral-openapi:tegral-openapi-cli',
':tegral-openapi:tegral-openapi-dsl',
':tegral-openapi:tegral-openapi-feature',
':tegral-openapi:tegral-openapi-ktor',
':tegral-openapi:tegral-openapi-ktor-resources',
':tegral-openapi:tegral-openapi-ktorui',
':tegral-openapi:tegral-openapi-scriptdef',
':tegral-openapi:tegral-openapi-scripthost',
':tegral-prismakt:tegral-prismakt-generator',
':tegral-services:tegral-services-api',
':tegral-services:tegral-services-feature',
':tegral-utils:tegral-utils-logtools',
':tegral-web:tegral-web-appdefaults',
':tegral-web:tegral-web-appdsl',
':tegral-web:tegral-web-apptest',
':tegral-web:tegral-web-config',
':tegral-web:tegral-web-controllers',
':tegral-web:tegral-web-controllers-test',
':tegral-web:tegral-web-greeter',
]

def testProjects = publicProjects + [
':tegral-prismakt:tegral-prismakt-generator-tests:mysql-types',
':tegral-prismakt:tegral-prismakt-generator-tests:pgsql-types',
':tegral-prismakt:tegral-prismakt-generator-tests:simple-dao',
':tegral-prismakt:tegral-prismakt-generator-tests:simple-sql',
':tegral-prismakt:tegral-prismakt-generator-tests-support',
':e2e-tests:fundef-modules',
':e2e-tests:run-with-java-11',
':e2e-tests:run-with-java-17',
':e2e-tests:run-without-config'
]

gradle.ext.publicProjects = publicProjects
gradle.ext.testProjects = testProjects

for (project in publicProjects) {
include project
}
for (project in testProjects) {
include project
}


include 'examples:simple-json-api'

include 'code-coverage'
include 'docs'
include 'dokka'
include 'website'

gradleEnterprise {
Expand Down
2 changes: 1 addition & 1 deletion tegral-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@ sourceSets {

compileKotlin.dependsOn generateKotlin
checkLicenseMain.dependsOn generateKotlin
dokkaHtmlPartial.dependsOn generateKotlin
dokkatooGenerateModuleHtml.dependsOn generateKotlin
sourcesJar.dependsOn generateKotlin
31 changes: 3 additions & 28 deletions website/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,49 +10,24 @@ repositories {
configurations {
servine
docusaurus
dokkaHtml
}

dependencies {
servine 'guru.zoroark.servine:servine:0.0.2-SNAPSHOT'
docusaurus(project(path: ":docs", configuration: 'web'))
}

import org.apache.tools.ant.filters.ReplaceTokens

task rewriteDokkaLinks(type: Copy) {
into layout.buildDirectory.dir("dokkaHtml")

dependsOn rootProject.tasks.dokkaHtmlMultiModule
dokkaHtml(project(path: ":dokka", configuration: 'dokkaHtml'))

from(rootProject.layout.buildDirectory.dir("dokka/htmlMultiModule")) {
filesMatching(["index.html"]) {
filter { line ->
line.replaceAll("href=\"", "href=\"/dokka/")
.replaceAll("src=\"", "src=\"/dokka/")
.replaceAll("pathToRoot = \"\"", "pathToRoot = \"/dokka\"")
}
}

filesMatching(["scripts/pages.json"]) {
filter { line -> line.replaceAll("\"location\":\"", "\"location\":\"/") }
}

filesMatching(["scripts/navigation-loader.js"]) {
filter { line -> line.replaceAll("pathToRoot", "\"/dokka/\"") }
}
}
}

task assembleFiles(type: Copy) {
into layout.buildDirectory.dir("output")

from(configurations.docusaurus)
from(layout.buildDirectory.dir("dokkaHtml")) {
from(configurations.dokkaHtml) {
into 'dokka'
}
from('_redirects')

dependsOn rewriteDokkaLinks
}

task serve(type: JavaExec) {
Expand Down

0 comments on commit 69999d8

Please sign in to comment.