Skip to content

Instantly share code, notes, and snippets.

@twyatt
Created July 6, 2024 06:11
Show Gist options
  • Save twyatt/b04c277e87f8ee6bbbf1766e36d0bdfe to your computer and use it in GitHub Desktop.
Save twyatt/b04c277e87f8ee6bbbf1766e36d0bdfe to your computer and use it in GitHub Desktop.
Include sibling projects as composite builds via `local.properties`
// Configure sibling composite projects (`../<project>`) by adding `composite.<project>=true` to `local.properties`.
java.util.Properties()
.apply {
rootProject.projectDir
.resolve("local.properties")
.normalize()
.takeIf(File::exists)
?.let { java.io.FileInputStream(it) }
?.use(::load)
}
.run {
stringPropertyNames()
.filter { it.startsWith("composite.") && getProperty(it).toBoolean() }
.map { it.substringAfter('.') }
.onEach { logger.lifecycle("Including '$it' as a composite build") }
.map { "../$it" }
.forEach(::includeBuild)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment