Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions aws-runtime/aws-http/api/aws-http.api
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ public final class aws/sdk/kotlin/runtime/http/interceptors/IgnoreCompositeFlexi
public final class aws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric : java/lang/Enum, aws/smithy/kotlin/runtime/businessmetrics/BusinessMetric {
public static final field DDB_MAPPER Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
public static final field S3_EXPRESS_BUCKET Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
public static final field S3_TRANSFER Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
public static final field S3_TRANSFER_DOWNLOAD_DIRECTORY Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
public static final field S3_TRANSFER_UPLOAD_DIRECTORY Laws/sdk/kotlin/runtime/http/interceptors/businessmetrics/AwsBusinessMetric;
public static fun getEntries ()Lkotlin/enums/EnumEntries;
public fun getIdentifier ()Ljava/lang/String;
public fun toString ()Ljava/lang/String;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,9 @@ internal fun formatMetrics(metrics: MutableSet<BusinessMetric>, logger: Logger):
public enum class AwsBusinessMetric(public override val identifier: String) : BusinessMetric {
S3_EXPRESS_BUCKET("J"),
DDB_MAPPER("d"),
S3_TRANSFER("G"),
S3_TRANSFER_UPLOAD_DIRECTORY("9"),
S3_TRANSFER_DOWNLOAD_DIRECTORY("+"),
;

@InternalApi
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ smithy-kotlin-telemetry-provider-micrometer = { module = "aws.smithy.kotlin:tele
smithy-kotlin-telemetry-provider-otel = { module = "aws.smithy.kotlin:telemetry-provider-otel", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-test-suite = { module = "aws.smithy.kotlin:test-suite", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-testing = { module = "aws.smithy.kotlin:testing", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-http-test-jvm = { module = "aws.smithy.kotlin:http-test-jvm", version.ref = "smithy-kotlin-runtime-version" }
smithy-kotlin-testing-jvm = { module = "aws.smithy.kotlin:testing-jvm", version.ref = "smithy-kotlin-runtime-version" }
Comment on lines +95 to +96
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why are we explicitly depending on JVM target packages? Generally we rely on the common KMP packages (e.g., http-test, testing) because Gradle's Kotlin plugin is supposed to handle target resolution.


smithy-kotlin-codegen = { module = "software.amazon.smithy.kotlin:smithy-kotlin-codegen", version.ref = "smithy-kotlin-codegen-version" }
smithy-kotlin-codegen-testutils = { module = "software.amazon.smithy.kotlin:smithy-kotlin-codegen-testutils", version.ref = "smithy-kotlin-codegen-version" }
Expand Down
2 changes: 2 additions & 0 deletions hll/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,8 @@ val projectsToIgnore = listOf(
"dynamodb-mapper-ops-codegen",
"dynamodb-mapper-schema-codegen",
"dynamodb-mapper-schema-generator-plugin-test",

"s3-transfer-manager-codegen", // TODO: Disable publishing ?
Comment on lines +115 to +116
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: 👍 Yes, this is in the right place. We don't want to publish this since we have no use case for it right now. We can scratch the TODO.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't disable publication right? Just API validation and docgen

).filter { it in subprojects.map { it.name }.toSet() } // Some projects may not be in the build depending on bootstrapping

apiValidation {
Expand Down
20 changes: 20 additions & 0 deletions hll/hll-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
Expand Down Expand Up @@ -48,3 +57,14 @@ publishing {
}
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
}
}
Comment on lines +60 to +70
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why are these additions necessary?

Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public data class Member(
val type: Type,
val mutable: Boolean = false,
val attributes: Attributes = emptyAttributes(),
val kDocs: String? = null,
) {
@InternalSdkApi
Comment on lines 24 to 28
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment: Great job adding KDocs support. Makes it easier for me to fix #1595!

public companion object {
Expand All @@ -34,6 +35,7 @@ public data class Member(
name = prop.simpleName.getShortName(),
type = Type.from(prop.type),
mutable = prop.isMutable,
kDocs = prop.docString,
)

return ModelParsingPlugin.transform(member, ModelParsingPlugin::postProcessMember)
Expand Down
49 changes: 49 additions & 0 deletions hll/s3-transfer-manager-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

val sdkVersion: String by project
version = sdkVersion

description = "S3 Transfer Manager Code Generation"
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: S3 Transfer Manager Codegen"
extra["moduleName"] = "aws.sdk.kotlin.hll.s3transfermanager.codegen"

plugins {
id(libs.plugins.kotlin.jvm.get().pluginId)
}

dependencies {
implementation(libs.ksp.api)
implementation(project(":hll:hll-codegen"))
implementation(project(":services:s3"))
}

kotlin {
explicitApi()
sourceSets.all {
listOf(
"aws.smithy.kotlin.runtime.InternalApi",
"aws.sdk.kotlin.runtime.InternalSdkApi",
"kotlin.RequiresOptIn",
).forEach(languageSettings::optIn)
}
}

tasks.withType<KotlinCompile> {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_1_8)
freeCompilerArgs.add("-Xjdk-release=1.8")
freeCompilerArgs.add("-opt-in=kotlin.RequiresOptIn")
}
}

java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package aws.sdk.kotlin.hll.s3transfermanager.codegen

import aws.sdk.kotlin.hll.codegen.core.CodeGeneratorFactory
import aws.sdk.kotlin.hll.codegen.ksp.processors.HllKspProcessor
import aws.sdk.kotlin.hll.codegen.rendering.RenderContext
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.conversionMappings
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.ioMappings
import aws.sdk.kotlin.hll.s3transfermanager.codegen.renderers.ConversionRenderer
import aws.sdk.kotlin.hll.s3transfermanager.codegen.renderers.IoRenderer
import com.google.devtools.ksp.processing.Resolver
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.symbol.KSAnnotated

internal class S3TransferManagerSymbolProcessor(environment: SymbolProcessorEnvironment) : HllKspProcessor(environment) {
val rendererName = "s3-transfer-manager-code-generator"
val codeGenerator = environment.codeGenerator
val logger = environment.logger

override fun processImpl(resolver: Resolver): List<KSAnnotated> {
val ioMappingsContext =
RenderContext(
logger,
CodeGeneratorFactory(codeGenerator, logger),
"aws.sdk.kotlin.hll.s3transfermanager.model",
rendererName,
)

ioMappings.forEach { mapping ->
IoRenderer(
ioMappingsContext,
mapping.className,
mapping,
resolver,
).render()
}

val conversionMappingsContext =
RenderContext(
logger,
CodeGeneratorFactory(codeGenerator, logger),
"aws.sdk.kotlin.hll.s3transfermanager.model.utils",
rendererName,
)

ConversionRenderer(
conversionMappingsContext,
"Converters",
conversionMappings,
resolver,
).render()

return listOf()
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package aws.sdk.kotlin.hll.s3transfermanager.codegen

import com.google.devtools.ksp.processing.SymbolProcessor
import com.google.devtools.ksp.processing.SymbolProcessorEnvironment
import com.google.devtools.ksp.processing.SymbolProcessorProvider

public class S3TransferManagerSymbolProcessorProvider : SymbolProcessorProvider {
override fun create(environment: SymbolProcessorEnvironment): SymbolProcessor =
S3TransferManagerSymbolProcessor(environment)
}
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.hll.s3transfermanager.codegen.mappings

import aws.sdk.kotlin.hll.codegen.model.TypeRef

/**
* Converts one type to another
*/
internal data class ConversionMapping(
val source: TypeRef,
val destination: TypeRef,
val members: Set<String>,
val additionalImports: List<TypeRef> = emptyList(),
val additionalParameters: List<String> = emptyList(),
val additionalLogic: String = "",
)

/**
* High level S3 TM request/response from low level S3 operation members
*/
internal data class IoMapping(
val type: MappingType,
val className: String,
val sourceOperation: String,
val members: Set<String>,
)

internal enum class MappingType {
/**
* Maps high level operation request members to low level request members
*/
REQUEST,

/**
* Maps high level operation response members to low level response members
*/
RESPONSE,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

package aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings

import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.uploadfile.uploadFileConversions
import aws.sdk.kotlin.hll.s3transfermanager.codegen.mappings.uploadfile.uploadFileIoMappings

internal val ioMappings = uploadFileIoMappings
internal val conversionMappings = uploadFileConversions
Comment on lines +11 to +12
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question: Why are these aliases necessary? It seems like uploadFileConversions and uploadFileIoMappings are already internal in the same module.

Loading
Loading