Skip to content

Commit

Permalink
feat: setup DynamoDbMapper publication (#1419)
Browse files Browse the repository at this point in the history
  • Loading branch information
lauzadis authored Oct 3, 2024
1 parent 535d4c3 commit 997a9f6
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 118 deletions.
6 changes: 4 additions & 2 deletions .brazil.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
{
"dependencies": {
"org.jetbrains.kotlin:kotlin-gradle-plugin:2.*": "KotlinGradlePlugin-2.x",
"org.jetbrains.kotlin:kotlin-stdlib-common:2.*.*": "KotlinStdlibCommon-2.x",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.*.*": "KotlinStdlibJdk8-2.x",
"org.jetbrains.kotlin:kotlin-stdlib:2.*.*": "KotlinStdlib-2.x",
"org.jetbrains.kotlinx:atomicfu:0.*.*": "Atomicfu-0.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.*": "KotlinxCoroutinesCoreJvm-1.x",
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.*": "KotlinxCoroutinesJdk8-1.x"
"org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:1.*": "KotlinxCoroutinesJdk8-1.x",
"com.google.devtools.ksp:symbol-processing-api:2.*": "Maven-com-google-devtools-ksp_symbol-processing-api-2.x",
"com.google.devtools.ksp:symbol-processing-gradle-plugin:2.*": "Maven-com-google-devtools-ksp_symbol-processing-gradle-plugin-2.x"
},
"packageHandlingRules": {
"versioning": {
"defaultVersionLayout": "{MAJOR}.0.x"
},
"ignore": [
"aws.sdk.kotlin:bom",
"aws.sdk.kotlin.crt:aws-crt-kotlin-android",
"aws.sdk.kotlin:testing",
"aws.sdk.kotlin:version-catalog"
],
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ksp-version = "2.0.10-1.0.24" # Keep in sync with kotlin-version

dokka-version = "1.9.10"

aws-kotlin-repo-tools-version = "0.4.10"
aws-kotlin-repo-tools-version = "0.4.11"

# libs
coroutines-version = "1.9.0"
Expand Down
23 changes: 17 additions & 6 deletions hll/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.*
import aws.smithy.kotlin.runtime.InternalApi
import aws.smithy.kotlin.runtime.text.ensureSuffix
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

description = "High-level libraries for the AWS SDK for Kotlin"
Expand All @@ -31,22 +33,32 @@ val optinAnnotations = listOf(
"kotlin.RequiresOptIn",
)

@OptIn(InternalApi::class)
val hllPreviewVersion = if (sdkVersion.contains("-SNAPSHOT")) { // e.g. 1.3.29-beta-SNAPSHOT
sdkVersion
.removeSuffix("-SNAPSHOT")
.ensureSuffix("-beta-SNAPSHOT")
} else {
sdkVersion.ensureSuffix("-beta") // e.g. 1.3.29-beta
}

subprojects {
group = "aws.sdk.kotlin"
version = hllPreviewVersion
configurePublishing("aws-sdk-kotlin")
}

subprojects {
if (!needsKmpConfigured) {
return@subprojects
}

group = "aws.sdk.kotlin"
version = sdkVersion

apply {
plugin("org.jetbrains.kotlin.multiplatform")
plugin("org.jetbrains.dokka")
plugin(libraries.plugins.aws.kotlin.repo.tools.kmp.get().pluginId)
}

configurePublishing("aws-sdk-kotlin")

kotlin {
explicitApi()

Expand Down Expand Up @@ -94,7 +106,6 @@ apiValidation {

ignoredProjects += listOf(
"hll-codegen",
"dynamodb-mapper-annotation-processor-test",
"dynamodb-mapper-codegen",
"dynamodb-mapper-ops-codegen",
"dynamodb-mapper-schema-codegen",
Expand Down
4 changes: 0 additions & 4 deletions hll/dynamodb-mapper/dynamodb-mapper-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,6 @@ kotlin {
}
}

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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,6 @@ tasks.test {
}
}

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"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import aws.smithy.kotlin.runtime.InternalApi
import aws.smithy.kotlin.runtime.text.ensureSuffix
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
Expand Down Expand Up @@ -45,10 +47,6 @@ gradlePlugin {
}
}

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

publishing {
publications {
create<MavenPublication>("dynamodb-mapper-schema-generator-plugin") {
Expand All @@ -57,6 +55,27 @@ publishing {
}
}

/**
* The `java-gradle-plugin` plugin creates a javadoc jar by default, conflicting with the empty javadoc jar (emptyJar)
* created in aws-kotlin-repo-tools. Configure dependencies and disable the emptyJar task to avoid conflicts.
*/
afterEvaluate {
tasks.withType<PublishToMavenRepository> {
dependsOn(tasks.named("javadocJar"))
}

tasks.named("publishDynamodb-mapper-schema-generatorPluginMarkerMavenPublicationToMavenLocal") {
dependsOn(tasks.named("javadocJar"))
}

tasks.findByName("signDynamodb-mapper-schema-generatorPluginMarkerMavenPublication")
?.dependsOn(tasks.named("javadocJar"))

tasks.named("emptyJar") {
enabled = false
}
}

tasks.test {
useJUnitPlatform()
testLogging {
Expand All @@ -69,6 +88,17 @@ tasks.test {
}

// FIXME Commonize the following functions into the aws-kotlin-repo-tools build-support
val sdkVersion: String by project

@OptIn(InternalApi::class)
val hllPreviewVersion = if (sdkVersion.contains("-SNAPSHOT")) { // e.g. 1.3.29-beta-SNAPSHOT
sdkVersion
.removeSuffix("-SNAPSHOT")
.ensureSuffix("-beta-SNAPSHOT")
} else {
sdkVersion.ensureSuffix("-beta") // e.g. 1.3.29-beta
}

/**
* Create a file containing the sdkVersion to use as a resource
* This saves us from having to manually change version numbers in multiple places
Expand All @@ -81,7 +111,7 @@ val generateSdkVersionFile by tasks.registering {
outputs.file(versionFile)
sourceSets.main.get().output.dir(resourcesDir)
doLast {
versionFile.writeText(sdkVersion)
versionFile.writeText(hllPreviewVersion)
}
}

Expand Down
4 changes: 4 additions & 0 deletions hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
import java.nio.file.Files
import java.nio.file.StandardCopyOption

description = "High level DynamoDbMapper client"
extra["displayName"] = "AWS :: SDK :: Kotlin :: HLL :: DynamoDbMapper"
extra["moduleName"] = "aws.sdk.kotlin.hll.dynamodbmapper"

buildscript {
dependencies {
classpath(libs.ddb.local)
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions hll/hll-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ dependencies {
testImplementation(libs.kotlin.test.junit5)
}

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"
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ if ("dynamodb".isBootstrappedService) {
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")
include(":hll:dynamodb-mapper:tests:dynamodb-mapper-schema-generator-plugin-test")
} else {
Expand Down

0 comments on commit 997a9f6

Please sign in to comment.