Use BuildService to fetch adb path instead of caching in a companion object#274
Open
DanielJette wants to merge 5 commits intomainfrom
Open
Use BuildService to fetch adb path instead of caching in a companion object#274DanielJette wants to merge 5 commits intomainfrom
DanielJette wants to merge 5 commits intomainfrom
Conversation
e77bdf3 to
4e9ad1b
Compare
…and path while preserving gradle configuration caching
b900551 to
5cd5608
Compare
Contributor
Author
|
cc @dfabulich |
AndroidTestifyBot
approved these changes
Feb 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change accomplish?
This change refactors the way ADB is initialized and managed within the Testify Gradle plugin. It introduces a Gradle Build Service to handle ADB-related properties, aiming to improve build performance, support build caching, and enhance compatibility with Gradle's configuration avoidance.
How have you achieved it?
A new
AdbServiceclass has been introduced as a GradleBuildService. This service is responsible for providing the ADB executable path, verbosity settings, forced user, and device target index to other components of the plugin.The
Adbclass has been refactored to remove its staticinit()method and now takes an instance ofAdbServicein its constructor. This dependency injection ensures thatAdbinstances consistently use the properties provided by theBuildService.All relevant Testify Gradle tasks (e.g.,
ScreenshotClearTask,ScreenshotPullTask,ScreenshotTestTask,DeviceKeyTask,DevicesTask,LocaleTask,TimeZoneTask) and internal utility functions (Device,DeviceUtilities) have been updated to obtain and utilize theAdbServicevia their respectiveTestifyDefaultTasksuperclass. This ensures that all ADB interactions leverage the new service-based approach.The unit tests for
AdbTesthave been updated to reflect and verify the newAdbServiceinjection mechanism.Scope of Impact and Testing instructions
This is a significant internal refactoring of the Testify Gradle plugin's core ADB interaction layer. While the public API and task behaviors are intended to remain unchanged, the underlying implementation has been substantially altered.
Impact:
Testing Instructions:
./gradlew :Plugin:test)../gradlew FlixSample:screenshotRecord(to record baselines)./gradlew FlixSample:screenshotTest(to compare screenshots against baselines)./gradlew FlixSample:screenshotPull(to pull failed screenshots)./gradlew FlixSample:screenshotClear(to clear failed screenshots)./gradlew FlixSample:testifyDeviceKey,./gradlew FlixSample:testifyDevices,./gradlew FlixSample:testifyLocale,./gradlew FlixSample:testifyTimeZonefunction correctly and display the expected information.AdbServicecorrectly retrieves the ADB path and device information.Notice
Warning
This change must keep
mainin a shippable state; it may be shipped without further notice.