-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Expand file tree
/
Copy pathsettings.gradle.kts
More file actions
269 lines (240 loc) · 8.63 KB
/
settings.gradle.kts
File metadata and controls
269 lines (240 loc) · 8.63 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
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
/*
* Copyright 2014-2025 JetBrains s.r.o and contributors. Use of this source code is governed by the Apache 2.0 license.
*/
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")
enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
pluginManagement {
// Add repositories required for build-settings-logic
repositories {
google()
gradlePluginPortal()
// Should be in sync with ktorsettings.kotlin-user-project
val kotlinRepoUrl = providers.gradleProperty("kotlin_repo_url").orNull
if (kotlinRepoUrl != null) maven(kotlinRepoUrl) { name = "KotlinDev" }
}
includeBuild("build-settings-logic")
}
plugins {
id("org.gradle.toolchains.foojay-resolver-convention") version "1.0.0"
id("ktorsettings")
id("ktorsettings.develocity")
id("ktorsettings.configuration-cache")
}
rootProject.name = "ktor"
includeBuild("build-logic")
includeBuild("ktor-test-server")
// Project declarations go here.
// We use custom DSL instead of the default `include(":project:path")` function.
// - Use 'unaryPlus' operator to declare a project
// - Use 'including' keyword to declare nested projects
// - Declare projects in 'server', 'client' or 'shared' blocks when possible
projects {
server {
+"ktor-server-core"
+"ktor-server-config-yaml"
+"ktor-server-host-common"
+"ktor-server-jetty" including {
+"ktor-server-jetty-test-http2"
}
+"ktor-server-jetty-jakarta" including {
+"ktor-server-jetty-test-http2-jakarta"
}
+"ktor-server-servlet"
+"ktor-server-servlet-jakarta"
+"ktor-server-tomcat"
+"ktor-server-tomcat-jakarta"
+"ktor-server-netty"
+"ktor-server-cio"
+"ktor-server-test-host"
+"ktor-server-test-base"
+"ktor-server-test-suites"
+"ktor-server-tests"
nested("ktor-server-plugins") {
+"ktor-server-auth"
+"ktor-server-auth-api-key"
+"ktor-server-auth-jwt"
+"ktor-server-auth-ldap"
+"ktor-server-auto-head-response"
+"ktor-server-body-limit"
+"ktor-server-caching-headers"
+"ktor-server-call-id"
+"ktor-server-call-logging"
+"ktor-server-compression" including {
+"ktor-server-compression-zstd"
}
+"ktor-server-conditional-headers"
+"ktor-server-content-negotiation"
+"ktor-server-cors"
+"ktor-server-csrf"
+"ktor-server-data-conversion"
+"ktor-server-default-headers"
+"ktor-server-di"
+"ktor-server-double-receive"
+"ktor-server-forwarded-header"
+"ktor-server-freemarker"
+"ktor-server-hsts"
+"ktor-server-html-builder"
+"ktor-server-htmx"
+"ktor-server-http-redirect"
+"ktor-server-i18n"
+"ktor-server-jte"
+"ktor-server-method-override"
+"ktor-server-metrics"
+"ktor-server-metrics-micrometer"
+"ktor-server-mustache"
+"ktor-server-openapi"
+"ktor-server-partial-content"
+"ktor-server-pebble"
+"ktor-server-rate-limit"
+"ktor-server-request-validation"
+"ktor-server-resources"
+"ktor-server-sessions"
+"ktor-server-sse"
+"ktor-server-status-pages"
+"ktor-server-swagger"
+"ktor-server-thymeleaf"
+"ktor-server-velocity"
+"ktor-server-webjars"
+"ktor-server-websockets"
+"ktor-server-routing-openapi"
}
}
client {
+"ktor-client-core"
+"ktor-client-apache"
+"ktor-client-apache5"
+"ktor-client-android"
+"ktor-client-cio"
+"ktor-client-curl"
+"ktor-client-ios"
+"ktor-client-darwin"
+"ktor-client-darwin-legacy"
+"ktor-client-winhttp"
+"ktor-client-java"
+"ktor-client-jetty"
+"ktor-client-jetty-jakarta"
+"ktor-client-js"
+"ktor-client-mock"
+"ktor-client-okhttp"
+"ktor-client-test-base"
+"ktor-client-tests"
+"ktor-client-webrtc" including {
// Include `ktor-client-webrtc-rs` if rust compilation is enabled in `gradle.properties` for local builds
// or if the `RUST_COMPILATION` environment variable is set to `true` for the CI.
val compileRust = providers.environmentVariable("KTOR_RUST_COMPILATION")
.orElse(providers.gradleProperty("ktorbuild.rustCompilation"))
.orNull.toBoolean()
if (compileRust) {
+"ktor-client-webrtc-rs" // requires `cargo` to be installed
}
}
nested("ktor-client-plugins") {
+"ktor-client-auth"
+"ktor-client-bom-remover"
+"ktor-client-call-id"
+"ktor-client-content-negotiation" including {
+"ktor-client-content-negotiation-tests"
}
+"ktor-client-encoding"
+"ktor-client-json" including {
+"ktor-client-gson"
+"ktor-client-jackson"
+"ktor-client-serialization"
}
+"ktor-client-logging"
+"ktor-client-resources"
+"ktor-client-websockets"
}
}
shared {
+"ktor-call-id"
+"ktor-events"
+"ktor-resources"
+"ktor-serialization" including {
+"ktor-serialization-kotlinx" including {
+"ktor-serialization-kotlinx-json"
+"ktor-serialization-kotlinx-cbor"
+"ktor-serialization-kotlinx-xml"
+"ktor-serialization-kotlinx-protobuf"
+"ktor-serialization-kotlinx-tests"
}
+"ktor-serialization-gson"
+"ktor-serialization-jackson"
+"ktor-serialization-jackson3"
+"ktor-serialization-tests"
}
+"ktor-sse"
+"ktor-htmx" including {
+"ktor-htmx-html"
}
+"ktor-websocket-serialization"
+"ktor-websockets"
+"ktor-test-base"
+"ktor-openapi-schema" including {
+"ktor-openapi-schema-reflect"
}
+"ktor-encoding-zstd"
}
+"ktor-network" including {
+"ktor-network-tls" including {
+"ktor-network-tls-certificates"
}
}
+"ktor-http" including {
+"ktor-http-cio"
}
+"ktor-io"
+"ktor-utils"
+"ktor-bom"
+"ktor-test-dispatcher"
+"ktor-java-modules-test"
+"ktor-dokka"
+"ktor-version-catalog"
}
// region Project hierarchy DSL
@DslMarker
annotation class ProjectDsl
@ProjectDsl
sealed class ProjectScope(private val settings: Settings) {
/** Declares subproject in the current project scope. */
operator fun String.unaryPlus(): ProjectScope {
val projectName = this@unaryPlus
val projectPath = subprojectPath(projectName)
settings.include(projectName)
settings.project(":$projectName").projectDir = settings.settingsDir.resolve(projectPath)
return NestedProjectScope(settings, projectPath)
}
/**
* Adds one more level of nesting to the projects declared in the [nested] lambda.
* The group directory is not considered as a Gradle project.
*/
fun nested(groupName: String, nested: ProjectScope.() -> Unit) {
NestedProjectScope(settings, subprojectPath(groupName)).nested()
}
abstract fun subprojectPath(projectName: String): String
}
class RootProjectScope(settings: Settings) : ProjectScope(settings) {
override fun subprojectPath(projectName: String) = projectName
}
class NestedProjectScope(settings: Settings, private val basePath: String) : ProjectScope(settings) {
override fun subprojectPath(projectName: String): String = "$basePath/$projectName"
}
/**
* Adds projects declared in the [nested] function to [this] project scope.
* Should be used in combination with functions returning [ProjectScope].
* For example:
* ```
* projects {
* +"foo" including {
* +"bar"
* }
* }
* ```
*/
infix fun ProjectScope.including(nested: ProjectScope.() -> Unit) = nested()
fun Settings.projects(nested: RootProjectScope.() -> Unit) = RootProjectScope(this).nested()
/** Declares projects related to server implementation. */
fun RootProjectScope.server(nested: ProjectScope.() -> Unit) = +"ktor-server" including nested
fun RootProjectScope.client(nested: ProjectScope.() -> Unit) = +"ktor-client" including nested
fun RootProjectScope.shared(nested: ProjectScope.() -> Unit) = nested("ktor-shared", nested)
// endregion