diff --git a/docs/dokka-presets/templates/base.ftl b/docs/dokka-presets/templates/base.ftl
index bc88baf53bf..b2a89bdad1d 100644
--- a/docs/dokka-presets/templates/base.ftl
+++ b/docs/dokka-presets/templates/base.ftl
@@ -7,6 +7,8 @@
<@page_metadata.display/>
+ <#-- AWS Analytics tracking script - Implements site-wide analytics and tracking functionality -->
+
<@template_cmd name="pathToRoot">@template_cmd>
<#-- This script doesn't need to be there but it is nice to have
@@ -24,6 +26,16 @@
}
}
+ <#-- Scripts for onboarding AWS Shortbread - Manages cookie consent banners and user preferences to help ensure
+ compliance with privacy regulations like GDPR -->
+
+
+
+
<#-- Resources (scripts, stylesheets) are handled by Dokka.
Use customStyleSheets and customAssets to change them. -->
<@resources/>
diff --git a/dokka-aws/build.gradle.kts b/dokka-aws/build.gradle.kts
index e93f6aeb756..69154a1ffdc 100644
--- a/dokka-aws/build.gradle.kts
+++ b/dokka-aws/build.gradle.kts
@@ -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)
}
@@ -18,6 +20,16 @@ description = "Custom Dokka plugin for AWS Kotlin SDK API docs"
dependencies {
compileOnly(libs.dokka.base)
compileOnly(libs.dokka.core)
+
+ testImplementation(libs.jsoup)
+ testImplementation(libs.junit.jupiter)
+ testImplementation(libs.kotest.assertions.core.jvm)
+ testImplementation(libs.kotlin.test.junit5)
+}
+
+tasks.test {
+ useJUnitPlatform()
+ dependsOn(tasks.dokkaHtml)
}
tasks.withType {
@@ -31,3 +43,29 @@ tasks.withType {
sourceCompatibility = JavaVersion.VERSION_1_8.toString()
targetCompatibility = JavaVersion.VERSION_1_8.toString()
}
+
+tasks.withType().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").absolutePath.replace("\\", "/")}",
+ "${rootProject.file("docs/dokka-presets/css/aws-styles.css").absolutePath.replace("\\", "/")}"
+ ],
+ "customAssets": [
+ "${rootProject.file("docs/dokka-presets/assets/logo-icon.svg").absolutePath.replace("\\", "/")}",
+ "${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png").absolutePath.replace("\\", "/")}",
+ "${rootProject.file("docs/dokka-presets/scripts/accessibility.js").absolutePath.replace("\\", "/")}"
+ ],
+ "footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
+ "separateInheritedMembers" : true,
+ "templatesDir": "${rootProject.file("docs/dokka-presets/templates").absolutePath.replace("\\", "/")}"
+ }
+ """,
+ )
+ pluginsMapConfiguration.set(pluginConfigMap)
+}
diff --git a/dokka-aws/src/test/kotlin/aws/sdk/kotlin/dokka/DokkaAwsTest.kt b/dokka-aws/src/test/kotlin/aws/sdk/kotlin/dokka/DokkaAwsTest.kt
new file mode 100644
index 00000000000..280bb058cdc
--- /dev/null
+++ b/dokka-aws/src/test/kotlin/aws/sdk/kotlin/dokka/DokkaAwsTest.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
+ * SPDX-License-Identifier: Apache-2.0
+ */
+package aws.sdk.kotlin.dokka
+
+import org.jsoup.Jsoup
+import org.junit.jupiter.api.Test
+import org.junit.jupiter.api.TestInstance
+import java.io.File
+import kotlin.test.assertTrue
+
+@TestInstance(TestInstance.Lifecycle.PER_CLASS)
+class DokkaAwsTest {
+ @Test
+ fun testLoadScripts() {
+ val testFile = File("build/dokka/html/index.html")
+
+ assertTrue(
+ testFile.exists(),
+ "Test file does not exist: ${testFile.absolutePath}",
+ )
+
+ val document = Jsoup.parse(testFile, "UTF-8")
+
+ val expectedScripts = listOf(
+ "awshome_s_code.js",
+ )
+
+ val scripts = document.head().select("script[src]")
+
+ expectedScripts.forEach { expectedScript ->
+ assertTrue(
+ scripts.any { it.attr("src").endsWith(expectedScript) },
+ "Expected script $expectedScript not found",
+ )
+ }
+ }
+}
diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml
index 2b216ba6332..f8a255bd975 100644
--- a/gradle/libs.versions.toml
+++ b/gradle/libs.versions.toml
@@ -26,6 +26,7 @@ kotlinx-benchmark-version = "0.4.12"
kotlinx-serialization-version = "1.7.3"
mockk-version = "1.13.13"
slf4j-version = "2.0.16"
+jsoup-version = "1.20.1"
[libraries]
aws-kotlin-repo-tools-build-support = { module="aws.sdk.kotlin.gradle:build-support", version.ref = "aws-kotlin-repo-tools-version" }
@@ -111,6 +112,8 @@ smithy-aws-smoke-test-model = { module = "software.amazon.smithy:smithy-aws-smok
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-version" }
junit-jupiter-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit-version" }
+jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup-version" }
+
kotest-assertions-core = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest-version" }
kotest-assertions-core-jvm = { module = "io.kotest:kotest-assertions-core-jvm", version.ref = "kotest-version" }
kotest-framework-datatest = { module = "io.kotest:kotest-framework-datatest", version.ref = "kotest-version" }