@@ -26,13 +26,37 @@ dependencyResolutionManagement {
2626 }
2727}
2828
29- // Set up aws-crt-kotlin as a composite build
30- val localAwsCrtKotlin = file(" ../aws-crt-kotlin" )
31- if (localAwsCrtKotlin.exists()) {
32- println (" Including aws-crt-kotlin as a composite build" )
33- includeBuild(localAwsCrtKotlin)
34- } else {
35- println (" Could not find aws-crt-kotlin in a sibling directory, not including it" )
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 (e: Throwable ) {
49+ logger.error(" Failed to 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+ }
3660}
3761
3862rootProject.name = " smithy-kotlin"
0 commit comments