|
1 | 1 | 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 |
5 | 2 |
|
6 | 3 | 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) |
10 | 6 | } |
11 | 7 |
|
12 | | -val librares = libs |
| 8 | +kotlin { |
| 9 | + jvm() |
| 10 | +} |
| 11 | + |
| 12 | +val libraries = libs |
13 | 13 |
|
14 | 14 | 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) |
18 | 17 |
|
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 | + } |
20 | 26 |
|
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 |
25 | 30 | } |
26 | 31 |
|
27 | 32 | tasks.generateSmithyProjections { |
28 | 33 | 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() |
31 | 36 | System.setProperty("smithy.kotlin.codegen.clientRuntimeVersion", smithyKotlinRuntimeVersion) |
32 | 37 | } |
33 | 38 | } |
34 | 39 |
|
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 |
58 | 41 | 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 | + } |
60 | 46 |
|
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) |
67 | 54 |
|
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 | + } |
79 | 91 | } |
80 | 92 | } |
0 commit comments