Skip to content

Commit 970037e

Browse files
authored
feat(doc): SDK generation and build docs (#377)
1 parent 5d57469 commit 970037e

File tree

2 files changed

+82
-2
lines changed

2 files changed

+82
-2
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ This repo contains the AWS SDK for Kotlin and its [public roadmap](https://githu
1414

1515
## Getting Started
1616

17-
See the [Getting Started Guide](docs/GettingStarted.md)
17+
See the [Getting Started Guide](docs/GettingStarted.md) to learn how to use AWS SDKs in your program.
1818

1919
## Feedback
2020

@@ -33,7 +33,8 @@ If you are interested in contributing to the AWS SDK for Kotlin, please take a l
3333
### Generate SDK(s)
3434

3535
Generated sources are not checked into the repository, you first have to generate the clients before you can build them.
36-
36+
A [step-by-step guide](docs/generate-sdk.md) is available that demonstrates building the AWS DynamoDB service, or if
37+
you have a good working knowledge of Gradle, see below:
3738

3839
```sh
3940
./gradlew --no-daemon :codegen:sdk:bootstrap

docs/generate-sdk.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Generate an AWS SDK
2+
3+
This page describes how to generate and build an AWS SDK. Generating an SDK from source may be useful in testing fixes,
4+
learning how AWS SDKs work internally, or just experimentation.
5+
6+
### NOTE
7+
8+
This process is not necessary to use an AWS SDK, as one can simply depend on the artifacts available in
9+
[Maven Central](https://search.maven.org/search?q=aws.sdk.kotlin). See the [getting started guide](GettingStarted.md) for details.
10+
11+
## Prerequisites
12+
* Git
13+
* Java JDK 1.8+
14+
15+
## Generate an SDK
16+
17+
In this example we'll build the AWS DynamoDB SDK.
18+
19+
### Clone this repo
20+
```sh
21+
git clone https://github.com/awslabs/aws-sdk-kotlin.git
22+
cd aws-sdk-kotlin
23+
```
24+
25+
### Generate the SDK source
26+
27+
Generate the DynamoDB SDK:
28+
```sh
29+
./gradlew -Paws.services=+dynamodb :codegen:sdk:bootstrap
30+
```
31+
Notice we specify the name of the service as `dynamodb`. The names for all AWS services can be found in
32+
[`codegen/sdk/aws-models`](../codegen/sdk/aws-models).
33+
. So for example the name used for AWS CloudFormation's model `cloudformation.2010-05-15.json`
34+
would be `cloudformation`. The date and json extension are removed.
35+
36+
### Compile and test the generated SDK
37+
```sh
38+
./gradlew :services:dynamodb:build
39+
```
40+
Once this completes a compiled SDK for the AWS DynamoDB service has been generated. The version will vary depending
41+
on whatever is the latest version in the repository.
42+
43+
```sh
44+
ls services/dynamodb/build/libs
45+
dynamodb-<version>.jar
46+
```
47+
48+
To use this compiled SDK from another program locally, the local Maven repository can be used. The following command
49+
will publish artifacts from `aws-sdk-kotlin` to the local maven repository, including the DynamoDB service and supporting
50+
runtime libraries:
51+
52+
```sh
53+
./gradlew publishToMavenLocal
54+
```
55+
56+
## Using a locally-built SDK
57+
58+
In order to use an SDK published to the local maven repository, the `mavenLocal()` repository must be added to the program's
59+
build file:
60+
61+
```
62+
repositories {
63+
mavenLocal()
64+
}
65+
```
66+
67+
And then simply add the dependency:
68+
69+
```
70+
dependencies {
71+
implementation("aws.sdk.kotlin:dynamodb:<version>")
72+
}
73+
```
74+
75+
## Summary
76+
77+
This page covers building an AWS SDK using the `aws-sdk-kotlin` SDK generator. If you experience problems please [file
78+
an issue](https://github.com/awslabs/aws-sdk-kotlin/issues). If you have questions or ideas about how we can improve our
79+
SDKs, please join [our discussions](https://github.com/awslabs/aws-sdk-kotlin/discussions).

0 commit comments

Comments
 (0)