-
Notifications
You must be signed in to change notification settings - Fork 58
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
103 lines (88 loc) · 3.38 KB
/
build.gradle.kts
File metadata and controls
103 lines (88 loc) · 3.38 KB
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
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
import aws.sdk.kotlin.gradle.dsl.configureLinting
import aws.sdk.kotlin.gradle.dsl.configureMinorVersionStrategyRules
import aws.sdk.kotlin.gradle.publishing.SonatypeCentralPortalPublishTask
import aws.sdk.kotlin.gradle.publishing.SonatypeCentralPortalWaitForPublicationTask
import aws.sdk.kotlin.gradle.publishing.configureJarReduction
import aws.sdk.kotlin.gradle.util.typedProp
buildscript {
// NOTE: buildscript classpath for the root project is the parent classloader for the subprojects, we
// only need to add e.g. atomic-fu and build-plugins here for imports and plugins to be available in subprojects.
dependencies {
classpath(libs.kotlinx.atomicfu.plugin)
// 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 buildscript classpath, this is a temporary fix
*/
force("com.squareup.okhttp3:okhttp-coroutines:5.0.0-alpha.14")
}
}
}
plugins {
`dokka-convention`
// ensure the correct version of KGP ends up on our buildscript classpath
id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false
id(libs.plugins.kotlin.jvm.get().pluginId) apply false
}
val testJavaVersion = typedProp<String>("test.java.version")?.let {
JavaLanguageVersion.of(it)
}?.also {
println("configuring tests to run with jdk $it")
}
allprojects {
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
compilerOptions.allWarningsAsErrors = true
}
}
if (testJavaVersion != null) {
tasks.withType<Test> {
val toolchains = project.extensions.getByType<JavaToolchainService>()
javaLauncher.set(
toolchains.launcherFor {
languageVersion.set(testJavaVersion)
},
)
}
}
// Enables running `./gradlew allDeps` to get a comprehensive list of dependencies for every subproject
tasks.register<DependencyReportTask>("allDeps") { }
}
// Configure root module's documentation
dokka {
moduleName.set("AWS SDK for Kotlin")
dokkaPublications.html {
includes.from(
rootProject.file("docs/dokka-presets/README.md"),
)
}
}
// Aggregate subprojects' documentation
dependencies {
dokka(project(":aws-runtime"))
dokka(project(":services"))
dokka(project(":hll"))
}
// Code Style
val lintPaths = listOf(
"**/*.{kt,kts}",
"!**/generated-src/**",
"!**/generated/ksp/**",
"!**/kspCaches/**",
"!**/smithyprojections/**",
"!**/build/**",
)
configureLinting(lintPaths)
configureMinorVersionStrategyRules(lintPaths)
tasks.register<SonatypeCentralPortalPublishTask>("publishToCentralPortal") { }
tasks.register<SonatypeCentralPortalWaitForPublicationTask>("waitForCentralPortalPublication") { }
configureJarReduction("aws/sdk/kotlin")