From 9ad28e924f40e0e093abefce25c2f3bd5d4ad931 Mon Sep 17 00:00:00 2001 From: James Rich <2199651+jamesarich@users.noreply.github.com> Date: Mon, 16 Mar 2026 20:21:29 -0500 Subject: [PATCH] build: fix license generation and analytics build tasks (#4820) Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com> --- .github/workflows/release.yml | 9 --------- app/build.gradle.kts | 12 +++++++++++- .../src/main/kotlin/AnalyticsConventionPlugin.kt | 5 ++++- desktop/build.gradle.kts | 10 +++++++++- 4 files changed, 24 insertions(+), 12 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 76541d885..fd811600d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 2b1aab398..60271c4c0 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -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") } diff --git a/build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt b/build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt index 5cf77fef0..9b07a200c 100644 --- a/build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt +++ b/build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt @@ -66,7 +66,10 @@ class AnalyticsConventionPlugin : Plugin { 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 } } diff --git a/desktop/build.gradle.kts b/desktop/build.gradle.kts index 8d5f6a661..5615f8a77 100644 --- a/desktop/build.gradle.kts +++ b/desktop/build.gradle.kts @@ -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") }