forked from awslabs/aws-sdk-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
settings.gradle.kts
120 lines (107 loc) · 4.01 KB
/
settings.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
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
pluginManagement {
repositories {
mavenLocal()
mavenCentral()
gradlePluginPortal()
maven {
name = "kotlinRepoTools"
url = java.net.URI("https://d2gys1nrxnjnyg.cloudfront.net/releases")
content {
includeGroupByRegex("""aws\.sdk\.kotlin.*""")
}
}
}
}
dependencyResolutionManagement {
repositories {
mavenLocal()
mavenCentral()
}
}
rootProject.name = "aws-sdk-kotlin"
includeBuild("build-support")
include(":dokka-aws")
include(":bom")
include(":codegen:sdk")
include(":codegen:aws-sdk-codegen")
include(":codegen:protocol-tests")
include(":aws-runtime")
include(":aws-runtime:aws-core")
include(":aws-runtime:aws-config")
include(":aws-runtime:aws-endpoint")
include(":aws-runtime:aws-http")
include(":services")
include(":tests")
include(":tests:codegen:event-stream")
include(":tests:e2e-test-util")
// generated services
val File.isServiceDir: Boolean
get() = isDirectory && toPath().resolve("build.gradle.kts").toFile().exists()
val String.isBootstrappedService: Boolean
get() = file("services/$this").isServiceDir
file("services").listFiles().forEach {
if (it.isServiceDir) {
include(":services:${it.name}")
}
}
// Service benchmarks project
val benchmarkServices = listOf(
// keep this list in sync with tests/benchmarks/service-benchmarks/build.gradle.kts
"s3",
"sns",
"sts",
"cloudwatch",
"cloudwatchevents",
"dynamodb",
"secretsmanager",
"iam",
)
if (benchmarkServices.all { it.isBootstrappedService }) {
include(":tests:benchmarks:service-benchmarks")
} else {
val missing = benchmarkServices.filterNot { it.isBootstrappedService }
logger.warn("Skipping :tests:benchmarks:service-benchmarks because these service(s) are not bootstrapped: $missing")
}
/**
* The following code enables to optionally include aws-sdk-kotlin dependencies in source form for easier
* development. By default, if `smithy-kotlin` exists as a directory at the same level as `aws-sdk-kotlin`
* then `smithy-kotlin` will be added as a composite build. To override this behavior, for example to add
* more composite builds, specify a different directory for `smithy-kotlin`, or to disable the feature entirely,
* a local.properties file can be added or amended such that the property `compositeProjects` specifies
* a comma delimited list of paths to project roots that shall be added as composite builds. If the list is
* empty to builds will be added. Invalid directories are ignored. Example local.properties:
*
* compositeProjects=~/repos/smithy-kotlin,/tmp/some/other/thing,../../another/project
*
*/
val compositeProjectList = try {
val localProperties = java.util.Properties()
localProperties.load(File(rootProject.projectDir, "local.properties").inputStream())
val propertyVal = localProperties.getProperty("compositeProjects") ?: "../smithy-kotlin"
val filePaths = propertyVal
.splitToSequence(",") // Split comma delimited string into sequence
.map { it.replaceFirst("^~".toRegex(), System.getProperty("user.home")) } // expand user dir
.filter { it.isNotBlank() }
.map { file(it) } // Create file from path
.toList()
if (filePaths.isNotEmpty()) println("Adding ${filePaths.size} composite build directories from local.properties.")
filePaths
} catch (e: java.io.FileNotFoundException) {
listOf(file("../smithy-kotlin")) // Default path, not an error.
} catch (e: Throwable) {
logger.error("Failed to load project paths from local.properties. Assuming defaults.", e)
listOf(file("../smithy-kotlin"))
}
compositeProjectList.forEach { projectRoot ->
when (projectRoot.exists()) {
true -> {
println("Including build '$projectRoot'")
includeBuild(projectRoot)
}
false -> println("Ignoring invalid build directory '$projectRoot'.")
}
}