-
Notifications
You must be signed in to change notification settings - Fork 50
/
Copy pathbuild.gradle.kts
158 lines (132 loc) · 6.01 KB
/
build.gradle.kts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import aws.sdk.kotlin.gradle.dsl.configurePublishing
import aws.sdk.kotlin.gradle.kmp.*
import aws.sdk.kotlin.gradle.util.typedProp
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.time.LocalDateTime
plugins {
`maven-publish`
alias(libs.plugins.dokka)
alias(libs.plugins.aws.kotlin.repo.tools.kmp) apply false
}
val sdkVersion: String by project
val optinAnnotations = listOf(
"aws.smithy.kotlin.runtime.InternalApi",
"aws.sdk.kotlin.runtime.InternalSdkApi",
"kotlin.RequiresOptIn",
)
// capture locally - scope issue with custom KMP plugin
val libraries = libs
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)
}
logger.info("configuring: $project")
kotlin {
explicitApi()
sourceSets {
all {
// have generated sdk's opt-in to internal runtime features
optinAnnotations.forEach { languageSettings.optIn(it) }
}
getByName("commonMain") {
kotlin.srcDir("generated-src/main/kotlin")
}
getByName("commonTest") {
kotlin.srcDir("generated-src/test")
dependencies {
implementation(libraries.kotlinx.coroutines.test)
implementation(libraries.smithy.kotlin.http.test)
}
}
}
if (project.file("e2eTest").exists()) {
jvm().compilations {
val e2eTest by creating {
defaultSourceSet {
kotlin.srcDir("e2eTest/src")
resources.srcDir("e2eTest/test-resources")
dependsOn([email protected]("commonMain"))
dependsOn([email protected]("jvmMain"))
dependencies {
api(libraries.smithy.kotlin.testing)
implementation(libraries.kotlin.test)
implementation(libraries.kotlin.test.junit5)
implementation(project(":tests:e2e-test-util"))
implementation(libraries.slf4j.simple)
}
}
kotlinOptions {
// Enable coroutine runTests in 1.6.10
// NOTE: may be removed after coroutines-test runTests becomes stable
freeCompilerArgs = freeCompilerArgs + "-opt-in=kotlin.RequiresOptIn"
}
tasks.register<Test>("e2eTest") {
description = "Run e2e service tests"
group = "verification"
if (project.name == "s3") {
dependencies {
implementation(project(":services:s3control"))
implementation(project(":services:sts"))
implementation(libs.smithy.kotlin.aws.signing.crt)
}
}
if (project.name == "sesv2") {
dependencies {
implementation(libs.smithy.kotlin.aws.signing.crt) // needed for E2E test of SigV4a
}
}
if (project.name == "route53") {
dependencies {
implementation(libraries.smithy.kotlin.http.test) // needed for URI E2E tests
}
}
// Run the tests with the classpath containing the compile dependencies (including 'main'),
// runtime dependencies, and the outputs of this compilation:
classpath = compileDependencyFiles + runtimeDependencyFiles + output.allOutputs
// Run only the tests from this compilation's outputs:
testClassesDirs = output.classesDirs
useJUnitPlatform()
testLogging {
events("passed", "skipped", "failed")
showStandardStreams = true
showStackTraces = true
showExceptions = true
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
// model a random input to enable re-running e2e tests back to back without
// up-to-date checks or cache getting in the way
inputs.property("integration.datetime", LocalDateTime.now())
systemProperty("org.slf4j.simpleLogger.defaultLogLevel", System.getProperty("org.slf4j.simpleLogger.defaultLogLevel", "WARN"))
}
}
}
}
}
dependencies {
dokkaPlugin(project(":dokka-aws"))
}
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions {
allWarningsAsErrors.set(false) // FIXME Tons of errors occur in generated code
jvmTarget.set(JvmTarget.JVM_1_8) // fixes outgoing variant metadata: https://github.com/smithy-lang/smithy-kotlin/issues/258
}
}
configurePublishing("aws-sdk-kotlin")
publishing {
publications.all {
if (this !is MavenPublication) return@all
project.afterEvaluate {
val sdkId = project.typedProp<String>("aws.sdk.id") ?: error("service build `${project.name}` is missing `aws.sdk.id` property required for publishing")
pom.properties.put("aws.sdk.id", sdkId)
}
}
}
}