chore(build): enable AboutLibraries offlineMode by default (#5054)

This commit is contained in:
James Rich 2026-04-10 16:34:38 -05:00 committed by GitHub
parent 520fa717a9
commit 77e30b60e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 22 additions and 19 deletions

View file

@ -316,16 +316,16 @@ dependencies {
}
aboutLibraries {
// Fetch full license text + funding info from GitHub API when on CI with a token
val isCi =
providers
.gradleProperty("ci")
.map { it.toBoolean() }
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
// Run offline by default to avoid burning GitHub API calls on every build.
// Release builds pass -PaboutLibraries.release=true to fetch full license text + funding info.
val isReleaseBuild = providers.gradleProperty("aboutLibraries.release").map { it.toBoolean() }.getOrElse(false)
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
offlineMode = !isReleaseBuild
collect {
fetchRemoteLicense = isCi && ghToken.isPresent
fetchRemoteFunding = isCi && ghToken.isPresent
fetchRemoteLicense = isReleaseBuild && ghToken.isPresent
fetchRemoteFunding = isReleaseBuild && ghToken.isPresent
if (ghToken.isPresent) {
gitHubApiToken = ghToken.get()
}