From 6bfe66faa36c5d86b51ed950ac2b49b2c1f1a960 Mon Sep 17 00:00:00 2001 From: Petros Paraskevopoulos Date: Fri, 5 Jul 2024 16:08:54 +0300 Subject: [PATCH 1/3] Build: Add dependency analysis plugin FYI: This commit adds a previous version of the plugin (1.28.0) and not the latest version (1.32.0). This is because the latest version gets stuck during the 'computeActualUsage' phase and increases the build time of the 'buildHealth' task by as much as five times (5x). For more info see: Stuck in computeActualUsageDebug for many minutes #1186 (https://github.com/autonomousapps/ dependency-analysis-gradle-plugin/issues/1186) --- build.gradle | 1 + settings.gradle | 2 ++ 2 files changed, 3 insertions(+) diff --git a/build.gradle b/build.gradle index 40cfc26..8e016e5 100644 --- a/build.gradle +++ b/build.gradle @@ -7,6 +7,7 @@ plugins { id 'org.jetbrains.kotlin.android' apply false id 'dagger.hilt.android.plugin' apply false id "com.automattic.android.publish-to-s3" apply false + id "com.autonomousapps.dependency-analysis" } allprojects { diff --git a/settings.gradle b/settings.gradle index 13c1eac..7b2898d 100644 --- a/settings.gradle +++ b/settings.gradle @@ -4,6 +4,7 @@ pluginManagement { gradle.ext.agpVersion = '8.1.0' gradle.ext.detektVersion = '1.19.0' gradle.ext.automatticPublishToS3Version = '0.8.0' + gradle.ext.dependencyAnalysisVersion = '1.28.0' plugins { id 'io.gitlab.arturbosch.detekt' version gradle.ext.detektVersion @@ -15,6 +16,7 @@ pluginManagement { id "com.android.library" version gradle.ext.agpVersion id 'dagger.hilt.android.plugin' id "com.automattic.android.publish-to-s3" version gradle.ext.automatticPublishToS3Version + id "com.autonomousapps.dependency-analysis" version gradle.ext.dependencyAnalysisVersion } repositories { maven { From 78fdefc5a2bddb9a7a6a8eb95b5030e163a13d76 Mon Sep 17 00:00:00 2001 From: Petros Paraskevopoulos Date: Fri, 5 Jul 2024 16:29:10 +0300 Subject: [PATCH 2/3] Build: Ignored variants configuration for dependency analysis plugin FYI: With this configuration only the 'debug' variant (build type) for for all modules is going to be included, with the rest of the variants ignored. --- gradle.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gradle.properties b/gradle.properties index b8e2697..e309368 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,3 +8,6 @@ android.useAndroidX=true android.enableJetifier=false android.nonTransitiveRClass=true + +# Dependency Analysis Plugin +dependency.analysis.android.ignored.variants=release From 467ab92d380e34be08f033bd3111203b7c64d6bd Mon Sep 17 00:00:00 2001 From: Petros Paraskevopoulos Date: Fri, 5 Jul 2024 16:32:24 +0300 Subject: [PATCH 3/3] CI: Add a scheduled dependency analysis job FYI: 1. This job will be then used by 'buildkite-ci' and configured as a 'buildkite_pipeline_schedule' with a weekly frequently. 2. This job will also notify on the android-core-notifs slack channel on a build failure. --- .buildkite/schedules/dependency-analysis.yml | 22 ++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .buildkite/schedules/dependency-analysis.yml diff --git a/.buildkite/schedules/dependency-analysis.yml b/.buildkite/schedules/dependency-analysis.yml new file mode 100644 index 0000000..d9cd9e8 --- /dev/null +++ b/.buildkite/schedules/dependency-analysis.yml @@ -0,0 +1,22 @@ +# yaml-language-server: $schema=https://raw.githubusercontent.com/buildkite/pipeline-schema/main/schema.json +--- + +common_params: + # Common plugin settings to use with the `plugins` key. + - &common_plugins + - automattic/a8c-ci-toolkit#2.15.0 + +agents: + queue: "android" + +steps: + - label: "dependency analysis" + command: | + echo "--- 📊 Analyzing" + ./gradlew buildHealth + plugins: *common_plugins + artifact_paths: + - "build/reports/dependency-analysis/build-health-report.*" + notify: + - slack: "#android-core-notifs" + if: build.state == "failed"