plugins {
    id("convention.kotlin-jvm")
    id("convention.kotlin-serialization")
}

dependencies {
    implementation(project(":subprojects:common:teamcity-common"))
    implementation(libs.kotlinXCli)
    implementation(project(":subprojects:common:graphite"))
}

tasks.register("sendTeamcityBuildsMetrics", JavaExec) {
    mainClass = "com.avito.teamcity.SendTeamcityBuildsMetricsMain"
    classpath = sourceSets.getByName(SourceSet.MAIN_SOURCE_SET_NAME).runtimeClasspath

    args(
        "sendMetrics",
        "--teamcityUrl", project.providers.gradleProperty("teamcityUrl").getOrNull(),
        "--teamcityApiUser", project.providers.gradleProperty("teamcityApiUser").getOrNull(),
        "--teamcityApiPassword", project.providers.gradleProperty("teamcityApiPassword").getOrNull(),
        "--metricsSourcesConfigPath", project.providers.gradleProperty("metricsSourcesConfigPath").getOrNull(),
        "--graphiteHost", project.providers.gradleProperty("graphite.host").getOrNull(),
        "--graphitePort", project.providers.gradleProperty("graphite.port").getOrNull(),
        "--metricsPrefix", project.providers.gradleProperty("buildMetrics.prefix").getOrNull(),
    )
}


