Skip to content

Commit b2f1c0a

Browse files
authored
feat: project setup and upload file (#1712)
1 parent 0e2c471 commit b2f1c0a

File tree

36 files changed

+2462
-0
lines changed

36 files changed

+2462
-0
lines changed

aws-runtime/aws-http/api/aws-http.api

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ public final class aws/sdk/kotlin/runtime/http/interceptors/IgnoreCompositeFlexi
171171
public final class aws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric : java/lang/Enum, aws/smithy/kotlin/runtime/businessmetrics/BusinessMetric {
172172
public static final field DDB_MAPPER Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
173173
public static final field S3_EXPRESS_BUCKET Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
174+
public static final field S3_TRANSFER Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
175+
public static final field S3_TRANSFER_DOWNLOAD_DIRECTORY Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
176+
public static final field S3_TRANSFER_UPLOAD_DIRECTORY Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
174177
public static fun getEntries ()Lkotlin/enums/EnumEntries;
175178
public fun getIdentifier ()Ljava/lang/String;
176179
public fun toString ()Ljava/lang/String;

aws-runtime/aws-http/common/src/aws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetricsUtils.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,9 @@ internal fun formatMetrics(metrics: MutableSet<BusinessMetric>, logger: Logger):
6262
public enum class AwsBusinessMetric(public override val identifier: String) : BusinessMetric {
6363
S3_EXPRESS_BUCKET("J"),
6464
DDB_MAPPER("d"),
65+
S3_TRANSFER("G"),
66+
S3_TRANSFER_UPLOAD_DIRECTORY("9"),
67+
S3_TRANSFER_DOWNLOAD_DIRECTORY("+"),
6568
;
6669

6770
@InternalApi

hll/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ val projectsToIgnore = listOf(
112112
"dynamodb-mapper-ops-codegen",
113113
"dynamodb-mapper-schema-codegen",
114114
"dynamodb-mapper-schema-generator-plugin-test",
115+
116+
"s3-transfer-manager-codegen",
115117
).filter { it in subprojects.map { it.name }.toSet() } // Some projects may not be in the build depending on bootstrapping
116118

117119
apiValidation {

hll/hll-codegen/build.gradle.kts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import org.gradle.kotlin.dsl.withType
7+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
8+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
9+
110
/*
211
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
312
* SPDX-License-Identifier: Apache-2.0
@@ -48,3 +57,14 @@ publishing {
4857
}
4958
}
5059
}
60+
61+
java {
62+
sourceCompatibility = JavaVersion.VERSION_1_8
63+
targetCompatibility = JavaVersion.VERSION_1_8
64+
}
65+
66+
tasks.withType<KotlinCompile> {
67+
compilerOptions {
68+
jvmTarget.set(JvmTarget.JVM_1_8)
69+
}
70+
}

hll/hll-codegen/src/main/kotlin/aws/sdk/kotlin/hll/codegen/model/Member.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public data class Member(
2323
val type: Type,
2424
val mutable: Boolean = false,
2525
val attributes: Attributes = emptyAttributes(),
26+
val kDocs: String? = null,
2627
) {
2728
@InternalSdkApi
2829
public companion object {
@@ -34,6 +35,7 @@ public data class Member(
3435
name = prop.simpleName.getShortName(),
3536
type = Type.from(prop.type),
3637
mutable = prop.isMutable,
38+
kDocs = prop.docString,
3739
)
3840

3941
return ModelParsingPlugin.transform(member, ModelParsingPlugin::postProcessMember)
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
import org.gradle.kotlin.dsl.withType
7+
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
8+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
9+
10+
val sdkVersion: String by project
11+
version = sdkVersion
12+
13+
description = "S3 Transfer Manager Code Generation"
14+
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: S3 Transfer Manager Codegen"
15+
extra["moduleName"] = "aws.sdk.kotlin.hll.s3transfermanager.codegen"
16+
17+
plugins {
18+
id(libs.plugins.kotlin.jvm.get().pluginId)
19+
}
20+
21+
dependencies {
22+
implementation(libs.ksp.api)
23+
implementation(project(":hll:hll-codegen"))
24+
implementation(project(":services:s3"))
25+
}
26+
27+
kotlin {
28+
explicitApi()
29+
sourceSets.all {
30+
listOf(
31+
"aws.smithy.kotlin.runtime.InternalApi",
32+
"aws.sdk.kotlin.runtime.InternalSdkApi",
33+
"kotlin.RequiresOptIn",
34+
).forEach(languageSettings::optIn)
35+
}
36+
}
37+
38+
tasks.withType<KotlinCompile> {
39+
compilerOptions {
40+
jvmTarget.set(JvmTarget.JVM_1_8)
41+
freeCompilerArgs.add("-Xjdk-release=1.8")
42+
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
43+
}
44+
}
45+
46+
java {
47+
sourceCompatibility = JavaVersion.VERSION_1_8
48+
targetCompatibility = JavaVersion.VERSION_1_8
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package aws.sdk.kotlin.hll.s3transfermanager.codegen
7+
8+
import aws.sdk.kotlin.hll.codegen.core.CodeGeneratorFactory
9+
import aws.sdk.kotlin.hll.codegen.ksp.processors.HllKspProcessor
10+
import aws.sdk.kotlin.hll.codegen.rendering.RenderContext
11+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.conversionMappings
12+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.ioMappings
13+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.renderers.ConversionRenderer
14+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.renderers.IoRenderer
15+
import com.google.devtools.ksp.processing.Resolver
16+
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
17+
import com.google.devtools.ksp.symbol.KSAnnotated
18+
19+
internal class S3TransferManagerSymbolProcessor(environment: SymbolProcessorEnvironment) : HllKspProcessor(environment) {
20+
val rendererName = "s3-transfer-manager-code-generator"
21+
val codeGenerator = environment.codeGenerator
22+
val logger = environment.logger
23+
24+
override fun processImpl(resolver: Resolver): List<KSAnnotated> {
25+
val ioMappingsContext =
26+
RenderContext(
27+
logger,
28+
CodeGeneratorFactory(codeGenerator, logger),
29+
"aws.sdk.kotlin.hll.s3transfermanager.model",
30+
rendererName,
31+
)
32+
33+
ioMappings.forEach { mapping ->
34+
IoRenderer(
35+
ioMappingsContext,
36+
mapping.className,
37+
mapping,
38+
resolver,
39+
).render()
40+
}
41+
42+
val conversionMappingsContext =
43+
RenderContext(
44+
logger,
45+
CodeGeneratorFactory(codeGenerator, logger),
46+
"aws.sdk.kotlin.hll.s3transfermanager.model.utils",
47+
rendererName,
48+
)
49+
50+
ConversionRenderer(
51+
conversionMappingsContext,
52+
"Converters",
53+
conversionMappings,
54+
resolver,
55+
).render()
56+
57+
return listOf()
58+
}
59+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package aws.sdk.kotlin.hll.s3transfermanager.codegen
7+
8+
import com.google.devtools.ksp.processing.SymbolProcessor
9+
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
10+
import com.google.devtools.ksp.processing.SymbolProcessorProvider
11+
12+
public class S3TransferManagerSymbolProcessorProvider : SymbolProcessorProvider {
13+
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor =
14+
S3TransferManagerSymbolProcessor(environment)
15+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings
7+
8+
import aws.sdk.kotlin.hll.codegen.model.TypeRef
9+
10+
/**
11+
* Converts one type to another
12+
*/
13+
internal data class ConversionMapping(
14+
val source: TypeRef,
15+
val destination: TypeRef,
16+
val members: Set<String>,
17+
val additionalImports: List<TypeRef> = emptyList(),
18+
val additionalParameters: List<String> = emptyList(),
19+
val additionalLogic: String = "",
20+
)
21+
22+
/**
23+
* High level S3 TM request/response from low level S3 operation members
24+
*/
25+
internal data class IoMapping(
26+
val type: MappingType,
27+
val className: String,
28+
val sourceOperation: String,
29+
val members: Set<String>,
30+
)
31+
32+
internal enum class MappingType {
33+
/**
34+
* Maps high level operation request members to low level request members
35+
*/
36+
REQUEST,
37+
38+
/**
39+
* Maps high level operation response members to low level response members
40+
*/
41+
RESPONSE,
42+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
* SPDX-License-Identifier: Apache-2.0
4+
*/
5+
6+
package aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings
7+
8+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.uploadObject.uploadObjectConversions
9+
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.uploadObject.uploadObjectIoMappings
10+
11+
internal val ioMappings = uploadObjectIoMappings
12+
internal val conversionMappings = uploadObjectConversions

0 commit comments

Comments
 (0)