dependencyResolutionManagement {
    repositories {
        val composeRepoProperties = java.util.Properties().apply {
            val propertiesFile = rootDir.parentFile.resolve("local.properties")
            if (propertiesFile.isFile) propertiesFile.inputStream().use(::load)
        }
        composeRepoProperties.getProperty("COMPOSE_REPO_URL")
            ?.takeIf(String::isNotBlank)
            ?.let { repoUrl ->
                maven(repoUrl) {
                    credentials {
                        username = composeRepoProperties.getProperty("COMPOSE_REPO_USERNAME")
                        password = composeRepoProperties.getProperty("COMPOSE_REPO_KEY")
                    }
                }
            }
        maven("https://maven.eazytec-cloud.com/nexus/repository/maven-inner/")
        maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
        mavenCentral {
            url = uri("https://cache-redirector.jetbrains.com/maven-central")
        }
        google()
    }
    versionCatalogs {
        register("libs") {
            from(files("../dependencies.toml"))
        }
    }
}

pluginManagement {
    repositories {
        val composeRepoProperties = java.util.Properties().apply {
            val propertiesFile = rootDir.parentFile.resolve("local.properties")
            if (propertiesFile.isFile) propertiesFile.inputStream().use(::load)
        }
        composeRepoProperties.getProperty("COMPOSE_REPO_URL")
            ?.takeIf(String::isNotBlank)
            ?.let { repoUrl ->
                maven(repoUrl) {
                    credentials {
                        username = composeRepoProperties.getProperty("COMPOSE_REPO_USERNAME")
                        password = composeRepoProperties.getProperty("COMPOSE_REPO_KEY")
                    }
                }
            }
        maven("https://maven.eazytec-cloud.com/nexus/repository/maven-inner/")
        maven("https://maven.eazytec-cloud.com/nexus/repository/maven-public/")
        mavenCentral {
            url = uri("https://cache-redirector.jetbrains.com/maven-central")
        }
        gradlePluginPortal()
        google()
    }
}
rootProject.name = "skiko"
include("ci")
include("import-generator")
include("test-utils")
