forked from smithy-lang/smithy-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle.kts
155 lines (138 loc) · 5.3 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
/*
* 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 {
alias(libs.plugins.dokka)
alias(libs.plugins.kotlinx.binary.compatibility.validator)
// ensure the correct version of KGP ends up on our buildscript classpath
// since build-plugins also has <some> version in its dependency closure
alias(libs.plugins.kotlin.multiplatform) apply false
alias(libs.plugins.kotlin.jvm) apply false
alias(libs.plugins.aws.kotlin.repo.tools.artifactsizemetrics)
}
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 {
tasks.withType<org.jetbrains.dokka.gradle.AbstractDokkaTask>().configureEach {
val sdkVersion: String by project
moduleVersion.set(sdkVersion)
val year = java.time.LocalDate.now().year
val pluginConfigMap = mapOf(
"org.jetbrains.dokka.base.DokkaBase" to """
{
"customStyleSheets": [
"${rootProject.file("docs/dokka-presets/css/logo-styles.css")}",
"${rootProject.file("docs/dokka-presets/css/aws-styles.css")}"
],
"customAssets": [
"${rootProject.file("docs/dokka-presets/assets/logo-icon.svg")}",
"${rootProject.file("docs/dokka-presets/assets/aws_logo_white_59x35.png")}"
],
"footerMessage": "© $year, Amazon Web Services, Inc. or its affiliates. All rights reserved.",
"separateInheritedMembers" : true,
"templatesDir": "${rootProject.file("docs/dokka-presets/templates")}"
}
""",
)
pluginsMapConfiguration.set(pluginConfigMap)
}
if (rootProject.typedProp<Boolean>("kotlinWarningsAsErrors") == true) {
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.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
tasks.dokkaHtmlMultiModule.configure {
moduleName.set("Smithy Kotlin")
// Output subprojects' docs to <docs-base>/project-name/* instead of <docs-base>/path/to/project-name/*
// This is especially important for inter-repo linking (e.g., via externalDocumentationLink) because the
// package-list doesn't contain enough project path information to indicate where modules' documentation are
// located.
fileLayout.set { parent, child ->
parent.outputDirectory.dir(child.moduleName)
}
includes.from(
// NOTE: these get concatenated
rootProject.file("docs/dokka-presets/README.md"),
)
val excludeFromDocumentation = listOf(
project(":runtime:testing"),
project(":runtime:smithy-test"),
)
removeChildTasks(excludeFromDocumentation)
}
// Publishing
configureNexus()
// Code Style
val lintPaths = listOf(
"**/*.{kt,kts}",
"!**/generated-src/**",
"!**/smithyprojections/**",
)
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",
"compile",
"slf4j-1x-consumer",
"slf4j-2x-consumer",
),
)
}