Status Update
Comments
al...@android.com <al...@android.com> #2
We are currently using AGP internal task types to flag memory-intensive tasks to enforce a reduced parallelism at execution time. I've raised this separately (with a lot more detail) as a feature request (
al...@android.com <al...@android.com>
au...@google.com <au...@google.com> #4
Another use case that we have is to reactively respond to the creation of APKs and AABs. The new AGP APIs allow us to connect out tasks into the artifact pipeline via wiredWith
but the best we can come up with to receive the completed artifact is to wire in toTransform
. This A) does not guarantee that we will receive the final artifact as more transforms may be applied after our task is called, and B) requires us to copy the input property file/dir to our tasks output property file/dir in order to not break the build cache.
The reactive behavior of the above is the complicating factor.
A non-reactive approach could simply depend upon the task name and then look for a hardcoded path in the build directory (which is still sort of gross, since the build output paths are not documented as public API and change from time to time).
Another approach would be to wire a custom task to consume the output of the build via the built artifacts loader feeding an input property. However, this approach cannot be applied reactively. Either the custom task is included in the build and causes the creation of the binary artifact, or it is not included in the build and never gets invoked.
au...@google.com <au...@google.com> #6
We didn't provide a task wiring helper for that case as there's only one thing to wire, but I can see how the inconsistency can be misleading
[Deleted User] <[Deleted User]> #7
WRT variant.artifacts.get(SingleArtifact.APK))
, if the task is included in the build it will cause the creation of the artifact. Our build is currently defined to reactively perform some actions (predominantly some fancy reporting) only if work is actually performed.
We had previously been pushing our build to wire in to task outputs by locating tasks by type and referencing output properties as inputs to tasks registered via task finalizes
or dependsOn
relationships. This started getting more and more fragile as the AGP APIs migration proceeded/matured. I'm to the point now where I think the notion of reactive execution is hostile to the direction/expectations of both Gradle and AGP and want to start moving away from it, yet our build as it currently stands does rely on this behavior.
I bring up this up as a gap only because I don't know if I'll be able to completely refactor our CI pipeline's expectations in time for Gradle 8+.
au...@google.com <au...@google.com> #8
[Deleted User] <[Deleted User]> #9
Another minor functionality gap: We have a build that has test coverage enabled during test execution but then we manually disable the coverage report generation for all project modules as we have a custom coverage report task that creates an aggregate test coverage report for the entire project. This saves us the execution time, I/O, and protects us from Jacoco implementation instabilities.
We're currently using the following to accomplish this:
project.tasks.withType(JacocoReportTask::class.java) {
enabled = false
}
[Deleted User] <[Deleted User]> #10
Another gap, though my perhaps there's a better way to express this? Some of our builds leverage Flank to run instrumentation tests on Firebase Test Lab. These builds run as a single CI stage so as to afford Gradle the best opportunity to parallelize work. In this context, we have found that prioritizing instrumentation test assembly work early in the build allows the tests to dispatch to FTL earlier, minimizing overall build times. To implement this, we have chosen to be explicit on the inverse side by pushing lint and local unit test execution to be shouldRunAfter
the flank tasks which in turn depend on the instrumentation test assembly, etc.
Specifically:
private fun bumpFlankTask(project: Project, flankTasks: TaskCollection<FlankExecutionTask>) {
listOf(AndroidLintTask::class.java, AndroidLintAnalysisTask::class.java, AndroidUnitTest::class.java)
.forEach {
project.tasks.withType(it).configureEach {
shouldRunAfter(flankTasks)
}
}
}
This seems fairly specific to our project's desires and not necessarily transferable to other projects. I think our best option for the future Gradle 9+ might be to fallback to leveraging task names rather than leveraging task types in a generic fashion. Mentioning it here in case there is a better approach/option once the types are no longer available.
al...@android.com <al...@android.com> #11
Another gap we've found but no longer directly depend upon: when invoking BundleToStandaloneApkTask
the resulting universal APK does not appear to be accessible via the Artifacts API / ArtifactType.APK
- at least as of AGP 7.0.
We are able to no longer directly depend upon it because we are using the task name and a hardcoded build output directory path to locate the APK if/when it gets built. This is another symptom of our reactively defined build implementation. However, if we were to relay on
(phew! I think that's it for now? sorry for the dump, we're just starting to get caught up!)
Description
- Samsung gt_i9060i Android 4,4,4
- Samsung SM-G530H Android 4.4.4
- Samsung sm_g361h Android 5.1.1
- Samsung SM-J200F Android 5.1.1
- Samsung sm_g530h
- Condor pgn513 Android 5.1
Fatal Exception: java.lang.ArrayIndexOutOfBoundsException: length=1; index=1
at android.support.v4.widget.ViewDragHelper.saveLastMotion(ViewDragHelper.java:849)
at android.support.v4.widget.ViewDragHelper.shouldInterceptTouchEvent(ViewDragHelper.java:1057)
at android.support.v4.widget.DrawerLayout.onInterceptTouchEvent(DrawerLayout.java:1434)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:1996)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2519)
at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2171)
at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2485)
at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1801)
at android.app.Activity.dispatchTouchEvent(Activity.java:2797)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60)
at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2446)
at android.view.View.dispatchPointerEvent(View.java:8806)
at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4662)
at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4520)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4087)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4053)
at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4190)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4061)
at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4247)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4087)
at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4053)
at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4061)
at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4034)
at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6463)
at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6437)
at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6390)
at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6622)
at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185)
at android.view.InputEventReceiver.nativeConsumeBatchedInputEvents(InputEventReceiver.java)
at android.view.InputEventReceiver.consumeBatchedInputEvents(InputEventReceiver.java:176)
at android.view.ViewRootImpl.doConsumeBatchedInput(ViewRootImpl.java:6581)
at android.view.ViewRootImpl$ConsumeBatchedInputRunnable.run(ViewRootImpl.java:6648)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:800)
at android.view.Choreographer.doCallbacks(Choreographer.java:603)
at android.view.Choreographer.doFrame(Choreographer.java:570)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:786)
at android.os.Handler.handleCallback(Handler.java:815)
at android.os.Handler.dispatchMessage(Handler.java:104)
at android.os.Looper.loop(Looper.java:194)
at android.app.ActivityThread.main(ActivityThread.java:5631)
at java.lang.reflect.Method.invoke(Method.java)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:959)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:754)