Skip to content

Commit e14c101

Browse files
authored
docs: bootstrap API reference docs generation (#119)
1 parent 9eb0b14 commit e14c101

File tree

19 files changed

+314
-22
lines changed

19 files changed

+314
-22
lines changed

CHANGELOG.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
## [Unreleased]
44

5+
## [0.2.0-M1] - 05/07/2021
6+
7+
**WARNING: Beta releases may contain bugs and no guarantee is made about API stability. They are not recommended for production use!**
8+
9+
### Services new in this release
10+
11+
* S3
12+
* NOTE: S3 is a complicated service, this initial release **DOES NOT** have complete support for all S3 features.
13+
14+
## Changes
15+
16+
* (feat): add conversions to/from `java.time.Instant` and SDK `Instant` (https://github.com/awslabs/smithy-kotlin/issues/271)
17+
* (fix): generate per/service base exception types (https://github.com/awslabs/smithy-kotlin/issues/233)
18+
19+
520
## [0.1.0-M0] - 03/19/2021
621

722
**WARNING: Beta releases may contain bugs and no guarantee is made about API stability. They are not recommended for production use!**

README.md

Lines changed: 29 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ See the [Getting Started Guide](docs/GettingStarted.md)
1717
Generated sources are not checked into the repository, you first have to generate the clients before you can build them.
1818

1919

20-
```
20+
```sh
2121
./gradlew :codegen:sdk:bootstrap
2222
```
2323

@@ -28,7 +28,7 @@ NOTE: To re-run codegen for the same set of services multiple times add the `--r
2828
After generating the services you care about they are available to build:
2929

3030
e.g.
31-
```
31+
```sh
3232
./gradlew :services:lambda:build
3333
```
3434

@@ -37,6 +37,33 @@ Where the task follows the pattern: `:services:SERVICE:build`
3737

3838
To see list of all projects run `./gradlew projects`
3939

40+
##### Generating a single service
41+
See the local.properties definition above to specify this in a config file.
42+
43+
```sh
44+
./gradlew -Paws.services=lambda :codegen:sdk:bootstrap
45+
```
46+
47+
##### Testing Locally
48+
Testing generated services generally requires publishing artifacts (e.g. client-runtime) of `smithy-kotlin`, `aws-crt-kotlin`, and `aws-sdk-kotin` to maven local.
49+
50+
#### Generating API Documentation
51+
52+
API documentation is generated using [Dokka](http://kotlin.github.io/dokka) which is the official documentation tool maintained by JetBrains for documenting Kotlin code.
53+
54+
Unlike Java, Kotlin uses it's own [KDoc](https://kotlinlang.org/docs/kotlin-doc.html) format.
55+
56+
57+
To generate API reference documentation for the AWS Kotlin SDK:
58+
59+
60+
```sh
61+
./gradlew --no-daemon --no-parallel dokkaHtmlMultiModule
62+
```
63+
64+
This will output HTML formatted documentation to `build/dokka/htmlMultiModule`
65+
66+
NOTE: You currently need an HTTP server to view the documentation in browser locally. You can either use the builtin server in Intellij or use your favorite local server (e.g. `python3 -m http.server`). See [Kotlin/dokka#1795](https://github.com/Kotlin/dokka/issues/1795)
4067

4168
### Build properties
4269

@@ -55,12 +82,3 @@ aws.services=lambda
5582
```
5683

5784

58-
##### Generating a single service
59-
See the local.properties definition above to specify this in a config file.
60-
61-
```
62-
./gradlew -Paws.services=lambda :codegen:sdk:bootstrap
63-
```
64-
65-
##### Testing Locally
66-
Testing generated services generally requires publishing artifacts (e.g. client-runtime) of `smithy-kotlin`, `aws-crt-kotlin`, and `aws-sdk-kotin` to maven local.

build.gradle.kts

Lines changed: 60 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,73 @@
44
*/
55
plugins {
66
kotlin("jvm") version "1.4.31" apply false
7+
id("org.jetbrains.dokka")
8+
}
9+
10+
dependencies {
11+
dokkaPlugin(project(":dokka-aws"))
712
}
813

914
allprojects {
1015
repositories {
1116
mavenLocal()
1217
mavenCentral()
18+
// for dokka
19+
maven("https://maven.pkg.jetbrains.space/public/p/kotlinx-html/maven") {
20+
content {
21+
includeGroup("org.jetbrains.kotlinx")
22+
}
23+
}
24+
}
25+
26+
tasks.withType<org.jetbrains.dokka.gradle.DokkaTaskPartial>().configureEach {
27+
// each module can include their own top-level module documentation
28+
// see https://kotlinlang.org/docs/kotlin-doc.html#module-and-package-documentation
29+
if (project.file("API.md").exists()) {
30+
dokkaSourceSets.configureEach {
31+
includes.from(project.file("API.md"))
32+
}
33+
}
34+
}
35+
36+
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
37+
val sdkVersion: String by project
38+
moduleVersion.set(sdkVersion)
39+
40+
val year = java.time.LocalDate.now().year
41+
val pluginConfigMap = mapOf(
42+
"org.jetbrains.dokka.base.DokkaBase" to """
43+
{
44+
"customStyleSheets": ["${rootProject.file("docs/api/css/logo-styles.css")}"],
45+
"customAssets": [
46+
"${rootProject.file("docs/api/assets/logo-icon.svg")}",
47+
"${rootProject.file("docs/api/assets/aws_logo_white_59x35.png")}"
48+
],
49+
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved."
50+
}
51+
"""
52+
)
53+
pluginsMapConfiguration.set(pluginConfigMap)
1354
}
1455
}
1556

57+
// configure the root multimodule docs
58+
tasks.dokkaHtmlMultiModule {
59+
moduleName.set("AWS Kotlin SDK")
60+
61+
includes.from(
62+
// NOTE: these get concatenated
63+
rootProject.file("docs/api/README.md"),
64+
rootProject.file("docs/GettingStarted.md")
65+
)
66+
67+
val excludeFromDocumentation = listOf(
68+
project(":client-runtime:testing"),
69+
project(":client-runtime:crt-util")
70+
)
71+
removeChildTasks(excludeFromDocumentation)
72+
}
73+
1674
val ktlint: Configuration by configurations.creating
1775
val ktlintVersion: String by project
1876
dependencies {
@@ -22,7 +80,8 @@ dependencies {
2280
val lintPaths = listOf(
2381
"codegen/smithy-aws-kotlin-codegen/**/*.kt",
2482
"client-runtime/**/*.kt",
25-
"examples/**/*.kt"
83+
"examples/**/*.kt",
84+
"dokka-aws/**/*.kt"
2685
)
2786

2887
tasks.register<JavaExec>("ktlint") {

client-runtime/aws-client-rt/common/src/aws/sdk/kotlin/runtime/Annotations.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ package aws.sdk.kotlin.runtime
1212
* any strange effects.
1313
*
1414
* We strongly recommend to not use such API.
15-
*
15+
* @suppress
1616
*/
1717
@Suppress("DEPRECATION")
1818
@RequiresOptIn(

client-runtime/build.gradle.kts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ description = "AWS client runtime support for generated service clients"
77

88
plugins {
99
kotlin("multiplatform")
10-
id("org.jetbrains.dokka") version "1.4.20"
10+
id("org.jetbrains.dokka")
1111
jacoco
1212
}
1313

@@ -82,6 +82,10 @@ subprojects {
8282
}
8383

8484
apply(from = rootProject.file("gradle/publish.gradle"))
85+
86+
dependencies {
87+
dokkaPlugin(project(":dokka-aws"))
88+
}
8589
}
8690

8791
// FIXME - resolves build deadlock with aws-client-rt when using composite builds

docs/GettingStarted.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
# Beta Release Quickstart
1+
## Beta Release Quickstart
22

33
Beta releases of the AWS Kotlin SDK are published as a complete maven local repository with all associated dependencies.
44

55

6-
1. Download the [latest release](https://github.com/awslabs/aws-sdk-kotlin/releases) from Github
6+
1. Download the [latest release](https://github.com/awslabs/aws-sdk-kotlin/releases) from GitHub
77

88
2. Unzip the repository somewhere on your local machine
99

1010
```sh
11-
> unzip aws-sdk-kotlin-0.1.0-M0.zip
11+
> unzip aws-sdk-kotlin-0.2.0-M1.zip
1212
```
1313

1414
There should be a folder named `aws-sdk-kotlin-repo`
@@ -49,11 +49,9 @@ repositories {
4949

5050
4. Add services to your project
5151

52-
Services available for testing: `cognitoidentityprovider`, `dynamodb`, `kms`, `lambda`, `polly`, `secretsmanager`, `translate`
53-
5452
```kt
5553

56-
val awsKotlinSdkVersion = "0.1.0-M0"
54+
val awsKotlinSdkVersion = "0.2.0-M1"
5755
// OR put it in gradle.properties
5856
// val awsKotlinSdkVersion: String by project
5957

@@ -62,8 +60,6 @@ dependencies {
6260
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.3")
6361

6462
// The following line adds a dependency on the dynamodb client.
65-
// Services available in the M0 release:
66-
// cognitoidentityprovider, dynamodb, kms, lambda, polly, secretsmanager, translate
6763
implementation("aws.sdk.kotlin:dynamodb:$awsKotlinSdkVersion")
6864

6965
// The following will cause SDK logs to emit to the console:

docs/api/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# AWS SDK for Kotlin API Reference
2.22 KB
Loading

docs/api/assets/favicon.ico

1.12 KB
Binary file not shown.

docs/api/assets/logo-icon.svg

Lines changed: 15 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)