Skip to content
Merged
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
5 changes: 4 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,7 @@ smithyKotlinDocBaseUrl=https://sdk.amazonaws.com/kotlin/api/smithy-kotlin/api/$s
# atomicfu
kotlinx.atomicfu.enableJvmIrTransformation=true
# FIXME - https://github.com/Kotlin/kotlinx-atomicfu/issues/274
kotlinx.atomicfu.enableNativeIrTransformation=false
kotlinx.atomicfu.enableNativeIrTransformation=false

# https://github.com/google/ksp/blob/main/docs/ksp2.md
ksp.useKSP2=true
2 changes: 2 additions & 0 deletions hll/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@ apiValidation {
"hll-codegen",
"dynamodb-mapper-annotation-processor-test",
"dynamodb-mapper-codegen",
"dynamodb-mapper-ops-codegen",
"dynamodb-mapper-schema-codegen",
"dynamodb-mapper-schema-generator-plugin-test",
).filter { it in availableSubprojects } // Some projects may not be in the build depending on bootstrapping
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,7 @@
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/

description = "DynamoDbMapper annotations"
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Annotations"
extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.annotations"
19 changes: 0 additions & 19 deletions hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,7 @@ plugins {
}

dependencies {
implementation(libs.ksp.api)
implementation(project(":hll:hll-codegen"))
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-annotations"))
implementation(project(":services:dynamodb"))

testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotest.assertions.core.jvm)
testImplementation(libs.kotlin.test.junit5)
}

val optinAnnotations = listOf(
Expand All @@ -38,17 +30,6 @@ kotlin {
}
}

tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}

val sdkVersion: String by project
group = "aws.sdk.kotlin"
version = sdkVersion
Expand Down

Large diffs are not rendered by default.

49 changes: 49 additions & 0 deletions hll/dynamodb-mapper/dynamodb-mapper-ops-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
*/

description = "DynamoDbMapper ops code generation"
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Codegen :: Ops"
extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.codegen.ops"

plugins {
alias(libs.plugins.kotlin.jvm)
}

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

testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotest.assertions.core.jvm)
testImplementation(libs.kotlin.test.junit5)
}

val optinAnnotations = listOf(
"aws.smithy.kotlin.runtime.InternalApi",
"aws.sdk.kotlin.runtime.InternalSdkApi",
"kotlin.RequiresOptIn",
)

kotlin {
explicitApi()

sourceSets.all {
optinAnnotations.forEach(languageSettings::optIn)
}
}

tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
aws.sdk.kotlin.hll.dynamodbmapper.codegen.operations.HighLevelOpsProcessorProvider
aws.sdk.kotlin.hll.dynamodbmapper.codegen.annotations.AnnotationsProcessorProvider

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

description = "DynamoDbMapper schema code generation"
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper :: Codegen :: Schema"
extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper.codegen.schema"

plugins {
alias(libs.plugins.kotlin.jvm)
`maven-publish`
}

dependencies {
implementation(libs.ksp.api)
implementation(project(":hll:hll-codegen"))
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-annotations"))
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-codegen"))

testImplementation(libs.junit.jupiter)
testImplementation(libs.junit.jupiter.params)
testImplementation(libs.kotest.assertions.core.jvm)
testImplementation(libs.kotlin.test.junit5)
}

val optinAnnotations = listOf(
"aws.smithy.kotlin.runtime.InternalApi",
"aws.sdk.kotlin.runtime.InternalSdkApi",
"kotlin.RequiresOptIn",
)

kotlin {
explicitApi()

sourceSets.all {
optinAnnotations.forEach(languageSettings::optIn)
}
}

tasks.test {
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}

val sdkVersion: String by project
group = "aws.sdk.kotlin"
version = sdkVersion

val sourcesJar by tasks.creating(Jar::class) {
group = "publishing"
description = "Assembles Kotlin sources jar"
archiveClassifier.set("sources")
from(sourceSets.getByName("main").allSource)
}

