// ✅ 1. 必须先写 buildscript
buildscript {
    repositories {
        mavenLocal()
        gradlePluginPortal()
        google()
        jcenter()  // ⚠️ 建议移除
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:8.5.2'
        classpath 'org.jetbrains.dokka:dokka-gradle-plugin:1.4.32'
        classpath "com.vanniktech:gradle-maven-publish-plugin:0.17.0" // 添加 maven-publish 插件
    }
}

// ✅ 2. 再写 plugins
plugins {
    id 'io.github.gradle-nexus.publish-plugin' version '2.0.0'
}

// ✅ 3. 所有子项目仓库统一配置
allprojects {
    repositories {
        mavenLocal()
        gradlePluginPortal()
        google()
        jcenter()  // ⚠️ 建议移除
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}

// ✅ 4. Maven Central 发布配置（只需配置一次）
nexusPublishing {
    repositories {
        sonatype {
            username.set(project.findProperty("ossrhUsername") as String)
            password.set(project.findProperty("ossrhPassword") as String)
        }
    }
}

// ✅ 5. 清理任务
task clean(type: Delete) {
    delete rootProject.buildDir
}



