[Feature Request]: Integrate Dagger into scripts #5314
Labels
enhancement
End user-perceivable enhancements.
Impact: Medium
Moderate perceived user impact (non-blocking bugs and general improvements).
Work: Medium
The means to find the solution is clear, but it isn't at good-first-issue level yet.
Is your feature request related to a problem? Please describe.
This has been something I've been thinking about for a while. Testing scripts can be awkward since replacing dependencies usually requires wrapping the script logic in a class and then directly constructing that class (vs. using the script's main function). This creates potential disparity with production uses of the script, and is inconsistent with how dependencies are swapped out elsewhere in the codebase.
Describe the solution you'd like
We should be able to set up a script component in Dagger that operates much the same way as the app's application component (though without binding to an Android application since scripts run on JVM). Similarly, we can also then create test components with test-only modules for overriding low-level utilities, as needed.
This will also help with ensuring test hermeticity since currently tests will try to access network resources (though some still will, to an extent, due to script tests relying on Bazel in the local environment).
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: