Skip to content

Commit 7bbdced

Browse files
committed
Include aws-crt-kotlin as a composite build
1 parent f6557ba commit 7bbdced

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

3165
include(":dokka-smithy")

0 commit comments

Comments
 (0)