Skip to content

Commit 2109a72

Browse files
authored
misc: include aws-crt-kotlin as a composite build (#1263)
1 parent 5d8d7fd commit 2109a72

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

settings.gradle.kts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,40 @@ dependencyResolutionManagement {
2626
}
2727
}
2828

29+
// TODO This is largely shared with aws-sdk-kotlin, consider commonizing
30+
// Set up a sibling directory aws-crt-kotlin as a composite build, if it exists.
31+
// Allows overrides via local.properties:
32+
// compositeProjects=~/repos/aws-crt-kotlin,/tmp/some/other/thing,../../another/project
33+
val compositeProjectList = try {
34+
val localProperties = java.util.Properties().also {
35+
it.load(File(rootProject.projectDir, "local.properties").inputStream())
36+
}
37+
val compositeProjects = localProperties.getProperty("compositeProjects") ?: "../aws-crt-kotlin"
38+
39+
val compositeProjectPaths = compositeProjects.split(",")
40+
.map { it.replaceFirst("^~".toRegex(), System.getProperty("user.home")) } // expand ~ to user's home directory
41+
.filter { it.isNotBlank() }
42+
.map { file(it) }
43+
44+
compositeProjectPaths.also {
45+
if (it.isNotEmpty()) {
46+
println("Adding composite build projects from local.properties: ${compositeProjectPaths.joinToString { it.name }}")
47+
}
48+
}
49+
} catch (_: Throwable) {
50+
logger.error("Could not load composite project paths from local.properties")
51+
listOf(file("../aws-crt-kotlin"))
52+
}
53+
54+
compositeProjectList.forEach {
55+
if (it.exists()) {
56+
println("Including build '$it'")
57+
includeBuild(it)
58+
} else {
59+
println("Ignoring invalid build directory '$it'")
60+
}
61+
}
62+
2963
rootProject.name = "smithy-kotlin"
3064

3165
include(":dokka-smithy")

0 commit comments

Comments
 (0)