// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://plugins.gradle.org/m2/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.1.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.20"
        classpath 'io.github.gradle-nexus:publish-plugin:2.0.0'
        classpath 'de.undercouch:gradle-download-task:5.3.0'
        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle.kts files
    }
}

apply plugin: 'io.github.gradle-nexus.publish-plugin'

tasks.register('clean', Delete) {
    delete rootProject.buildDir
}

Properties properties = new Properties()
if (rootProject.file("local.properties").exists()) {
    properties.load(rootProject.file("local.properties").newDataInputStream())
}
// Publish to Maven Central
nexusPublishing {
    repositories {
        sonatype {
            stagingProfileId = properties.getProperty("sonatypeStagingProfileId", System.getenv('SONATYPE_STAGING_PROFILE_ID'))
            username = properties.getProperty("ossrhUsername", System.getenv('OSSRH_USERNAME'))
            password = properties.getProperty("ossrhPassword", System.getenv('OSSRH_PASSWORD'))
            nexusUrl.set(uri("https://s01.oss.sonatype.org/service/local/"))
            snapshotRepositoryUrl.set(uri("https://s01.oss.sonatype.org/content/repositories/snapshots/"))
    }
}
}
