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: 5 additions & 0 deletions .changes/058bf26f-7f37-439a-9170-d0a2c9c84e3e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"id": "058bf26f-7f37-439a-9170-d0a2c9c84e3e",
"type": "misc",
"description": "Upgrade to Gradle 9.0.0"
}
12 changes: 12 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,18 @@ buildscript {
// Add our custom gradle build logic to buildscript classpath
classpath(libs.aws.kotlin.repo.tools.build.support)
}

configurations.classpath {
resolutionStrategy {
/*
Version bumping the SDK to 1.5.x in repo tools broke our buildscript classpath:
java.lang.NoSuchMethodError: 'void kotlinx.coroutines.CancellableContinuation.resume(java.lang.Object, kotlin.jvm.functions.Function3)

FIXME: Figure out what broke our buildscipt classpath, this is a temporary fix
*/
force("com.squareup.okhttp3:okhttp-coroutines:5.0.0-alpha.14")
}
}
}

plugins {
Expand Down
65 changes: 20 additions & 45 deletions codegen/protocol-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -73,63 +73,38 @@ dependencies {
codegen(libs.smithy.aws.protocol.tests)
}

abstract class ProtocolTestTask @Inject constructor(private val project: Project) : DefaultTask() {
/**
* The projection
*/
@get:Input
abstract val projectionName: Property<String>

/**
* The projection root directory
*/
@get:Input
abstract val projectionRootDirectory: Property<String>

@TaskAction
fun runTests() {
val projectionRootDir = project.file(projectionRootDirectory.get())
println("[$projectionName] buildDir: $projectionRootDir")
if (!projectionRootDir.exists()) {
throw GradleException("$projectionRootDir does not exist")
}
val wrapper = if (System.getProperty("os.name").lowercase().contains("windows")) "gradlew.bat" else "gradlew"
val gradlew = project.rootProject.file(wrapper).absolutePath

// NOTE - this still requires us to publish to maven local.
project.exec {
workingDir = projectionRootDir
executable = gradlew
args = listOf("test")
}
}
}

smithyBuild.projections.forEach {
val protocolName = it.name

tasks.register<ProtocolTestTask>("testProtocol-$protocolName") {
dependsOn(tasks.generateSmithyProjections)
group = "Verification"
projectionName.set(it.name)
projectionRootDirectory.set(smithyBuild.smithyKotlinProjectionPath(it.name).map { it.toString() })
}
val dirProvider = smithyBuild
.smithyKotlinProjectionPath(protocolName)
.map { file(it.toString()) }

// FIXME This is a hack to work around how protocol tests aren't in the actual service model and thus codegen
// separately from service customizations.
val copyStaticFiles = tasks.register<Copy>("copyStaticFiles-$protocolName") {
group = "codegen"
from(rootProject.projectDir.resolve("services/$protocolName/common/src"))
into(smithyBuild.smithyKotlinProjectionSrcDir(it.name))
into(smithyBuild.smithyKotlinProjectionSrcDir(protocolName))
}

tasks.generateSmithyProjections.configure {
finalizedBy(copyStaticFiles)
tasks.register<Exec>("testProtocol-$protocolName") {
group = "Verification"
dependsOn(tasks.generateSmithyProjections, copyStaticFiles)

doFirst {
val dir = dirProvider.get()
require(dir.exists()) { "$dir does not exist" }

val wrapper = if (System.getProperty("os.name").lowercase().contains("windows")) "gradlew.bat" else "gradlew"
val gradlew = rootProject.layout.projectDirectory.file(wrapper).asFile.absolutePath

workingDir = dir
executable = gradlew
args = listOf("test")
}
}
}

tasks.register("testAllProtocols") {
group = "Verification"
val allTests = tasks.withType<ProtocolTestTask>()
dependsOn(allTests)
dependsOn(tasks.matching { it.name.startsWith("testProtocol-") })
}
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.2.0-2.0.2" # Keep in sync with kotlin-version

dokka-version = "2.0.0"

aws-kotlin-repo-tools-version = "0.4.36"
aws-kotlin-repo-tools-version = "0.4.48"

# libs
coroutines-version = "1.10.2"
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https://services.gradle.org/distributions/gradle-8.14.2-bin.zip
distributionUrl=https://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
2 changes: 1 addition & 1 deletion hll/dynamodb-mapper/dynamodb-mapper/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ if (project.NATIVE_ENABLED) {
}
}

listOf("jvmSourcesJar", "metadataSourcesJar").forEach {
listOf("jvmSourcesJar", "metadataSourcesJar", "jvmProcessResources").forEach {
tasks.named(it) {
dependsOn(moveGenSrc)
}
Expand Down
6 changes: 1 addition & 5 deletions hll/hll-codegen/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,7 @@ dependencies {
api(project(":aws-runtime:aws-core"))
implementation(libs.ksp.api)
implementation(libs.smithy.kotlin.runtime.core)

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

val sourcesJar by tasks.creating(Jar::class) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
package aws.sdk.kotlin.hll.codegen.core

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith

class TemplateEngineTest {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ package aws.sdk.kotlin.hll.codegen.core

import aws.sdk.kotlin.hll.codegen.model.TypeRef
import aws.sdk.kotlin.hll.codegen.model.TypeVar
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import kotlin.test.Test
import kotlin.test.assertContains
import kotlin.test.assertEquals

class TemplateProcessorTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
*/
package aws.sdk.kotlin.hll.codegen.util

import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import kotlin.test.Test
import kotlin.test.assertEquals

class StringsTest {
@Test
Expand Down
1 change: 0 additions & 1 deletion settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ if ("dynamodb".isBootstrappedService) {
include(":hll:dynamodb-mapper:dynamodb-mapper-schema-codegen")
include(":hll:dynamodb-mapper:dynamodb-mapper-annotations")
include(":hll:dynamodb-mapper:dynamodb-mapper-schema-generator-plugin")
include(":hll:dynamodb-mapper:tests:dynamodb-mapper-schema-generator-plugin-test")
} else {
logger.warn(":services:dynamodb is not bootstrapped, skipping :hll:dynamodb-mapper and subprojects")
}
Expand Down
8 changes: 3 additions & 5 deletions tests/codegen/checksums/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@ import aws.sdk.kotlin.tests.codegen.Model

description = "AWS SDK for Kotlin's checksums codegen test suite"

val tests = listOf(
CodegenTest("checksums", Model("checksums.smithy"), "aws.sdk.kotlin.test#TestService"),
)

smithyBuild {
this@Build_gradle.tests.forEach { test ->
listOf(
CodegenTest("checksums", Model("checksums.smithy"), "aws.sdk.kotlin.test#TestService"),
).forEach { test ->
projections.register(test.name) {
imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath)
smithyKotlinPlugin {
Expand Down
Loading