Skip to content

Commit 41ad1b4

Browse files
committed
Commonize some more
1 parent cb4ab12 commit 41ad1b4

File tree

11 files changed

+50
-54
lines changed

11 files changed

+50
-54
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
kotlin version: 2.0.21
2+
error message: The daemon has terminated unexpectedly on startup attempt #1 with error code: 0. The daemon process output:
3+
1. Kotlin compile daemon is ready
4+

buildSrc/build.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
plugins {
2+
alias(libs.plugins.kotlin.jvm)
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}

buildSrc/settings.gradle.kts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
dependencyResolutionManagement {
2+
versionCatalogs {
3+
create("libs") {
4+
from(files("../gradle/libs.versions.toml"))
5+
}
6+
}
7+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package shared
2+
3+
/**
4+
* An AWS SDK for Kotlin codegen test
5+
*/
6+
data class CodegenTest(
7+
val name: String,
8+
val model: Model,
9+
val serviceShapeId: String,
10+
val protocolName: String? = null,
11+
)
12+
13+
/**
14+
* A smithy model file
15+
*/
16+
data class Model(
17+
val fileName: String,
18+
val path: String = "src/commonTest/resources/",
19+
)

tests/codegen/event-stream/build.gradle.kts

Lines changed: 5 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,10 @@
55

66
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
77
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
8+
import shared.CodegenTest
9+
import shared.Model
810

9-
description = "AWS SDK for Kotlin codegen event stream integration test suite"
10-
11-
apply(from = rootProject.file("buildSrc/shared.gradle.kts"))
12-
13-
data class CodegenTest(
14-
val name: String,
15-
val model: Model,
16-
val serviceShapeId: String,
17-
val protocolName: String? = null,
18-
)
19-
20-
data class Model(
21-
val fileName: String,
22-
val path: String = "src/commonTest/resources/",
23-
) {
24-
val file: File
25-
get() = layout.projectDirectory.file(path + fileName).asFile
26-
}
11+
description = "AWS SDK for Kotlin's event stream codegen test suite"
2712

2813
val tests = listOf(
2914
CodegenTest(
@@ -43,7 +28,7 @@ val tests = listOf(
4328
smithyBuild {
4429
tests.forEach { test ->
4530
projections.register(test.name) {
46-
imports = listOf(test.model.file.absolutePath)
31+
imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath)
4732
transforms = listOf(
4833
"""
4934
{
@@ -88,7 +73,7 @@ tasks.generateSmithyBuild {
8873
}
8974

9075
fun fillInModel(test: CodegenTest) {
91-
val modelFile = test.model.file
76+
val modelFile = layout.projectDirectory.file(test.model.path + test.model.fileName).asFile
9277
val model = modelFile.readText()
9378

9479
val opTraits =

tests/codegen/rules-engine/build.gradle.kts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,10 @@
44
*/
55

66
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
7+
import shared.CodegenTest
8+
import shared.Model
79

8-
description = "AWS SDK for Kotlin codegen rules engine integration test suite"
9-
10-
data class CodegenTest(
11-
val name: String,
12-
val model: Model,
13-
val serviceShapeId: String,
14-
val protocolName: String? = null,
15-
)
16-
17-
data class Model(
18-
val fileName: String,
19-
val path: String = "src/commonTest/resources/",
20-
) {
21-
val file: File
22-
get() = layout.projectDirectory.file(path + fileName).asFile
23-
}
10+
description = "AWS SDK for Kotlin's rules engine codegen test suite"
2411

2512
val tests = listOf(
2613
CodegenTest("operationContextParams", Model("operation-context-params.smithy"), "aws.sdk.kotlin.test#TestService")
@@ -29,7 +16,7 @@ val tests = listOf(
2916
smithyBuild {
3017
tests.forEach { test ->
3118
projections.register(test.name) {
32-
imports = listOf(test.model.file.absolutePath)
19+
imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath)
3320
smithyKotlinPlugin {
3421
serviceShapeId = test.serviceShapeId
3522
packageName = "aws.sdk.kotlin.test.${test.name.lowercase()}"

tests/codegen/smoke-tests/build.gradle.kts

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@
66
import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections
77
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
88
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionPath
9+
import shared.CodegenTest
10+
import shared.Model
911

10-
description = "AWS SDK for Kotlin codegen smoke tests integration test suite"
12+
description = "AWS SDK for Kotlin's smoke test codegen test suite"
1113

1214
kotlin {
1315
sourceSets {
@@ -19,21 +21,6 @@ kotlin {
1921
}
2022
}
2123

22-
data class CodegenTest(
23-
val name: String,
24-
val model: Model,
25-
val serviceShapeId: String,
26-
val protocolName: String? = null,
27-
)
28-
29-
data class Model(
30-
val fileName: String,
31-
val path: String = "src/jvmTest/resources/",
32-
) {
33-
val file: File
34-
get() = layout.projectDirectory.file(path + fileName).asFile
35-
}
36-
3724
val tests = listOf(
3825
CodegenTest("successService", Model("smoke-tests-success.smithy"), "smithy.kotlin.traits#SuccessService"),
3926
CodegenTest("failureService", Model("smoke-tests-failure.smithy"), "smithy.kotlin.traits#FailureService"),
@@ -47,7 +34,7 @@ fun configureProjections() {
4734
smithyBuild {
4835
this@Build_gradle.tests.forEach { test ->
4936
projections.register(test.name) {
50-
imports = listOf(test.model.file.absolutePath)
37+
imports = listOf(layout.projectDirectory.file(test.model.path + test.model.fileName).asFile.absolutePath)
5138
smithyKotlinPlugin {
5239
serviceShapeId = test.serviceShapeId
5340
packageName = "aws.sdk.kotlin.test.${test.name.lowercase()}"

0 commit comments

Comments
 (0)