/*
 * 第 9 章 · 演示远程 Build Cache 的 settings 配置
 */

pluginManagement {
    repositories {
        gradlePluginPortal()
        mavenCentral()
    }
}

dependencyResolutionManagement {
    repositories {
        mavenCentral()
    }
}

// ★ 重点：声明 Build Cache（本地 + 远程）
buildCache {
    local {
        // 本地缓存默认就是开的，写出来更显式
        isEnabled = true
        // 缓存最长保留时间（默认 7 天）
        // removeUnusedEntriesAfterDays = 7
    }

    // 取消下面注释即可启用远程缓存
    // remote<HttpBuildCache> {
    //     url = uri("https://gradle-cache.mycompany.com/cache/")
    //     // 只允许 CI 写入，开发者只读，避免污染
    //     isPush = providers.environmentVariable("CI").orNull == "true"
    //     credentials {
    //         username = providers.gradleProperty("cacheUser").orNull ?: ""
    //         password = providers.gradleProperty("cachePass").orNull ?: ""
    //     }
    // }
}

rootProject.name = "ch09-performance-demo"