publishing {
publications {
create<MavenPublication>("dynamodb-mapper-schema-codegen") {
from(components["java"])
artifact(sourcesJar)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ private val annotationName = DynamoDbItem::class.qualifiedName!!

public class AnnotationsProcessor(private val environment: SymbolProcessorEnvironment) : HllKspProcessor(environment) {
private val logger = environment.logger
private val codeGenerator = environment.codeGenerator

override fun processImpl(resolver: Resolver): List<KSAnnotated> {
logger.info("Searching for symbols annotated with $annotationName")
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
aws.sdk.kotlin.hll.dynamodbmapper.codegen.annotations.AnnotationsProcessorProvider

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies {
implementation(libs.ksp.gradle.plugin)

implementation(project(":hll:hll-codegen")) // for RenderOptions
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-codegen")) // for AnnotationsProcessorOptions
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen")) // for AnnotationsProcessorOptions
implementation(libs.smithy.kotlin.runtime.core) // for AttributeKey

testImplementation(libs.junit.jupiter)
Expand Down Expand Up @@ -176,6 +176,7 @@ tasks.withType<Test> {
dependsOn(":aws-runtime:aws-http:publishToMavenLocal")
dependsOn(":hll:dynamodb-mapper:dynamodb-mapper-annotations:publishToMavenLocal")
dependsOn(":hll:dynamodb-mapper:dynamodb-mapper-codegen:publishToMavenLocal")
dependsOn(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen:publishToMavenLocal")
dependsOn(":hll:dynamodb-mapper:dynamodb-mapper-schema-generator-plugin:publishToMavenLocal")
dependsOn(":hll:dynamodb-mapper:dynamodb-mapper:publishToMavenLocal")
dependsOn(":hll:hll-codegen:publishToMavenLocal")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class SchemaGeneratorPlugin : Plugin<Project> {
}

val sdkVersion = getSdkVersion()
dependencies.add("ksp", "aws.sdk.kotlin:dynamodb-mapper-codegen:$sdkVersion")
dependencies.add("ksp", "aws.sdk.kotlin:dynamodb-mapper-schema-codegen:$sdkVersion")
}

// Reads sdk-version.txt for the SDK version to add dependencies on. The file is created in this module's build.gradle.kts
Expand Down
6 changes: 2 additions & 4 deletions hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,12 @@ ksp {
"scan",
)
arg("op-allowlist", allowlist.joinToString(";"))

excludeProcessor("aws.sdk.kotlin.hll.dynamodbmapper.codegen.annotations.AnnotationsProcessor")
}

if (project.NATIVE_ENABLED) {
// Configure KSP for commonMain source generation; https://github.com/google/ksp/issues/963#issuecomment-1894144639

dependencies.kspCommonMainMetadata(project(":hll:dynamodb-mapper:dynamodb-mapper-codegen"))
dependencies.kspCommonMainMetadata(project(":hll:dynamodb-mapper:dynamodb-mapper-ops-codegen"))

kotlin.sourceSets.commonMain {
tasks.withType<KspTaskMetadata> {
Expand All @@ -79,7 +77,7 @@ if (project.NATIVE_ENABLED) {
// hack follows in narrative, minimally-opinionated comments.

// Start by invoking the JVM-only KSP configuration
dependencies.kspJvm(project(":hll:dynamodb-mapper:dynamodb-mapper-codegen"))
dependencies.kspJvm(project(":hll:dynamodb-mapper:dynamodb-mapper-ops-codegen"))

// Then we need to move the generated source from jvm to common
val moveGenSrc by tasks.registering {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ kotlin {
dependencies {
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper"))
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-annotations"))
implementation(project(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen"))
}
}
}
Expand All @@ -22,10 +23,5 @@ dependencies {
listOf(
"kspCommonMainMetadata",
"kspJvm", // FIXME Generating common code is hard for KSP: https://github.com/google/ksp/issues/567
).forEach { configuration -> add(configuration, project(":hll:dynamodb-mapper:dynamodb-mapper-codegen")) }
}

ksp {
// annotation-processor-test does not need the ops-codegen processor loaded
excludeProcessor("aws.sdk.kotlin.hll.dynamodbmapper.codegen.operations.HighLevelOpsProcessorProvider")
).forEach { configuration -> add(configuration, project(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen")) }
}
2 changes: 2 additions & 0 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ if ("dynamodb".isBootstrappedService) {
include(":hll:dynamodb-mapper")
include(":hll:dynamodb-mapper:dynamodb-mapper")
include(":hll:dynamodb-mapper:dynamodb-mapper-codegen")
include(":hll:dynamodb-mapper:dynamodb-mapper-ops-codegen")
include(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen")
include(":hll:dynamodb-mapper:dynamodb-mapper-annotations")
include(":hll:dynamodb-mapper:tests:dynamodb-mapper-annotation-processor-test")
include(":hll:dynamodb-mapper:dynamodb-mapper-schema-generator-plugin")
Expand Down
Loading