build: fix license generation and analytics build tasks (#4820)

Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
This commit is contained in:
James Rich 2026-03-16 20:21:29 -05:00 committed by GitHub
parent 8c964a15ca
commit 9ad28e924f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 12 deletions

View file

@ -149,9 +149,6 @@ jobs:
ruby-version: '3.4.9'
bundler-cache: true
- name: Export Full Library Licenses
run: ./gradlew exportLibraryDefinitions -Pci=true
- name: Build and Deploy Google Play to Internal Track with Fastlane
env:
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
@ -232,9 +229,6 @@ jobs:
ruby-version: '3.4.9'
bundler-cache: true
- name: Export Full Library Licenses
run: ./gradlew exportLibraryDefinitions -Pci=true
- name: Build F-Droid with Fastlane
env:
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
@ -292,9 +286,6 @@ jobs:
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
build-scan-terms-of-use-agree: 'yes'
- name: Export Full Library Licenses
run: ./gradlew exportLibraryDefinitions -Pci=true
- name: Install dependencies for AppImage
if: runner.os == 'Linux'
run: sudo apt-get update && sudo apt-get install -y libfuse2

View file

@ -316,7 +316,11 @@ 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(false)
val isCi =
providers
.gradleProperty("ci")
.map { it.toBoolean() }
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
collect {
fetchRemoteLicense = isCi && ghToken.isPresent
@ -334,3 +338,9 @@ aboutLibraries {
duplicationRule = DuplicateRule.SIMPLE
}
}
// Ensure aboutlibraries.json is always up-to-date during the build.
// This is required since AboutLibraries v11+ no longer auto-exports.
tasks
.matching { it.name.startsWith("process") && it.name.endsWith("Resources") }
.configureEach { dependsOn("exportLibraryDefinitions") }

View file

@ -66,7 +66,10 @@ class AnalyticsConventionPlugin : Plugin<Project> {
plugins.withId("com.datadoghq.dd-sdk-android-gradle-plugin") {
tasks.configureEach {
if ((name.contains("datadog", ignoreCase = true) || name.contains("uploadMapping", ignoreCase = true)) && name.contains("fdroid", ignoreCase = true)) {
if ((name.contains("datadog", ignoreCase = true) ||
name.contains("uploadMapping", ignoreCase = true) ||
name.contains("buildId", ignoreCase = true)) &&
name.contains("fdroid", ignoreCase = true)) {
enabled = false
}
}

View file

@ -194,7 +194,11 @@ 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(false)
val isCi =
providers
.gradleProperty("ci")
.map { it.toBoolean() }
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
collect {
fetchRemoteLicense = isCi && ghToken.isPresent
@ -212,3 +216,7 @@ aboutLibraries {
duplicationRule = DuplicateRule.SIMPLE
}
}
// Ensure aboutlibraries.json is always up-to-date during the build.
// This is required since AboutLibraries v11+ no longer auto-exports.
tasks.named("processResources") { dependsOn("exportLibraryDefinitions") }