This message was deleted.
# community-support
s
This message was deleted.
c
Copy code
import 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()
}
this snippet doesn't work. It transmits the idea of what i want to achieve. I've move the init script content to myorg-init.gradle.kts and tried to conditionally apply it inside init.gradle.kts. In vain
v
At the time an init script is executed, there is no project available yet, so you cannot do
project.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.
1