Skip to content

Instantly share code, notes, and snippets.

@bric3
Created March 30, 2022 15:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bric3/61145974988ddb9ec87aa9b9cee36a89 to your computer and use it in GitHub Desktop.
Save bric3/61145974988ddb9ec87aa9b9cee36a89 to your computer and use it in GitHub Desktop.
Adding composite build programmatically as an alternative to https://www.jetbrains.com/help/idea/work-with-gradle-projects.html#gradle_composite_build
val fireplaceLocation = extra.has("fireplaceLocation").let {
if (it) extra.get("fireplaceLocation") as String
else null
}
if (!fireplaceLocation.isNullOrEmpty()) {
val location = when {
fireplaceLocation.startsWith("\$HOME") || fireplaceLocation.startsWith("~") -> {
fireplaceLocation.replaceFirst("~|\$HOME".toRegex(), System.getProperty("user.home"))
}
else -> fireplaceLocation
}
if (file(location).exists()) {
logger.lifecycle("Using composite build with fireplace at: $location")
includeBuild(location) {
dependencySubstitution {
substitute(module("io.github.bric3.fireplace:fireplace-swing")).using(project(":fireplace-swing"))
substitute(module("io.github.bric3.fireplace:fireplace-swing-animation")).using(project(":fireplace-swing-animation"))
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment