diff --git a/.editorconfig b/.editorconfig index 47da0e88868..b9496016fcc 100644 --- a/.editorconfig +++ b/.editorconfig @@ -9,4 +9,7 @@ ktlint_standard_backing-property-naming = disabled # enable trailing commas per JetBrains recommendation # (https://kotlinlang.org/docs/coding-conventions.html#trailing-commas) ij_kotlin_allow_trailing_comma_on_call_site = true -ij_kotlin_allow_trailing_comma = true \ No newline at end of file +ij_kotlin_allow_trailing_comma = true + +[buildSrc/build/**] +ktlint = disabled \ No newline at end of file diff --git a/aws-runtime/aws-config/build.gradle.kts b/aws-runtime/aws-config/build.gradle.kts index 7a7f1938e1e..3d3759115d8 100644 --- a/aws-runtime/aws-config/build.gradle.kts +++ b/aws-runtime/aws-config/build.gradle.kts @@ -5,7 +5,6 @@ import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir -import org.jetbrains.dokka.gradle.DokkaTaskPartial plugins { alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) @@ -83,7 +82,6 @@ smithyBuild { val basePackage = "aws.sdk.kotlin.runtime.auth.credentials.internal" projections { - // generate an sts client create("sts-credentials-provider") { imports = listOf( @@ -241,9 +239,12 @@ smithyBuild.projections.all { } } -// suppress internal generated clients -tasks.named("dokkaHtmlPartial") { - dependsOn(tasks.generateSmithyProjections) +// Suppress internally-generated clients +dokka { + tasks.dokkaGenerateModuleHtml { + dependsOn(tasks.generateSmithyProjections) + } + dokkaSourceSets.configureEach { perPackageOption { matchingRegex.set(""".*\.internal.*""") diff --git a/aws-runtime/build.gradle.kts b/aws-runtime/build.gradle.kts index 97e9c335bd5..442fbe701f1 100644 --- a/aws-runtime/build.gradle.kts +++ b/aws-runtime/build.gradle.kts @@ -9,7 +9,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget description = "AWS client runtime support for generated service clients" plugins { - alias(libs.plugins.dokka) + `dokka-convention` alias(libs.plugins.kotlinx.binary.compatibility.validator) alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false jacoco @@ -28,7 +28,6 @@ subprojects { apply { plugin("org.jetbrains.kotlin.multiplatform") - plugin("org.jetbrains.dokka") plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId) } @@ -61,10 +60,6 @@ subprojects { listOf("kotlin.RequiresOptIn").forEach { languageSettings.optIn(it) } } - dependencies { - dokkaPlugin(project(":dokka-aws")) - } - tasks.withType { compilerOptions { jvmTarget.set(JvmTarget.JVM_1_8) @@ -77,3 +72,11 @@ subprojects { } } } + +// Configure Dokka for subprojects +dependencies { + subprojects.forEach { + it.plugins.apply("dokka-convention") // Apply the Dokka conventions plugin to the subproject + dokka(project(it.path)) // Aggregate the subprojects' generated documentation + } +} diff --git a/build.gradle.kts b/build.gradle.kts index 87e685c1fab..9fe782b26ee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,7 +5,6 @@ import aws.sdk.kotlin.gradle.dsl.configureLinting import aws.sdk.kotlin.gradle.dsl.configureNexus import aws.sdk.kotlin.gradle.util.typedProp -import java.net.URL buildscript { // NOTE: buildscript classpath for the root project is the parent classloader for the subprojects, we @@ -18,10 +17,10 @@ buildscript { } plugins { - alias(libs.plugins.dokka) + `dokka-convention` // ensure the correct version of KGP ends up on our buildscript classpath - alias(libs.plugins.kotlin.multiplatform) apply false - alias(libs.plugins.kotlin.jvm) apply false + id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false + id(libs.plugins.kotlin.jvm.get().pluginId) apply false alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics) } @@ -39,67 +38,9 @@ val testJavaVersion = typedProp("test.java.version")?.let { } allprojects { - tasks.withType().configureEach { - val sdkVersion: String by project - moduleVersion.set(sdkVersion) - - val year = java.time.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) - } - - tasks.withType().configureEach { - // each module can include their own top-level module documentation - // see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation - if (project.file("API.md").exists()) { - dokkaSourceSets.configureEach { - includes.from(project.file("API.md")) - } - } - - dokkaSourceSets.configureEach { - samples.from(project.file("samples").path, project.file("generated-src/samples").path) - } - - val smithyKotlinPackageListUrl: String? by project - val smithyKotlinDocBaseUrl: String? by project - - // Configure Dokka to link to smithy-kotlin types if specified in properties - // These optional properties are supplied api the api docs build job but are unneeded otherwise - smithyKotlinDocBaseUrl.takeUnless { it.isNullOrEmpty() }?.let { docBaseUrl -> - val expandedDocBaseUrl = docBaseUrl.replace("\$smithyKotlinRuntimeVersion", libs.versions.smithy.kotlin.runtime.version.get()) - dokkaSourceSets.configureEach { - externalDocumentationLink { - url.set(URL(expandedDocBaseUrl)) - - smithyKotlinPackageListUrl - .takeUnless { it.isNullOrEmpty() } - ?.let { packageListUrl.set(URL(it)) } - } - } - } - } - if (rootProject.typedProp("kotlinWarningsAsErrors") == true) { tasks.withType { - kotlinOptions.allWarningsAsErrors = true + compilerOptions.allWarningsAsErrors = true } } @@ -118,26 +59,24 @@ allprojects { tasks.register("allDeps") { } } -project.afterEvaluate { - // configure the root multimodule docs - tasks.dokkaHtmlMultiModule.configure { - moduleName.set("AWS SDK for Kotlin") - - // Output subprojects' docs to /project-name/* instead of /path/to/project-name/* - // This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the - // package-list doesn't contain enough project path information to indicate where modules' documentation are - // located. - fileLayout.set { parent, child -> - parent.outputDirectory.dir(child.moduleName) - } +// Configure root module's documentation +dokka { + moduleName.set("AWS SDK for Kotlin") + dokkaPublications.html { includes.from( - // NOTE: these get concatenated rootProject.file("docs/dokka-presets/README.md"), ) } } +// Aggregate subprojects' documentation +dependencies { + dokka(project(":aws-runtime")) + dokka(project(":services")) + dokka(project(":hll")) +} + // Publishing configureNexus() diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index dccd6941e76..d5a47a72d29 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -1,7 +1,14 @@ plugins { alias(libs.plugins.kotlin.jvm) + `kotlin-dsl` } repositories { mavenCentral() + gradlePluginPortal() +} + +dependencies { + implementation(libs.dokka.gradle.plugin) + implementation(libs.kotlin.gradle.plugin) } diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts index b5a0fabf664..62991c1ef50 100644 --- a/buildSrc/settings.gradle.kts +++ b/buildSrc/settings.gradle.kts @@ -1,3 +1,5 @@ +rootProject.name = "buildSrc" + dependencyResolutionManagement { versionCatalogs { create("libs") { diff --git a/buildSrc/src/main/kotlin/dokka-convention.gradle.kts b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts new file mode 100644 index 00000000000..594f7b3c8f5 --- /dev/null +++ b/buildSrc/src/main/kotlin/dokka-convention.gradle.kts @@ -0,0 +1,54 @@ +import kotlin.text.set + +plugins { + id("org.jetbrains.dokka") +} + +dokka { + val sdkVersion: String by project + moduleVersion.set(sdkVersion) + + pluginsConfiguration.html { + customStyleSheets.from( + rootProject.file("docs/dokka-presets/css/aws-styles.css"), + ) + + customAssets.from( + rootProject.file("docs/dokka-presets/assets/logo-icon.svg"), + rootProject.file("docs/dokka-presets/scripts/accessibility.js"), + ) + + footerMessage.set("© ${java.time.LocalDate.now().year}, Amazon Web Services, Inc. or its affiliates. All rights reserved.") + separateInheritedMembers.set(true) + } + + // each module can include their own top-level module documentation + // see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation + if (project.file("API.md").exists()) { + dokkaSourceSets.configureEach { + includes.from(project.file("API.md")) + } + } + + dokkaSourceSets.configureEach { + // Only configure samples on `commonMain`. + // Fixes compiler warnings: "Source sets 'common' and 'desktop' have the common sample roots. In Dokka K2 it will be an error." + if (name == "commonMain") { + samples.from(project.file("samples").path, project.file("generated-src/samples").path) + } + } + + // Configure Dokka to link to smithy-kotlin types + dokkaSourceSets.configureEach { + externalDocumentationLinks { + create("smithy-kotlin") { + val smithyKotlinRuntimeVersion = versionCatalogs.named("libs").findVersion("smithy-kotlin-runtime-version").get() + url("https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/$smithyKotlinRuntimeVersion") + } + } + } +} + +dependencies { + dokkaPlugin(project(":dokka-aws")) +} diff --git a/codegen/aws-sdk-codegen/build.gradle.kts b/codegen/aws-sdk-codegen/build.gradle.kts index 0348cd5a7f1..7d79f95d6c3 100644 --- a/codegen/aws-sdk-codegen/build.gradle.kts +++ b/codegen/aws-sdk-codegen/build.gradle.kts @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile * SPDX-License-Identifier: Apache-2.0 */ plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) jacoco } diff --git a/docs/dokka-presets/assets/aws_logo_white_59x35.png b/docs/dokka-presets/assets/aws_logo_white_59x35.png deleted file mode 100644 index a35f38afd37..00000000000 Binary files a/docs/dokka-presets/assets/aws_logo_white_59x35.png and /dev/null differ diff --git a/docs/dokka-presets/assets/logo-icon.svg b/docs/dokka-presets/assets/logo-icon.svg index ba320e493de..7ec259dd81d 100644 --- a/docs/dokka-presets/assets/logo-icon.svg +++ b/docs/dokka-presets/assets/logo-icon.svg @@ -1,15 +1,38 @@ - - - + + + + + + + + + + + diff --git a/docs/dokka-presets/css/aws-styles.css b/docs/dokka-presets/css/aws-styles.css index 3781deeceeb..936e30b7890 100644 --- a/docs/dokka-presets/css/aws-styles.css +++ b/docs/dokka-presets/css/aws-styles.css @@ -4,45 +4,29 @@ */ :root { - --aws-color-dark: #232f3e; - --horizontal-spacing-for-content: 16px; - --default-font-family: JetBrains Sans, Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI,Roboto, Oxygen, Ubuntu,Cantarell, Droid Sans, Helvetica Neue, Arial, sans-serif; + --color-background-nav: #232f3e; + --dokka-logo-height: 60px; + --dokka-logo-width: 90px; } -.menu-toggle { - background: none; -} - -.menu-toggle:focus { - outline: 2px solid #fff; /* White outline */ - outline-offset: 2px; /* Space between the outline and the button */ -} - -#pages-search:focus { - outline: revert; -} - -/* copied from Dokka except for background-color attribute */ -.navigation { - display: flex; - justify-content: space-between; - - color: #fff; - background-color: var(--aws-color-dark); - font-family: var(--default-font-family); - letter-spacing: -0.1px; - - /* Reset margin and use padding for border */ - margin-left: 0; - margin-right: 0; - padding: 10px var(--horizontal-spacing-for-content); - - z-index: 4; +.skip-to-content { + position: absolute; /* Remove from normal flow */ + top: 0; /* Position off-screen */ + left: 0; + width: 1px; + height: 1px; + overflow: hidden; + opacity: 0; + z-index: -1; /* Ensure it's not visible */ } -/* Styles for section tabs like "Types" and "Functions" */ -.section-tab:focus, .section-tab:active { - outline: 2px solid var(--active-tab-border-color); /* The color appears unresolved, but it is defined in Dokka style sheets */ +.skip-to-content:focus, +.skip-to-content:active { + position: static; /* Restore to normal flow when focused */ + width: auto; + height: auto; + opacity: 1; + z-index: 999; /* Ensure it's on top */ } /* @@ -55,44 +39,6 @@ .symbol { overflow-wrap: break-word; } - .keyValue { display: block; -} - -/* - Disable the playground run button for generated samples - https://github.com/Kotlin/dokka/issues/3041 -*/ -div .compiler-info, .fold-button, .run-button { - display: none; -} - -.skip-to-content { - width: 1px; - height: 1px; - overflow: hidden; - opacity: 0; -} - -.skip-to-content:focus, -.skip-to-content:active { - width: auto; - height: auto; - opacity: 1; - z-index: 999; /* Ensure the skip link is on top of other content */ -} - -.aws-toggle-content-btn { - font-size: 24px; - background: none; - border: none; - cursor: pointer; - padding: 8px; -} - -@media (max-width: 550px) { - .content[data-togglable] { - display: none; - } } \ No newline at end of file diff --git a/docs/dokka-presets/css/logo-styles.css b/docs/dokka-presets/css/logo-styles.css deleted file mode 100644 index e53d3a536c5..00000000000 --- a/docs/dokka-presets/css/logo-styles.css +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0 - */ - -.library-name a { - position: relative; - --logo-width: 72px; - margin-left: calc(var(--logo-width) + 5px); - display: flex; - align-items: center; - color: #fff; - font-weight: 700; - margin-top: 10px; - margin-right: 8px; -} - -.library-name a::before { - content: ''; - /* path is relative to final asset location output dir */ - background-image: url('../images/aws_logo_white_59x35.png'); - background-size: contain; - position: absolute; - width: 59px; - height: 35px; - left: calc(-1 * var(--logo-width) - 5px); - margin-right: 5px; -} - -/* Copied from Dokka except `top` replaced with `margin-top` attribute */ -.library-version { - position: relative; - margin-left: 3px; - color: rgba(255,255,255,.7); - font-size: 13px; - font-weight: normal; - line-height: 16px; - margin-top: 19px; -} diff --git a/docs/dokka-presets/scripts/accessibility.js b/docs/dokka-presets/scripts/accessibility.js index b5fe59a6040..aa61b12f9f3 100644 --- a/docs/dokka-presets/scripts/accessibility.js +++ b/docs/dokka-presets/scripts/accessibility.js @@ -1,8 +1,8 @@ /** - * Check for elements with a navButton class, which indicates the sidebar has finished loading. + * Check for elements with a `toc--button` class, which indicates the sidebar has finished loading. */ async function dispatchNavigationLoadedEvent() { - while (!document.querySelectorAll('.navButton').length > 0) { + while (!document.querySelectorAll('.toc--button').length > 0) { await new Promise(resolve => setTimeout(resolve, 100)); } window.dispatchEvent(new Event('navigationLoaded')); @@ -12,14 +12,14 @@ document.addEventListener('DOMContentLoaded', dispatchNavigationLoadedEvent); if (document.readyState === "interactive" || document.readyState === "complete" ) { dispatchNavigationLoadedEvent() } /** - * Apply "skip to main content" buttons after each active left sidebar `sideMenuPart`. + * Apply "skip to main content" buttons after each active left sidebar `toc--part`. * These are invisible and only accessible via keyboard * Fixes accessibility violation: "Provide a mechanism for skipping past repetitive content" */ function applySkipLinks() { document.querySelectorAll('#content').forEach(function(contentDiv) { - contentDiv.setAttribute('role', 'main'); - contentDiv.setAttribute('tabindex', '-1'); + contentDiv.setAttribute('role', 'main'); + contentDiv.setAttribute('tabindex', '-1'); }); function insertSkipLink(element) { @@ -42,20 +42,20 @@ function applySkipLinks() { function handleChanges(mutationsList) { for (const mutation of mutationsList) { - if (mutation.type === 'attributes' && mutation.target.classList.contains('sideMenuPart') && !mutation.target.classList.contains('hidden')) { + if (mutation.type === 'attributes' && mutation.target.classList.contains('toc--part') && !mutation.target.classList.contains('toc--part_hidden')) { insertSkipLink(mutation.target); } } + } - // Insert a skip link on all sideMenuParts with [data-active] property - document.querySelectorAll('.sideMenuPart[data-active]').forEach(function(sideMenuPart) { - insertSkipLink(sideMenuPart) - }); + // Insert a skip link on all visible toc-parts + document.querySelectorAll('.toc--part:not(.toc--part_hidden)').forEach(function(sideMenuPart) { + insertSkipLink(sideMenuPart) + }); - // Insert a skip link on the first sideMenuPart - const firstSideMenuPart = document.getElementById("sideMenu").children[0].querySelectorAll(".sideMenuPart")[0] - insertSkipLink(firstSideMenuPart) - } + // Insert a skip link on the first toc-part, regardless of visibility. + const firstSideMenuPart = document.getElementById("sideMenu").children[0].querySelectorAll(".toc--part")[0] + insertSkipLink(firstSideMenuPart) const observer = new MutationObserver(handleChanges); const observerConfig = { @@ -67,61 +67,3 @@ function applySkipLinks() { observer.observe(document.body, observerConfig); } window.addEventListener('navigationLoaded', applySkipLinks); - -/** - * Ensure `navButton` elements are interactable and have proper accessibility properties - * Fixes accessibilty violation: "Ensure all interactive functionality is operable with the keyboard" - */ -function ensureNavButtonInteractable() { - const navButtons = document.querySelectorAll('.navButton'); - - navButtons.forEach(function(navButton) { - if (navButton.hasAttribute('aria-expanded')) { - return; - } - - // Make the navButton focusable, add accessibility information - navButton.setAttribute('tabindex', '0'); - navButton.setAttribute('role', 'button'); - - const sideMenuPartParent = navButton.closest(".sideMenuPart") - const navButtonExpanded = sideMenuPartParent ? (sideMenuPartParent.classList.contains('hidden') ? 'false' : 'true') : 'false' - navButton.setAttribute('aria-expanded', navButtonExpanded); - - // Grab the page ID, use it for aria-label and aria-controls - const sectionName = navButton.parentElement.parentElement.getAttribute('pageid') - // Remove the page ID suffix auto-generated by Dokka - const cleanedSectionName = sectionName.substring(0, sectionName.indexOf("////PointingToDeclaration")) - navButton.setAttribute('aria-label', cleanedSectionName); - - const sectionID = navButton.parentElement.parentElement.id - navButton.setAttribute('aria-controls', sectionID); - - // Add event listener for Enter and Space keys - navButton.addEventListener('keydown', function(event) { - if (event.key === 'Enter' || event.key === ' ') { - event.preventDefault(); // Prevent the default action to avoid navigation - this.click(); // Trigger the onclick event - } - }); - - // Update aria-expanded attribute on click - navButton.addEventListener('click', function() { - const isExpanded = navButton.getAttribute('aria-expanded') === 'true'; - navButton.setAttribute('aria-expanded', (!isExpanded).toString()); - }); - }); -} -window.addEventListener('navigationLoaded', ensureNavButtonInteractable); - -/** - * Ensure that content (specifically, code blocks) reflows on small page sizes. - * Fixes accessibility violation: "Ensure pages reflow without requiring two-dimensional scrolling without loss of content or functionality" - */ -function ensureContentReflow() { - // Ensure `content` sections are reflowable - document.querySelectorAll('.content[data-togglable]').forEach(function(content) { - content.style.display = 'block' - }); -} -window.addEventListener('navigationLoaded', ensureContentReflow); \ No newline at end of file diff --git a/docs/dokka-presets/templates/base.ftl b/docs/dokka-presets/templates/base.ftl deleted file mode 100644 index bc88baf53bf..00000000000 --- a/docs/dokka-presets/templates/base.ftl +++ /dev/null @@ -1,46 +0,0 @@ -<#-- This is an unchanged copy of Dokka's base.ftl --> -<#import "includes/page_metadata.ftl" as page_metadata> -<#import "includes/header.ftl" as header> -<#import "includes/footer.ftl" as footer> - - - - - <@page_metadata.display/> - <@template_cmd name="pathToRoot"> - - <#-- This script doesn't need to be there but it is nice to have - since app in dark mode doesn't 'blink' (class is added before it is rendered) --> - - <#-- Resources (scripts, stylesheets) are handled by Dokka. - Use customStyleSheets and customAssets to change them. --> - <@resources/> - - -
- <@header.display/> -
- -
- <@content/> - <@footer.display/> -
-
-
- - diff --git a/docs/dokka-presets/templates/includes/footer.ftl b/docs/dokka-presets/templates/includes/footer.ftl deleted file mode 100644 index 157f0b95428..00000000000 --- a/docs/dokka-presets/templates/includes/footer.ftl +++ /dev/null @@ -1,8 +0,0 @@ -<#-- This is an unchanged copy of Dokka's footer.ftl --> -<#macro display> - - \ No newline at end of file diff --git a/docs/dokka-presets/templates/includes/header.ftl b/docs/dokka-presets/templates/includes/header.ftl deleted file mode 100644 index 4ef1f0ed124..00000000000 --- a/docs/dokka-presets/templates/includes/header.ftl +++ /dev/null @@ -1,28 +0,0 @@ -<#-- This is a modified copy of Dokka's header.ftl, adding a label to the search icon to allow focusing on it. --> -<#import "source_set_selector.ftl" as source_set_selector> -<#macro display> - - \ No newline at end of file diff --git a/docs/dokka-presets/templates/includes/page_metadata.ftl b/docs/dokka-presets/templates/includes/page_metadata.ftl deleted file mode 100644 index fbfed49067c..00000000000 --- a/docs/dokka-presets/templates/includes/page_metadata.ftl +++ /dev/null @@ -1,7 +0,0 @@ -<#-- This is an unchanged copy of Dokka's page_metadata.ftl --> -<#macro display> - ${pageName} - <@template_cmd name="pathToRoot"> - - - diff --git a/docs/dokka-presets/templates/includes/source_set_selector.ftl b/docs/dokka-presets/templates/includes/source_set_selector.ftl deleted file mode 100644 index 1e7ed967a81..00000000000 --- a/docs/dokka-presets/templates/includes/source_set_selector.ftl +++ /dev/null @@ -1,10 +0,0 @@ -<#-- This is an unchanged copy of Dokka's source_set_selector.ftl --> -<#macro display> - <#if sourceSets?has_content> -
- <#list sourceSets as ss> - - -
- - \ No newline at end of file diff --git a/dokka-aws/build.gradle.kts b/dokka-aws/build.gradle.kts index e93f6aeb756..209c32f3da4 100644 --- a/dokka-aws/build.gradle.kts +++ b/dokka-aws/build.gradle.kts @@ -10,7 +10,7 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile * SPDX-License-Identifier: Apache-2.0 */ plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) } description = "Custom Dokka plugin for AWS Kotlin SDK API docs" diff --git a/gradle.properties b/gradle.properties index 6cbb81167b2..ab4cf179f9b 100644 --- a/gradle.properties +++ b/gradle.properties @@ -19,4 +19,6 @@ kotlinx.atomicfu.enableNativeIrTransformation=false # https://github.com/google/ksp/blob/main/docs/ksp2.md # Disable KSP2 due to a bug around subsequent invocations # https://github.com/google/dagger/issues/4181 / https://github.com/google/ksp/issues/1678 -ksp.useKSP2=false \ No newline at end of file +ksp.useKSP2=false + +org.jetbrains.dokka.experimental.gradle.pluginMode=V2Enabled diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 2195cfc3a42..fa190a6c855 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -2,9 +2,9 @@ kotlin-version = "2.1.0" ksp-version = "2.1.0-1.0.29" # Keep in sync with kotlin-version -dokka-version = "1.9.10" +dokka-version = "2.0.0" -aws-kotlin-repo-tools-version = "0.4.18" +aws-kotlin-repo-tools-version = "0.4.19" # libs coroutines-version = "1.9.0" @@ -30,12 +30,14 @@ slf4j-version = "2.0.16" [libraries] aws-kotlin-repo-tools-build-support = { module="aws.sdk.kotlin.gradle:build-support", version.ref = "aws-kotlin-repo-tools-version" } +kotlin-gradle-plugin = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kotlin-version" } kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kotlin-version" } kotlin-stdlib-jdk8 = { module = "org.jetbrains.kotlin:kotlin-stdlib-jdk8", version.ref = "kotlin-version" } kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin-version" } kotlin-test-junit5 = { module = "org.jetbrains.kotlin:kotlin-test-junit5", version.ref = "kotlin-version" } dokka-core = { module = "org.jetbrains.dokka:dokka-core", version.ref = "dokka-version" } dokka-base = { module = "org.jetbrains.dokka:dokka-base", version.ref = "dokka-version" } +dokka-gradle-plugin = { module = "org.jetbrains.dokka:dokka-gradle-plugin", version.ref = "dokka-version" } kotlinx-atomicfu = { module = "org.jetbrains.kotlinx:atomicfu", version.ref = "atomicfu-version" } kotlinx-atomicfu-plugin = { module = "org.jetbrains.kotlinx:atomicfu-gradle-plugin", version.ref = "atomicfu-version" } @@ -142,8 +144,8 @@ smithy-kotlin-service-client = [ [plugins] dokka = { id = "org.jetbrains.dokka", version.ref = "dokka-version"} -kotlin-jvm = {id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" } -kotlin-multiplatform = {id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } +kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin-version" } +kotlin-multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin-version" } kotlinx-benchmark = { id = "org.jetbrains.kotlinx.benchmark", version.ref = "kotlinx-benchmark-version" } kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "binary-compatibility-validator-version" } kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin-version"} diff --git a/hll/build.gradle.kts b/hll/build.gradle.kts index ddd1bdcee90..23d9ac0e128 100644 --- a/hll/build.gradle.kts +++ b/hll/build.gradle.kts @@ -5,8 +5,6 @@ import aws.sdk.kotlin.gradle.dsl.configurePublishing import aws.sdk.kotlin.gradle.kmp.* -import aws.smithy.kotlin.runtime.InternalApi -import aws.smithy.kotlin.runtime.text.ensureSuffix import org.jetbrains.kotlin.gradle.dsl.JvmTarget description = "High-level libraries for the AWS SDK for Kotlin" @@ -16,7 +14,7 @@ extra["moduleName"] = "aws.sdk.kotlin.hll" // FIXME 🔽🔽🔽 This is all copied from :aws-runtime and should be commonized 🔽🔽🔽 plugins { - alias(libs.plugins.dokka) + `dokka-convention` alias(libs.plugins.kotlinx.binary.compatibility.validator) alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false jacoco @@ -34,7 +32,8 @@ val optinAnnotations = listOf( "kotlin.RequiresOptIn", ) -@OptIn(InternalApi::class) +private fun String.ensureSuffix(suffix: String): String = if (endsWith(suffix)) this else plus(suffix) + val hllPreviewVersion = if (sdkVersion.contains("-SNAPSHOT")) { // e.g. 1.3.29-beta-SNAPSHOT sdkVersion .removeSuffix("-SNAPSHOT") @@ -56,7 +55,6 @@ subprojects { apply { plugin("org.jetbrains.kotlin.multiplatform") - plugin("org.jetbrains.dokka") plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId) } @@ -85,10 +83,6 @@ subprojects { } } - dependencies { - dokkaPlugin(project(":dokka-aws")) - } - tasks.withType { compilerOptions { jvmTarget.set(JvmTarget.JVM_1_8) @@ -113,3 +107,11 @@ apiValidation { "dynamodb-mapper-schema-generator-plugin-test", ).filter { it in availableSubprojects } // Some projects may not be in the build depending on bootstrapping } + +// Configure Dokka for subprojects +dependencies { + subprojects.forEach { + it.plugins.apply("dokka-convention") // Apply the Dokka conventions plugin to the subproject + dokka(project(it.path)) // Aggregate the subproject's generated documentation + } +} diff --git a/hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts b/hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts index 9f9b36de346..98fc9adfc18 100644 --- a/hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts +++ b/hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts @@ -8,7 +8,7 @@ extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Codegen extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.codegen" plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) `maven-publish` } diff --git a/hll/dynamodb-mapper/dynamodb-mapper-ops-codegen/build.gradle.kts b/hll/dynamodb-mapper/dynamodb-mapper-ops-codegen/build.gradle.kts index b9907e8c733..32160f166e1 100644 --- a/hll/dynamodb-mapper/dynamodb-mapper-ops-codegen/build.gradle.kts +++ b/hll/dynamodb-mapper/dynamodb-mapper-ops-codegen/build.gradle.kts @@ -8,7 +8,7 @@ extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Codegen extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.codegen.ops" plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) } dependencies { diff --git a/hll/dynamodb-mapper/dynamodb-mapper-schema-codegen/build.gradle.kts b/hll/dynamodb-mapper/dynamodb-mapper-schema-codegen/build.gradle.kts index 6f68b7979f1..b5a14e2a01e 100644 --- a/hll/dynamodb-mapper/dynamodb-mapper-schema-codegen/build.gradle.kts +++ b/hll/dynamodb-mapper/dynamodb-mapper-schema-codegen/build.gradle.kts @@ -8,7 +8,7 @@ extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Codegen extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.codegen.schema" plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) `maven-publish` } diff --git a/hll/dynamodb-mapper/dynamodb-mapper-schema-generator-plugin/build.gradle.kts b/hll/dynamodb-mapper/dynamodb-mapper-schema-generator-plugin/build.gradle.kts index e8ea582c245..74d16d4f439 100644 --- a/hll/dynamodb-mapper/dynamodb-mapper-schema-generator-plugin/build.gradle.kts +++ b/hll/dynamodb-mapper/dynamodb-mapper-schema-generator-plugin/build.gradle.kts @@ -1,5 +1,3 @@ -import aws.smithy.kotlin.runtime.InternalApi -import aws.smithy.kotlin.runtime.text.ensureSuffix import org.jetbrains.kotlin.gradle.tasks.KotlinCompile /* @@ -90,7 +88,8 @@ tasks.test { // FIXME Commonize the following functions into the aws-kotlin-repo-tools build-support val sdkVersion: String by project -@OptIn(InternalApi::class) +private fun String.ensureSuffix(suffix: String): String = if (endsWith(suffix)) this else plus(suffix) + val hllPreviewVersion = if (sdkVersion.contains("-SNAPSHOT")) { // e.g. 1.3.29-beta-SNAPSHOT sdkVersion .removeSuffix("-SNAPSHOT") diff --git a/hll/hll-codegen/build.gradle.kts b/hll/hll-codegen/build.gradle.kts index 853bef0cedc..12769452a1f 100644 --- a/hll/hll-codegen/build.gradle.kts +++ b/hll/hll-codegen/build.gradle.kts @@ -8,7 +8,7 @@ extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: Codegen" extra["moduleName"] = "aws.sdk.kotlin.hll.codegen" plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) `maven-publish` } diff --git a/services/build.gradle.kts b/services/build.gradle.kts index 601ddf52a5e..2342415d9da 100644 --- a/services/build.gradle.kts +++ b/services/build.gradle.kts @@ -10,7 +10,7 @@ import java.time.LocalDateTime plugins { `maven-publish` - alias(libs.plugins.dokka) + `dokka-convention` alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false } @@ -31,7 +31,6 @@ subprojects { apply { plugin("org.jetbrains.kotlin.multiplatform") - plugin("org.jetbrains.dokka") plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId) } @@ -128,10 +127,6 @@ subprojects { } } - dependencies { - dokkaPlugin(project(":dokka-aws")) - } - tasks.withType { compilerOptions { allWarningsAsErrors.set(false) // FIXME Tons of errors occur in generated code @@ -150,3 +145,11 @@ subprojects { } } } + +// Configure Dokka for subprojects +dependencies { + subprojects.forEach { + it.plugins.apply("dokka-convention") // Apply the Dokka conventions plugin to the subproject + dokka(project(it.path)) // Aggregate the subproject's generated documentation + } +} diff --git a/tests/codegen/build.gradle.kts b/tests/codegen/build.gradle.kts index 1b6c585df92..efafab7226d 100644 --- a/tests/codegen/build.gradle.kts +++ b/tests/codegen/build.gradle.kts @@ -2,7 +2,7 @@ import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections plugins { alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) } val libraries = libs @@ -38,7 +38,7 @@ subprojects { tasks.withType { dependsOn(tasks.generateSmithyProjections) - kotlinOptions.allWarningsAsErrors = false + compilerOptions.allWarningsAsErrors = false } tasks.generateSmithyProjections { diff --git a/tests/codegen/event-stream/build.gradle.kts b/tests/codegen/event-stream/build.gradle.kts index 7f19ecd15ab..b788640cb48 100644 --- a/tests/codegen/event-stream/build.gradle.kts +++ b/tests/codegen/event-stream/build.gradle.kts @@ -8,6 +8,11 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir import aws.sdk.kotlin.tests.codegen.CodegenTest import aws.sdk.kotlin.tests.codegen.Model +plugins { + id(libs.plugins.kotlin.jvm.get().pluginId) + alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) +} + description = "AWS SDK for Kotlin's event stream codegen test suite" val tests = listOf( diff --git a/tests/codegen/smoke-tests/build.gradle.kts b/tests/codegen/smoke-tests/build.gradle.kts index e6298681c91..127b7db5375 100644 --- a/tests/codegen/smoke-tests/build.gradle.kts +++ b/tests/codegen/smoke-tests/build.gradle.kts @@ -9,6 +9,13 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionPath import aws.sdk.kotlin.tests.codegen.CodegenTest import aws.sdk.kotlin.tests.codegen.Model +description = "Tests for smoke tests runners" + +plugins { + alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) + id(libs.plugins.kotlin.jvm.get().pluginId) +} + description = "AWS SDK for Kotlin's smoke test codegen test suite" dependencies { @@ -26,7 +33,7 @@ configureTasks() fun configureProjections() { smithyBuild { - this@Build_gradle.tests.forEach { test -> + tests.forEach { test -> projections.register(test.name) { imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath) smithyKotlinPlugin { @@ -51,7 +58,7 @@ fun configureTasks() { tasks.register("stageServices") { dependsOn(tasks.generateSmithyProjections) doLast { - this@Build_gradle.tests.forEach { test -> + tests.forEach { test -> val projectionPath = smithyBuild.smithyKotlinProjectionPath(test.name).get() val destinationPath = layout.projectDirectory.asFile.absolutePath + "/services/${test.name}" @@ -79,7 +86,7 @@ fun configureTasks() { } tasks.clean { - this@Build_gradle.tests.forEach { test -> + tests.forEach { test -> delete("services/${test.name}") } } diff --git a/tests/codegen/smoke-tests/services/build.gradle.kts b/tests/codegen/smoke-tests/services/build.gradle.kts index a7a52c11934..b0fea9a9ea3 100644 --- a/tests/codegen/smoke-tests/services/build.gradle.kts +++ b/tests/codegen/smoke-tests/services/build.gradle.kts @@ -1,5 +1,9 @@ plugins { - alias(libs.plugins.kotlin.multiplatform) + id(libs.plugins.kotlin.multiplatform.get().pluginId) +} + +kotlin { + jvm() } val libraries = libs diff --git a/tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest/SmokeTestE2ETest.kt b/tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest/SmokeTestE2ETest.kt index b3521302b81..c7df89c0514 100644 --- a/tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest/SmokeTestE2ETest.kt +++ b/tests/codegen/smoke-tests/src/test/kotlin/aws/sdk/kotlin/test/codegen/smoketest/SmokeTestE2ETest.kt @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ -package aws.sdk.kotlin.tests.codegen.smoketests +package aws.sdk.kotlin.test.codegen.smoketest import aws.sdk.kotlin.codegen.smoketests.AWS_SERVICE_FILTER import aws.sdk.kotlin.codegen.smoketests.AWS_SKIP_TAGS diff --git a/tests/e2e-test-util/build.gradle.kts b/tests/e2e-test-util/build.gradle.kts index 4e476ce6af6..1eb4b220273 100644 --- a/tests/e2e-test-util/build.gradle.kts +++ b/tests/e2e-test-util/build.gradle.kts @@ -3,7 +3,7 @@ * SPDX-License-Identifier: Apache-2.0 */ plugins { - alias(libs.plugins.kotlin.jvm) + id(libs.plugins.kotlin.jvm.get().pluginId) } description = "Test utilities for integration and e2e tests"