-
Notifications
You must be signed in to change notification settings - Fork 31
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
123 lines (109 loc) · 3.64 KB
/
build.gradle.kts
File metadata and controls
123 lines (109 loc) · 3.64 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
* 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.configureNexus
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.
// NOTE: Anything included in the root buildscript classpath is added to the classpath for all projects!
dependencies {
classpath(libs.kotlinx.atomicfu.plugin)
// Add our custom gradle build logic to buildscript classpath
classpath(libs.aws.kotlin.repo.tools.build.support)
}
}
plugins {
`dokka-convention`
alias(libs.plugins.kotlinx.binary.compatibility.validator)
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
// ensure the correct version of KGP ends up on our buildscript classpath
// since build-plugins also has <some> version in its dependency closure
id(libs.plugins.kotlin.multiplatform.get().pluginId) apply false
id(libs.plugins.kotlin.jvm.get().pluginId) apply false
}
artifactSizeMetrics {
artifactPrefixes = setOf(":runtime")
significantChangeThresholdPercentage = 5.0
projectRepositoryName = "smithy-kotlin"
}
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> {
// JDK8 tests fail with out of memory sometimes, not sure why...
maxHeapSize = "2g"
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 the root multimodule docs
dokka {
moduleName.set("Smithy Kotlin")
dokkaPublications.html {
includes.from(
rootProject.file("docs/dokka-presets/README.md"),
)
}
}
dependencies {
dokka(project(":runtime"))
}
// Publishing
configureNexus()
// Code Style
val lintPaths = listOf(
"**/*.{kt,kts}",
"!**/generated-src/**",
"!**/smithyprojections/**",
"!**/build/**",
)
configureLinting(lintPaths)
// Binary compatibility
apiValidation {
ignoredProjects.addAll(
setOf(
"dokka-smithy",
"aws-signing-tests",
"test-suite",
"http-test",
"smithy-test",
"testing",
"smithy-kotlin-codegen",
"smithy-kotlin-codegen-testutils",
"smithy-aws-kotlin-codegen",
"protocol-tests",
"aws-signing-benchmarks",
"channel-benchmarks",
"http-benchmarks",
"serde-benchmarks",
"serde-codegen-support",
"serde-tests",
"nullability-tests",
"paginator-tests",
"waiter-tests",
"service-codegen-tests",
"compile",
"slf4j-1x-consumer",
"slf4j-2x-consumer",
),
)
}