Skip to content

Commit 9ad28e9

Browse files
authored
build: fix license generation and analytics build tasks (#4820)
Signed-off-by: James Rich <2199651+jamesarich@users.noreply.github.com>
1 parent 8c964a1 commit 9ad28e9

File tree

4 files changed

+24
-12
lines changed

4 files changed

+24
-12
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ jobs:
149149
ruby-version: '3.4.9'
150150
bundler-cache: true
151151

152-
- name: Export Full Library Licenses
153-
run: ./gradlew exportLibraryDefinitions -Pci=true
154-
155152
- name: Build and Deploy Google Play to Internal Track with Fastlane
156153
env:
157154
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
@@ -232,9 +229,6 @@ jobs:
232229
ruby-version: '3.4.9'
233230
bundler-cache: true
234231

235-
- name: Export Full Library Licenses
236-
run: ./gradlew exportLibraryDefinitions -Pci=true
237-
238232
- name: Build F-Droid with Fastlane
239233
env:
240234
VERSION_NAME: ${{ needs.prepare-build-info.outputs.APP_VERSION_NAME }}
@@ -292,9 +286,6 @@ jobs:
292286
build-scan-terms-of-use-url: 'https://gradle.com/terms-of-service'
293287
build-scan-terms-of-use-agree: 'yes'
294288

295-
- name: Export Full Library Licenses
296-
run: ./gradlew exportLibraryDefinitions -Pci=true
297-
298289
- name: Install dependencies for AppImage
299290
if: runner.os == 'Linux'
300291
run: sudo apt-get update && sudo apt-get install -y libfuse2

app/build.gradle.kts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,11 @@ dependencies {
316316

317317
aboutLibraries {
318318
// Fetch full license text + funding info from GitHub API when on CI with a token
319-
val isCi = providers.gradleProperty("ci").map { it.toBoolean() }.getOrElse(false)
319+
val isCi =
320+
providers
321+
.gradleProperty("ci")
322+
.map { it.toBoolean() }
323+
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
320324
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
321325
collect {
322326
fetchRemoteLicense = isCi && ghToken.isPresent
@@ -334,3 +338,9 @@ aboutLibraries {
334338
duplicationRule = DuplicateRule.SIMPLE
335339
}
336340
}
341+
342+
// Ensure aboutlibraries.json is always up-to-date during the build.
343+
// This is required since AboutLibraries v11+ no longer auto-exports.
344+
tasks
345+
.matching { it.name.startsWith("process") && it.name.endsWith("Resources") }
346+
.configureEach { dependsOn("exportLibraryDefinitions") }

build-logic/convention/src/main/kotlin/AnalyticsConventionPlugin.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,10 @@ class AnalyticsConventionPlugin : Plugin<Project> {
6666

6767
plugins.withId("com.datadoghq.dd-sdk-android-gradle-plugin") {
6868
tasks.configureEach {
69-
if ((name.contains("datadog", ignoreCase = true) || name.contains("uploadMapping", ignoreCase = true)) && name.contains("fdroid", ignoreCase = true)) {
69+
if ((name.contains("datadog", ignoreCase = true) ||
70+
name.contains("uploadMapping", ignoreCase = true) ||
71+
name.contains("buildId", ignoreCase = true)) &&
72+
name.contains("fdroid", ignoreCase = true)) {
7073
enabled = false
7174
}
7275
}

desktop/build.gradle.kts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,11 @@ dependencies {
194194

195195
aboutLibraries {
196196
// Fetch full license text + funding info from GitHub API when on CI with a token
197-
val isCi = providers.gradleProperty("ci").map { it.toBoolean() }.getOrElse(false)
197+
val isCi =
198+
providers
199+
.gradleProperty("ci")
200+
.map { it.toBoolean() }
201+
.getOrElse(providers.environmentVariable("CI").map { it.toBoolean() }.getOrElse(false))
198202
val ghToken = providers.environmentVariable("GITHUB_TOKEN")
199203
collect {
200204
fetchRemoteLicense = isCi && ghToken.isPresent
@@ -212,3 +216,7 @@ aboutLibraries {
212216
duplicationRule = DuplicateRule.SIMPLE
213217
}
214218
}
219+
220+
// Ensure aboutlibraries.json is always up-to-date during the build.
221+
// This is required since AboutLibraries v11+ no longer auto-exports.
222+
tasks.named("processResources") { dependsOn("exportLibraryDefinitions") }

0 commit comments

Comments
 (0)