Skip to content

Commit af7e5c5

Browse files
authored
misc: upgrade to Dokka 2.0.0 (#1284)
1 parent da208cd commit af7e5c5

File tree

27 files changed

+262
-335
lines changed

27 files changed

+262
-335
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"id": "50a9ce20-c4d7-4952-8fad-f9ffb38c9259",
3+
"type": "misc",
4+
"description": "Upgrade to Dokka 2.0.0"
5+
}

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ ktlint_standard_backing-property-naming = disabled
99
# enable trailing commas per JetBrains recommendation
1010
# (https://kotlinlang.org/docs/coding-conventions.html#trailing-commas)
1111
ij_kotlin_allow_trailing_comma_on_call_site = true
12-
ij_kotlin_allow_trailing_comma = true
12+
ij_kotlin_allow_trailing_comma = true

build.gradle.kts

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ buildscript {
1818
}
1919

2020
plugins {
21-
alias(libs.plugins.dokka)
21+
`dokka-convention`
2222
alias(libs.plugins.kotlinx.binary.compatibility.validator)
23+
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
2324
// ensure the correct version of KGP ends up on our buildscript classpath
2425
// since build-plugins also has <some> version in its dependency closure
25-
alias(libs.plugins.kotlin.multiplatform) apply false
26-
alias(libs.plugins.kotlin.jvm) apply false
27-
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
26+
id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false
27+
id(libs.plugins.kotlin.jvm.get().pluginId) apply false
2828
}
2929

3030
artifactSizeMetrics {
@@ -40,35 +40,9 @@ val testJavaVersion = typedProp<String>("test.java.version")?.let {
4040
}
4141

4242
allprojects {
43-
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
44-
val sdkVersion: String by project
45-
moduleVersion.set(sdkVersion)
46-
47-
val year = java.time.LocalDate.now().year
48-
val pluginConfigMap = mapOf(
49-
"org.jetbrains.dokka.base.DokkaBase" to """
50-
{
51-
"customStyleSheets": [
52-
"${rootProject.file("docs/dokka-presets/css/logo-styles.css")}",
53-
"${rootProject.file("docs/dokka-presets/css/aws-styles.css")}"
54-
],
55-
"customAssets": [
56-
"${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}",
57-
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}",
58-
"${rootProject.file("docs/dokka-presets/scripts/accessibility.js")}"
59-
],
60-
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
61-
"separateInheritedMembers" : true,
62-
"templatesDir": "${rootProject.file("docs/dokka-presets/templates")}"
63-
}
64-
""",
65-
)
66-
pluginsMapConfiguration.set(pluginConfigMap)
67-
}
68-
6943
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
7044
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
71-
kotlinOptions.allWarningsAsErrors = true
45+
compilerOptions.allWarningsAsErrors = true
7246
}
7347
}
7448

@@ -90,27 +64,18 @@ allprojects {
9064
}
9165

9266
// configure the root multimodule docs
93-
tasks.dokkaHtmlMultiModule.configure {
67+
dokka {
9468
moduleName.set("Smithy Kotlin")
9569

96-
// Output subprojects' docs to <docs-base>/project-name/* instead of <docs-base>/path/to/project-name/*
97-
// This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the
98-
// package-list doesn't contain enough project path information to indicate where modules' documentation are
99-
// located.
100-
fileLayout.set { parent, child ->
101-
parent.outputDirectory.dir(child.moduleName)
70+
dokkaPublications.html {
71+
includes.from(
72+
rootProject.file("docs/dokka-presets/README.md"),
73+
)
10274
}
75+
}
10376

104-
includes.from(
105-
// NOTE: these get concatenated
106-
rootProject.file("docs/dokka-presets/README.md"),
107-
)
108-
109-
val excludeFromDocumentation = listOf(
110-
project(":runtime:testing"),
111-
project(":runtime:smithy-test"),
112-
)
113-
removeChildTasks(excludeFromDocumentation)
77+
dependencies {
78+
dokka(project(":runtime"))
11479
}
11580

11681
// Publishing
@@ -121,6 +86,7 @@ val lintPaths = listOf(
12186
"**/*.{kt,kts}",
12287
"!**/generated-src/**",
12388
"!**/smithyprojections/**",
89+
"!**/build/**",
12490
)
12591

12692
configureLinting(lintPaths)

buildSrc/build.gradle.kts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
plugins {
2+
`kotlin-dsl`
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
gradlePluginPortal()
8+
}
9+
10+
dependencies {
11+
implementation(libs.dokka.gradle.plugin)
12+
implementation(libs.kotlin.gradle.plugin)
13+
}

buildSrc/settings.gradle.kts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
rootProject.name = "buildSrc"
2+
3+
dependencyResolutionManagement {
4+
versionCatalogs {
5+
create("libs") {
6+
from(files("../gradle/libs.versions.toml"))
7+
}
8+
}
9+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import kotlin.text.set
2+
3+
plugins {
4+
id("org.jetbrains.dokka")
5+
}
6+
7+
dokka {
8+
val sdkVersion: String by project
9+
moduleVersion.set(sdkVersion)
10+
11+
pluginsConfiguration.html {
12+
customStyleSheets.from(
13+
rootProject.file("docs/dokka-presets/css/aws-styles.css"),
14+
)
15+
16+
customAssets.from(
17+
rootProject.file("docs/dokka-presets/assets/logo-icon.svg"),
18+
rootProject.file("docs/dokka-presets/scripts/accessibility.js"),
19+
)
20+
21+
templatesDir.set(rootProject.file("docs/dokka-presets/templates"))
22+
23+
footerMessage.set("© ${java.time.LocalDate.now().year}, Amazon Web Services, Inc. or its affiliates. All rights reserved.")
24+
separateInheritedMembers.set(true)
25+
}
26+
}
27+
28+
dependencies {
29+
dokkaPlugin(project(":dokka-smithy"))
30+
}

codegen/smithy-aws-kotlin-codegen/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
88

99
plugins {
10-
alias(libs.plugins.kotlin.jvm)
10+
id(libs.plugins.kotlin.jvm.get().pluginId)
1111
jacoco
1212
`maven-publish`
1313
}

codegen/smithy-kotlin-codegen-testutils/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
88

99
plugins {
10-
alias(libs.plugins.kotlin.jvm)
10+
id(libs.plugins.kotlin.jvm.get().pluginId)
1111
jacoco
1212
`maven-publish`
1313
}

codegen/smithy-kotlin-codegen/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.JvmTarget
77
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
88

99
plugins {
10-
alias(libs.plugins.kotlin.jvm)
10+
id(libs.plugins.kotlin.jvm.get().pluginId)
1111
jacoco
1212
`maven-publish`
1313
}
Binary file not shown.
Lines changed: 1 addition & 15 deletions
Loading

docs/dokka-presets/css/aws-styles.css

Lines changed: 46 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -4,45 +4,29 @@
44
*/
55

66
:root {
7-
--aws-color-dark: #232f3e;
8-
--horizontal-spacing-for-content: 16px;
9-
--default-font-family: JetBrains Sans, Inter, system-ui, -apple-system, BlinkMacSystemFont, Segoe UI,Roboto, Oxygen, Ubuntu,Cantarell, Droid Sans, Helvetica Neue, Arial, sans-serif;
7+
--color-background-nav: #232f3e;
8+
--dokka-logo-height: 60px;
9+
--dokka-logo-width: 90px;
1010
}
1111

12-
.menu-toggle {
13-
background: none;
14-
}
15-
16-
.menu-toggle:focus {
17-
outline: 2px solid #fff; /* White outline */
18-
outline-offset: 2px; /* Space between the outline and the button */
19-
}
20-
21-
#pages-search:focus {
22-
outline: revert;
23-
}
24-
25-
/* copied from Dokka except for background-color attribute */
26-
.navigation {
27-
display: flex;
28-
justify-content: space-between;
29-
30-
color: #fff;
31-
background-color: var(--aws-color-dark);
32-
font-family: var(--default-font-family);
33-
letter-spacing: -0.1px;
34-
35-
/* Reset margin and use padding for border */
36-
margin-left: 0;
37-
margin-right: 0;
38-
padding: 10px var(--horizontal-spacing-for-content);
39-
40-
z-index: 4;
12+
.skip-to-content {
13+
position: absolute; /* Remove from normal flow */
14+
top: 0; /* Position off-screen */
15+
left: 0;
16+
width: 1px;
17+
height: 1px;
18+
overflow: hidden;
19+
opacity: 0;
20+
z-index: -1; /* Ensure it's not visible */
4121
}
4222

43-
/* Styles for section tabs like "Types" and "Functions" */
44-
.section-tab:focus, .section-tab:active {
45-
outline: 2px solid var(--active-tab-border-color); /* The color appears unresolved, but it is defined in Dokka style sheets */
23+
.skip-to-content:focus,
24+
.skip-to-content:active {
25+
position: static; /* Restore to normal flow when focused */
26+
width: auto;
27+
height: auto;
28+
opacity: 1;
29+
z-index: 999; /* Ensure it's on top */
4630
}
4731

4832
/*
@@ -55,44 +39,45 @@
5539
.symbol {
5640
overflow-wrap: break-word;
5741
}
58-
5942
.keyValue {
6043
display: block;
6144
}
6245

63-
/*
64-
Disable the playground run button for generated samples
65-
https://github.com/Kotlin/dokka/issues/3041
66-
*/
67-
div .compiler-info, .fold-button, .run-button {
68-
display: none;
46+
/* FIXME Taken from Dokka mainline. Remove these styles once Dokka 2.1.0 is released. */
47+
.toc--skip-link {
48+
background-color: #458cff;
49+
color: #fff;
50+
font: 400 13px/24px Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, sans-serif, BlinkMacSystemFont, Oxygen, Droid Sans, Helvetica Neue, Arial;
51+
margin-top: 36px;
52+
padding: 1px;
53+
position: absolute;
54+
z-index: 100;
6955
}
7056

71-
.skip-to-content {
72-
width: 1px;
73-
height: 1px;
74-
overflow: hidden;
75-
opacity: 0;
57+
.toc--skip-link:not(:focus) {
58+
overflow: hidden !important;
59+
clip: rect(1px, 1px, 1px, 1px) !important;
60+
border: 0 !important;
61+
height: 1px !important;
62+
padding: 0 !important;
63+
width: 1px !important;
7664
}
7765

78-
.skip-to-content:focus,
79-
.skip-to-content:active {
80-
width: auto;
81-
height: auto;
82-
opacity: 1;
83-
z-index: 999; /* Ensure the skip link is on top of other content */
66+
.toc--skip-link:focus {
67+
outline: 4px solid rgb(48, 127, 255, 0.5);
68+
outline-offset: 0;
69+
}
70+
71+
.sidebar > .toc--skip-link {
72+
margin-top: 0;
8473
}
8574

86-
.aws-toggle-content-btn {
87-
font-size: 24px;
88-
background: none;
89-
border: none;
90-
cursor: pointer;
91-
padding: 8px;
75+
.toc--part_hidden > .toc--row > .toc--button ~ .toc--skip-link {
76+
display: none;
9277
}
9378

94-
@media (max-width: 550px) {
95-
.content[data-togglable] {
79+
@media (max-width: 899px) {
80+
.toc--skip-link {
9681
display: none;
9782
}
9883
}

docs/dokka-presets/css/logo-styles.css

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)