Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions dokka-aws/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
*/
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.LocalDate

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
plugins {
alias(libs.plugins.dokka)
alias(libs.plugins.kotlin.jvm)
}

Expand Down Expand Up @@ -40,3 +42,29 @@ tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}

tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
val sdkVersion: String by project
moduleVersion.set(sdkVersion)

val year = LocalDate.now().year
val pluginConfigMap = mapOf(
"org.jetbrains.dokka.base.DokkaBase" to """
{
"customStyleSheets": [
"${rootProject.file("docs/dokka-presets/css/logo-styles.css")}",
"${rootProject.file("docs/dokka-presets/css/aws-styles.css")}"
],
"customAssets": [
"${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}",
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}",
"${rootProject.file("docs/dokka-presets/scripts/accessibility.js")}"
],
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
"separateInheritedMembers" : true,
"templatesDir": "${rootProject.file("docs/dokka-presets/templates")}"
}
""",
)
pluginsMapConfiguration.set(pluginConfigMap)
}
34 changes: 33 additions & 1 deletion dokka-aws/src/test/kotlin/aws/sdk/kotlin/dokka/DokkaAwsTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,47 @@
package aws.sdk.kotlin.dokka

import org.jsoup.Jsoup
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assumptions.assumeTrue
import org.junit.jupiter.api.BeforeEach
import org.junit.jupiter.api.Test
import java.io.File
import kotlin.test.assertTrue

class DokkaAwsTest {
val dokkaOutputDir = File("build/dokka")

@BeforeEach
fun generateDocs() {
val process = ProcessBuilder(
"./gradlew",
":dokka-aws:dokkaHtml",
).directory(File(".."))
.redirectErrorStream(true)
.start()

val exitCode = process.waitFor()
assumeTrue(
exitCode == 0,
"Dokka generation failed with exit code $exitCode",
)
}

@AfterEach
fun cleanup() {
if (dokkaOutputDir.exists()) {
try {
dokkaOutputDir.deleteRecursively()
println("Successfully deleted dokka folder")
} catch (e: Exception) {
println("Failed to delete dokka folder: ${e.message}")
}
}
}

@Test
fun testLoadScripts() {
val testFile = File("../build/dokka/htmlMultiModule/index.html")
val testFile = File("build/dokka/html/index.html")

assumeTrue(
testFile.exists(),
Expand Down
Loading