Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dependency Analysis] Add Android Gradle Plugin #21022

Merged
merged 3 commits into from
Jul 1, 2024

Conversation

ParaskP7
Copy link
Contributor

@ParaskP7 ParaskP7 commented Jun 28, 2024

Project Thread: paaHJt-6yU-p2
Required By: BuildkiteCI#456

This PR adds the dependency analysis Android Gradle plugin to this project, for dependency analysis purposes. Also, a custom meta-data is added to the dependency analysis scheduled build so that it can be easily queried via Buildkite's REST API.


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.


To Test:

  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 WPAndroid, 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 schedule-build one, with a value of dependency-analysis (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-android/builds?meta_data[scheduled-build]=dependency-analysis

image

image


Regression Notes: (N/A)


PR Submission Checklist:

  • I have completed the Regression Notes.
  • I have considered adding accessibility improvements for my changes.
  • I have considered if this change warrants user-facing release notes and have added them to RELEASE-NOTES.txt if necessary.

Testing Checklist (strike-out the not-applying and unnecessary ones): N/A

ParaskP7 added 3 commits June 28, 2024 12:32
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)
This commit updates the encrypted 'gradle.properties.enc' file to point
to that pinned hash which has the
'dependency.analysis.android.ignored.variants'
property added into the 'gradle.properties' file for the WPAndroid
project.

FYI: With this configuration only the 'debug' variant (build type) for
the lib modules and 'wordpressJalapenoDebug' + 'jetpackJalapenoDebug'
variants (product flavor + build type) for the app module 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.
3. This job has added custom meta-data for dependency analysis purposes.
This is done in order for it to be queried and easily identifiable
amongst other builds when working with the Buildkite's REST API.
Copy link

sonarcloud bot commented Jun 28, 2024

@wpmobilebot
Copy link
Contributor

Jetpack📲 You can test the changes from this Pull Request in Jetpack by scanning the QR code below to install the corresponding build.
App NameJetpack Jetpack
FlavorJalapeno
Build TypeDebug
Versionpr21022-65e421a
Commit65e421a
Direct Downloadjetpack-prototype-build-pr21022-65e421a.apk
Note: Google Login is not supported on these builds.

@wpmobilebot
Copy link
Contributor

WordPress📲 You can test the changes from this Pull Request in WordPress by scanning the QR code below to install the corresponding build.
App NameWordPress WordPress
FlavorJalapeno
Build TypeDebug
Versionpr21022-65e421a
Commit65e421a
Direct Downloadwordpress-prototype-build-pr21022-65e421a.apk
Note: Google Login is not supported on these builds.

@ParaskP7 ParaskP7 marked this pull request as ready for review June 28, 2024 12:00
@ParaskP7 ParaskP7 requested review from wzieba and AliSoftware June 28, 2024 12:00
@ParaskP7 ParaskP7 merged commit 905a57b into trunk Jul 1, 2024
23 checks passed
@ParaskP7 ParaskP7 deleted the build/dependency-analysis-android-gradle-plugin-v2 branch July 1, 2024 09:00
@ParaskP7 ParaskP7 added this to the Future milestone Jul 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants