-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: bootstrap API reference docs generation (#119)
- Loading branch information
Showing
19 changed files
with
314 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# AWS SDK for Kotlin API Reference |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
#logo { | ||
background-image: url('../images/aws_logo_white_59x35.png'); | ||
background-color: #232f3e; | ||
color: #333; | ||
background-size: 59px 35px; | ||
} | ||
|
||
body { | ||
background-color: #f2f3f3; | ||
} | ||
|
||
/* | ||
* override markdown samples which appear to have broken and/or minimal style | ||
*/ | ||
.sample-container { | ||
padding: 16px; | ||
border-radius: 6px; | ||
background-color: rgb(280, 280, 280); | ||
margin: 12px 0 12px 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
plugins { | ||
kotlin("jvm") | ||
} | ||
|
||
description = "Custom Dokka plugin for AWS Kotlin SDK API docs" | ||
|
||
dependencies { | ||
val dokkaVersion: String by project | ||
compileOnly("org.jetbrains.dokka:dokka-base:$dokkaVersion") | ||
compileOnly("org.jetbrains.dokka:dokka-core:$dokkaVersion") | ||
} | ||
|
||
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> { | ||
kotlinOptions.jvmTarget = "1.8" | ||
} |
25 changes: 25 additions & 0 deletions
25
dokka-aws/src/main/kotlin/aws/sdk/kotlin/dokka/AwsDokkaPlugin.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package aws.sdk.kotlin.dokka | ||
|
||
import aws.sdk.kotlin.dokka.transformers.FilterInternalApis | ||
import org.jetbrains.dokka.base.DokkaBase | ||
import org.jetbrains.dokka.plugability.DokkaPlugin | ||
|
||
/** | ||
* Dokka plugin for customizing the AWS Kotlin SDK generated API docs | ||
*/ | ||
class AwsDokkaPlugin : DokkaPlugin() { | ||
init { | ||
println("AwsDokkaPlugin loaded!") | ||
} | ||
|
||
val dokkaBase by lazy { plugin<DokkaBase>() } | ||
|
||
val filterInternalApis by extending { | ||
dokkaBase.preMergeDocumentableTransformer providing ::FilterInternalApis | ||
} | ||
} |
42 changes: 42 additions & 0 deletions
42
dokka-aws/src/main/kotlin/aws/sdk/kotlin/dokka/transformers/FilterInternalApis.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* SPDX-License-Identifier: Apache-2.0. | ||
*/ | ||
|
||
package aws.sdk.kotlin.dokka.transformers | ||
|
||
import org.jetbrains.dokka.base.transformers.documentables.SuppressedByConditionDocumentableFilterTransformer | ||
import org.jetbrains.dokka.model.* | ||
import org.jetbrains.dokka.model.properties.WithExtraProperties | ||
import org.jetbrains.dokka.plugability.DokkaContext | ||
|
||
/** | ||
* Filters out anything annotated with `InternalSdkApi` | ||
*/ | ||
class FilterInternalApis(context: DokkaContext) : SuppressedByConditionDocumentableFilterTransformer(context) { | ||
override fun shouldBeSuppressed(d: Documentable): Boolean { | ||
val isInternal = when (d) { | ||
is DClass -> d.isInternalSdk() | ||
is DObject -> d.isInternalSdk() | ||
is DTypeAlias -> d.isInternalSdk() | ||
is DFunction -> d.isInternalSdk() | ||
is DProperty -> d.isInternalSdk() | ||
is DEnum -> d.isInternalSdk() | ||
is DEnumEntry -> d.isInternalSdk() | ||
is DTypeParameter -> d.isInternalSdk() | ||
else -> false | ||
} | ||
if (isInternal) println("suppressing ${d.dri}") | ||
return isInternal | ||
} | ||
} | ||
|
||
fun <T> T.isInternalSdk() where T : WithExtraProperties<out Documentable> = | ||
internalAnnotation != null | ||
|
||
val <T> T.internalAnnotation where T : WithExtraProperties<out Documentable> | ||
get() = extra[Annotations]?.let { annotations -> | ||
annotations.directAnnotations.values.flatten().firstOrNull { | ||
it.dri.toString() == "aws.sdk.kotlin.runtime/InternalSdkApi///PointingToDeclaration/" | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
dokka-aws/src/main/resources/META-INF/services/org.jetbrains.dokka.plugability.DokkaPlugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
aws.sdk.kotlin.dokka.AwsDokkaPlugin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.