Skip to content
This repository was archived by the owner on Feb 4, 2025. It is now read-only.

[Dependency Analysis] Add Android Gradle Plugin #3063

Merged
merged 5 commits into from
Jul 25, 2024

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Jul 24, 2024

Project Thread: paaHJt-6yU-p2
Required By: BuildkiteCI#484
Depends On:

This PR adds the dependency analysis Android Gradle plugin to this project, for dependency analysis purposes.

Description

For now, only the main buildHealth task is going to be utilized and produce data once every week on CI (see this commit and this PR). Amongst other, this data will include the following:

  • Number of modules (projectCount)
  • Unused dependencies which should be removed (unusedCount)
  • Transitive dependencies which should be declared directly (undeclaredCount)
  • Existing dependencies which should be modified to be as indicated (misDeclaredCount)
  • Dependencies which could be compile-only (compileOnlyCount)
  • Dependencies which should be removed or changed to runtime-only (runtimeOnlyCount)

Afterward, this data will get collected from CI and uploaded to our Apps Metrics infrastructure, for visualization and alerting purposes.

Testing Steps

  1. Local: Run the ./gradlew buildHealth task and verify that under the root level build/reports/dependency-analysis folder you get the below 2 reports both, in JSON and text format:
    • build-health-report.json
    • build-health-report.txt
  2. CI: Using the New Build 🟢 CI button for FluxC, test this standalone dependency analysis job (see form below). Then:
    • When CI starts, make sure that adding /meta-data to that CI build's URL (example) will give you one extra meta-data, the pipeline_file one, with a value of schedules/dependency-analysis.yml (see screenshot below):
    • When CI completes, make sure that the below 2 CI artifacts are available both, in JSON and text format:
      • build/reports/dependency-analysis/build-health-report.json
      • build/reports/dependency-analysis/build-health-report.txt
  3. REST: Using the Buildkite's REST API you could query for this type of builds, using the meta-data query parameter, and see that the result is the expect one. Use this query: https://api.buildkite.com/v2/organizations/automattic/pipelines/wordpress-fluxc-android/builds?meta_data[pipeline_file]=schedules/dependency-analysis.yml

image

image

ParaskP7 added 3 commits July 24, 2024 17:28
FYI: This change was done for testing purposes and until the below
'Android Dependency Catalog' #32 PR gets merged to 'trunk'. When that's
done, the 'catalogVersion' will be updated to '1.19.0' instead.

------------------------------------------------------------------------

Android Dependency Catalog PR: [Migrate] [Dependency Analysis] Add
Android Gradle Plugin #31
- Automattic/android-dependency-catalog#31

------------------------------------------------------------------------

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)
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.
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.
@ParaskP7 ParaskP7 marked this pull request as ready for review July 24, 2024 14:48
@ParaskP7 ParaskP7 requested a review from wzieba July 24, 2024 14:48
@ParaskP7 ParaskP7 merged commit e88dbd6 into trunk Jul 25, 2024
13 checks passed
@ParaskP7 ParaskP7 deleted the build/dependency-analysis-android-gradle-plugin branch July 25, 2024 07:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants