Slackbot
09/10/2023, 11:49 PMChrys
09/10/2023, 11:51 PMimport java.io.ByteArrayOutputStream
val gitUrl = getGitRemoteOriginUrl()
if (gitUrl.startsWith("<https://host.com/myorg/>")) {
apply {
from("myorg-init.gradle.kts")
}
}
fun getGitRemoteOriginUrl(): String = ByteArrayOutputStream().let {
project.exec {
commandLine = listOf("git", "config", "--get", "remote.origin.url")
standardOutput = it
}
it.toString().trim()
}Chrys
09/10/2023, 11:52 PMVampire
09/11/2023, 1:44 AMproject.exec unless the actions you want to do are only on the project anyway and you thus delay the action to be done when the projects are configured.