Skip to content

Commit 136c9db

Browse files
committed
It works now
1 parent fbb3dd5 commit 136c9db

File tree

12 files changed

+90
-218
lines changed

12 files changed

+90
-218
lines changed

settings.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ include(":tests:codegen")
5656
include(":tests:codegen:event-stream")
5757
include(":tests:codegen:rules-engine")
5858
include(":tests:e2e-test-util")
59-
//include(":tests:codegen:smoke-tests")
60-
//include(":tests:codegen:smoke-tests:services")
59+
include(":tests:codegen:smoke-tests")
60+
include(":tests:codegen:smoke-tests:services")
6161

6262
// generated services
6363
val File.isServiceDir: Boolean

tests/codegen/build.gradle.kts

Lines changed: 70 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,80 +1,92 @@
11
import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections
2-
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
3-
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
4-
//import aws.sdk.kotlin.gradle.kmp.kotlin
52

63
plugins {
7-
alias(libs.plugins.kotlin.jvm) apply false
8-
alias(libs.plugins.aws.kotlin.repo.tools.smithybuild) apply false
9-
// alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false
4+
alias(libs.plugins.aws.kotlin.repo.tools.smithybuild)
5+
alias(libs.plugins.kotlin.multiplatform)
106
}
117

12-
val librares = libs
8+
kotlin {
9+
jvm()
10+
}
11+
12+
val libraries = libs
1313

1414
subprojects {
15-
apply(plugin = librares.plugins.kotlin.jvm.get().pluginId)
16-
apply(plugin = librares.plugins.aws.kotlin.repo.tools.smithybuild.get().pluginId)
17-
// apply(plugin = librares.plugins.aws.kotlin.repo.tools.kmp.get().pluginId)
15+
apply(plugin = libraries.plugins.aws.kotlin.repo.tools.smithybuild.get().pluginId)
16+
apply(plugin = libraries.plugins.kotlin.multiplatform.get().pluginId)
1817

19-
val codegen by configurations
18+
val optinAnnotations = listOf(
19+
"kotlin.RequiresOptIn",
20+
"aws.smithy.kotlin.runtime.InternalApi",
21+
"aws.sdk.kotlin.runtime.InternalSdkApi",
22+
)
23+
kotlin.sourceSets.all {
24+
optinAnnotations.forEach { languageSettings.optIn(it) }
25+
}
2026

21-
dependencies {
22-
codegen(project(":codegen:aws-sdk-codegen"))
23-
codegen(librares.smithy.cli)
24-
codegen(librares.smithy.model)
27+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
28+
dependsOn(tasks.generateSmithyProjections)
29+
kotlinOptions.allWarningsAsErrors = false
2530
}
2631

2732
tasks.generateSmithyProjections {
2833
doFirst {
29-
// ensure the generated tests use the same version of the runtime as the aws aws-runtime
30-
val smithyKotlinRuntimeVersion = librares.versions.smithy.kotlin.runtime.version.get()
34+
// Ensure the generated tests use the same version of the runtime as the aws aws-runtime
35+
val smithyKotlinRuntimeVersion = libraries.versions.smithy.kotlin.runtime.version.get()
3136
System.setProperty("smithy.kotlin.codegen.clientRuntimeVersion", smithyKotlinRuntimeVersion)
3237
}
3338
}
3439

35-
// val optinAnnotations = listOf(
36-
// "kotlin.RequiresOptIn",
37-
// "aws.smithy.kotlin.runtime.InternalApi",
38-
// "aws.sdk.kotlin.runtime.InternalSdkApi",
39-
// )
40-
// kotlin.sourceSets.all {
41-
// optinAnnotations.forEach { languageSettings.optIn(it) }
42-
// }
43-
44-
// kotlin.sourceSets.getByName("test") {
45-
// smithyBuild.projections.forEach {
46-
// kotlin.srcDir(smithyBuild.smithyKotlinProjectionSrcDir(it.name))
47-
// }
48-
// }
49-
50-
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
51-
dependsOn(tasks.generateSmithyProjections)
52-
kotlinOptions.allWarningsAsErrors = false
53-
}
54-
55-
val implementation by configurations
56-
val testImplementation by configurations
57-
val api by configurations
40+
val codegen by configurations
5841
dependencies {
59-
implementation(librares.kotlinx.coroutines.core)
42+
codegen(project(":codegen:aws-sdk-codegen"))
43+
codegen(libraries.smithy.cli)
44+
codegen(libraries.smithy.model)
45+
}
6046

61-
testImplementation(librares.kotlin.test)
62-
testImplementation(librares.kotlin.test.junit5)
63-
testImplementation(librares.kotlinx.coroutines.test)
64-
testImplementation(librares.smithy.kotlin.smithy.test)
65-
testImplementation(librares.smithy.kotlin.aws.signing.default)
66-
testImplementation(librares.smithy.kotlin.telemetry.api)
47+
kotlin {
48+
jvm()
49+
sourceSets {
50+
commonMain {
51+
dependencies {
52+
implementation(project(":codegen:aws-sdk-codegen"))
53+
implementation(libraries.smithy.kotlin.codegen)
6754

68-
/* We have to manually add all the dependencies of the generated client(s).
69-
Doing it this way (as opposed to doing what we do for protocol-tests) allows the tests to work without a
70-
publish to maven-local step at the cost of maintaining this set of dependencies manually. */
71-
implementation(librares.bundles.smithy.kotlin.service.client)
72-
implementation(librares.smithy.kotlin.aws.event.stream)
73-
implementation(project(":aws-runtime:aws-http"))
74-
implementation(librares.smithy.kotlin.aws.json.protocols)
75-
implementation(librares.smithy.kotlin.serde.json)
76-
api(project(":aws-runtime:aws-config"))
77-
api(project(":aws-runtime:aws-core"))
78-
api(project(":aws-runtime:aws-endpoint"))
55+
/* We have to manually add all the dependencies of the generated client(s).
56+
Doing it this way (as opposed to doing what we do for protocol-tests) allows the tests to work without a
57+
publish to maven-local step at the cost of maintaining this set of dependencies manually. */
58+
implementation(libraries.kotlinx.coroutines.core)
59+
implementation(libraries.bundles.smithy.kotlin.service.client)
60+
implementation(libraries.smithy.kotlin.aws.event.stream)
61+
implementation(project(":aws-runtime:aws-http"))
62+
implementation(libraries.smithy.kotlin.aws.json.protocols)
63+
implementation(libraries.smithy.kotlin.serde.json)
64+
api(project(":aws-runtime:aws-config"))
65+
api(project(":aws-runtime:aws-core"))
66+
api(project(":aws-runtime:aws-endpoint"))
67+
}
68+
}
69+
commonTest {
70+
dependencies {
71+
implementation(libraries.kotlin.test)
72+
implementation(libraries.kotlinx.coroutines.test)
73+
implementation(libraries.smithy.kotlin.smithy.test)
74+
implementation(libraries.smithy.kotlin.aws.signing.default)
75+
implementation(libraries.smithy.kotlin.telemetry.api)
76+
}
77+
}
78+
jvmTest {
79+
tasks.withType<Test> {
80+
useJUnitPlatform()
81+
testLogging {
82+
events("passed", "skipped", "failed")
83+
showStandardStreams = true
84+
showStackTraces = true
85+
showExceptions = true
86+
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
87+
}
88+
}
89+
}
90+
}
7991
}
8092
}

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

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,9 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections
76
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
87
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
98

10-
119
description = "Event stream codegen integration test suite"
1210

1311
data class Test(
@@ -78,56 +76,12 @@ tasks.generateSmithyBuild {
7876
}
7977
}
8078

81-
val optinAnnotations = listOf(
82-
"kotlin.RequiresOptIn",
83-
"aws.smithy.kotlin.runtime.InternalApi",
84-
"aws.sdk.kotlin.runtime.InternalSdkApi",
85-
)
86-
kotlin.sourceSets.all {
87-
optinAnnotations.forEach { languageSettings.optIn(it) }
88-
}
89-
90-
kotlin.sourceSets.getByName("test") {
91-
smithyBuild.projections.forEach {
92-
kotlin.srcDir(smithyBuild.smithyKotlinProjectionSrcDir(it.name))
93-
}
94-
}
95-
96-
tasks.test {
97-
useJUnitPlatform()
98-
testLogging {
99-
events("passed", "skipped", "failed")
100-
showStandardStreams = true
101-
showStackTraces = true
102-
showExceptions = true
103-
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
79+
kotlin {
80+
sourceSets {
81+
commonTest {
82+
smithyBuild.projections.forEach {
83+
kotlin.srcDir(smithyBuild.smithyKotlinProjectionSrcDir(it.name))
84+
}
85+
}
10486
}
10587
}
106-
107-
//dependencies {
108-
//
109-
// implementation(libs.kotlinx.coroutines.core)
110-
//
111-
// testImplementation(libs.kotlin.test)
112-
// testImplementation(libs.kotlin.test.junit5)
113-
// testImplementation(libs.kotlinx.coroutines.test)
114-
//
115-
// testImplementation(libs.smithy.kotlin.smithy.test)
116-
// testImplementation(libs.smithy.kotlin.aws.signing.default)
117-
// testImplementation(libs.smithy.kotlin.telemetry.api)
118-
//
119-
// // have to manually add all the dependencies of the generated client(s)
120-
// // doing it this way (as opposed to doing what we do for protocol-tests) allows
121-
// // the tests to work without a publish to maven-local step at the cost of maintaining
122-
// // this set of dependencies manually
123-
// // <-- BEGIN GENERATED DEPENDENCY LIST -->
124-
// implementation(libs.bundles.smithy.kotlin.service.client)
125-
// implementation(libs.smithy.kotlin.aws.event.stream)
126-
// implementation(project(":aws-runtime:aws-http"))
127-
// implementation(libs.smithy.kotlin.aws.json.protocols)
128-
// implementation(libs.smithy.kotlin.serde.json)
129-
// api(project(":aws-runtime:aws-config"))
130-
// api(project(":aws-runtime:aws-core"))
131-
// api(project(":aws-runtime:aws-endpoint"))
132-
// // <-- END GENERATED DEPENDENCY LIST -->
133-
//}

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

Lines changed: 1 addition & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* SPDX-License-Identifier: Apache-2.0
44
*/
55

6-
import aws.sdk.kotlin.gradle.codegen.dsl.generateSmithyProjections
76
import aws.sdk.kotlin.gradle.codegen.dsl.smithyKotlinPlugin
87
import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionSrcDir
98

@@ -77,58 +76,8 @@ tasks.generateSmithyBuild {
7776
}
7877
}
7978

80-
81-
val optinAnnotations = listOf(
82-
"kotlin.RequiresOptIn",
83-
"aws.smithy.kotlin.runtime.InternalApi",
84-
"aws.sdk.kotlin.runtime.InternalSdkApi",
85-
)
86-
87-
kotlin.sourceSets.all {
88-
optinAnnotations.forEach { languageSettings.optIn(it) }
89-
}
90-
91-
kotlin.sourceSets.getByName("test") {
79+
kotlin.sourceSets.getByName("jvmTest") {
9280
smithyBuild.projections.forEach {
9381
kotlin.srcDir(smithyBuild.smithyKotlinProjectionSrcDir(it.name))
9482
}
9583
}
96-
97-
tasks.test {
98-
useJUnitPlatform()
99-
testLogging {
100-
events("passed", "skipped", "failed")
101-
showStandardStreams = true
102-
showStackTraces = true
103-
showExceptions = true
104-
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
105-
}
106-
}
107-
108-
//dependencies {
109-
//
110-
// implementation(libs.kotlinx.coroutines.core)
111-
//
112-
// testImplementation(libs.kotlin.test)
113-
// testImplementation(libs.kotlin.test.junit5)
114-
// testImplementation(libs.kotlinx.coroutines.test)
115-
//
116-
// testImplementation(libs.smithy.kotlin.smithy.test)
117-
// testImplementation(libs.smithy.kotlin.aws.signing.default)
118-
// testImplementation(libs.smithy.kotlin.telemetry.api)
119-
//
120-
// // have to manually add all the dependencies of the generated client(s)
121-
// // doing it this way (as opposed to doing what we do for protocol-tests) allows
122-
// // the tests to work without a publish to maven-local step at the cost of maintaining
123-
// // this set of dependencies manually
124-
// // <-- BEGIN GENERATED DEPENDENCY LIST -->
125-
// implementation(libs.bundles.smithy.kotlin.service.client)
126-
// implementation(libs.smithy.kotlin.aws.event.stream)
127-
// implementation(project(":aws-runtime:aws-http"))
128-
// implementation(libs.smithy.kotlin.aws.json.protocols)
129-
// implementation(libs.smithy.kotlin.serde.json)
130-
// api(project(":aws-runtime:aws-config"))
131-
// api(project(":aws-runtime:aws-core"))
132-
// api(project(":aws-runtime:aws-endpoint"))
133-
// // <-- END GENERATED DEPENDENCY LIST -->
134-
//}

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

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,14 @@ import aws.sdk.kotlin.gradle.codegen.smithyKotlinProjectionPath
99

1010
description = "Tests for smoke tests runners"
1111

12-
plugins {
13-
alias(libs.plugins.aws.kotlin.repo.tools.smithybuild)
14-
alias(libs.plugins.kotlin.jvm)
12+
kotlin {
13+
sourceSets {
14+
jvmTest {
15+
dependencies {
16+
implementation("dev.gradleplugins:gradle-test-kit:7.3.3") // TODO: Use lib.versions.toml
17+
}
18+
}
19+
}
1520
}
1621

1722
val projections = listOf(
@@ -20,29 +25,12 @@ val projections = listOf(
2025
Projection("exceptionService", "smoke-tests-exception.smithy", "smithy.kotlin.traits#ExceptionService"),
2126
)
2227

23-
configureProject()
2428
configureProjections()
2529
configureTasks()
2630

27-
fun configureProject() {
28-
val codegen by configurations.getting
29-
30-
dependencies {
31-
codegen(project(":codegen:aws-sdk-codegen"))
32-
codegen(libs.smithy.cli)
33-
codegen(libs.smithy.model)
34-
35-
implementation(project(":codegen:aws-sdk-codegen"))
36-
implementation(libs.smithy.kotlin.codegen)
37-
38-
testImplementation(libs.kotlin.test)
39-
testImplementation(gradleTestKit())
40-
}
41-
}
42-
4331
fun configureProjections() {
4432
smithyBuild {
45-
val pathToSmithyModels = "src/test/resources/"
33+
val pathToSmithyModels = "src/jvmTest/resources/"
4634

4735
this@Build_gradle.projections.forEach { projection ->
4836
projections.register(projection.name) {
@@ -105,14 +93,6 @@ fun configureTasks() {
10593
tasks.withType<Test> {
10694
dependsOn(tasks.getByName("stageServices"))
10795
mustRunAfter(tasks.getByName("stageServices"))
108-
109-
testLogging {
110-
events("passed", "skipped", "failed")
111-
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
112-
showExceptions = true
113-
showCauses = true
114-
showStackTraces = true
115-
}
11696
}
11797
}
11898

0 commit comments

Comments
 (0)