Closed Bug 1913480 Opened 1 year ago Closed 1 year ago

Update AGP to version 8.6.0

Categories

(Firefox Build System :: Android Studio and Gradle Integration, task)

task

Tracking

(firefox132 fixed)

RESOLVED FIXED
132 Branch
Tracking Status
firefox132 --- fixed

People

(Reporter: RyanVM, Assigned: RyanVM)

References

Details

Attachments

(4 files)

I've done a bit of poking at updating from AGP 8.4 to AGP 8.5, but we're hitting a NPE during the GeckoView part of the build that I haven't been able to investigate. Now that this is blocking bug 1906365, we probably need another set of eyes on it.

https://treeherder.mozilla.org/logviewer?job_id=470327063&repo=try&lineNumber=3082

> Task :geckoview:compileWithGeckoBinariesDebugJavaWithJavac
Note: Some input files use or override a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
> Task :geckoview:bundleLibRuntimeToJarWithGeckoBinariesDebug
> Task :geckoview:generateJNIWrappersForGeneratedWithGeckoBinariesDebug FAILED
FAILURE: Build failed with an exception.
* Where:
Script '/builds/worker/workspace/build/src/mobile/android/gradle/with_gecko_binaries.gradle' line: 54
* What went wrong:
Execution failed for task ':geckoview:generateJNIWrappersForGeneratedWithGeckoBinariesDebug'.
> java.lang.NullPointerException (no error message)
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.
Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.
BUILD FAILED in 2m 58s

I'll attach the WIP patches.

Per https://issuetracker.google.com/issues/352722605. Removing the lines
completely caused the test to fail, but setting to DEFAULT works.

See Also: → 1912363
Summary: Update AGP to version 8.5.2 → Update AGP to version 8.6.0
Attachment #9419410 - Attachment description: WIP: Bug 1913480 - Update AGP to version 8.5.2. → WIP: Bug 1913480 - Update AGP to version 8.6.0.

I took a look at the NullPointerException in with_gecko_binaries.gradle: it seems that variant.javaCompileProvider.get().classpath.from indeed contains a null (is that an AGP bug?). Calling classpath.from(variant.javaCompileProvider.get().classpath) eventually calls ImmutableList.Builder<Object>.add(null) which asserts (IMO Gradle should either disallow nulls earlier when populating ConfigurableFileCollections, or allow nulls here too).

This works around the issue:

 doFirst {
-    classpath variant.javaCompileProvider.get().classpath
+    classpath variant.javaCompileProvider.get().classpath.files
 }

Note that this is what we already do in geckoview/build.gradle#281.

I've launched a Try build with this at https://treeherder.mozilla.org/jobs?repo=try&revision=f7c3851031f3b56af9ae4e037d8ce068caf2c518. It hasn't failed so far.

Nice find!

Assignee: nobody → ryanvm
Attachment #9419409 - Attachment description: WIP: Bug 1913480 - Use the dependencies plugin for Fenix mozilla-lint-rules. → Bug 1913480 - Use the dependencies plugin for Fenix mozilla-lint-rules.
Status: NEW → ASSIGNED
Attachment #9419410 - Attachment description: WIP: Bug 1913480 - Update AGP to version 8.6.0. → Bug 1913480 - Update AGP to version 8.6.0.
Attachment #9419411 - Attachment description: WIP: Bug 1913480 - Use TestMode.DEFAULT instead of TestMode.UI_INJECTION_HOST. → Bug 1913480 - Use TestMode.DEFAULT instead of TestMode.UI_INJECTION_HOST.
Attachment #9422118 - Attachment description: Bug 1913480 - Update lint baselines. → Bug 1913480 - Address some new lint issues and update baselines.
Pushed by rvandermeulen@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6211d4d7d9da Use the dependencies plugin for Fenix mozilla-lint-rules. r=android-reviewers,mcarare https://hg.mozilla.org/integration/autoland/rev/553e602078db Update AGP to version 8.6.0. r=geckoview-reviewers,android-reviewers,mcarare,ohall https://hg.mozilla.org/integration/autoland/rev/cf8566ff2f8c Use TestMode.DEFAULT instead of TestMode.UI_INJECTION_HOST. r=android-reviewers,mcarare https://hg.mozilla.org/integration/autoland/rev/fa82550a0b9e Address some new lint issues and update baselines. r=android-reviewers,mcarare

Is there a chance that these patches affected the runtime behavior of Fenix? We're seeing a 25% improvement on cold_view_nav_start startup time and it seems to have been caused by this push:
https://treeherder.mozilla.org/perfherder/graphs?highlightAlerts=1&highlightChangelogData=1&highlightCommonAlerts=0&replicates=0&series=autoland,4677531,1,15&timerange=2592000&zoom=1725449005001,1725449745633,1296.5752405809328,1606.1430059964293

Flags: needinfo?(ryanvm)

Maybe from an updated D8/R8? Below is a list of changes that went into it in case anything stands out.
https://developer.android.com/studio/releases/fixed-bugs/studio/2024.1.2

Flags: needinfo?(ryanvm)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: