Only run sdkmanager --list_installed when creating a log file
Currently we run sdkmanager --list_installed within verify_tools in every Briefcase Android command. But this takes at least 1.5 seconds to run on my machine, even in the relatively small SDKs generated by Briefcase itself. When using a user-provided SDK which is affected by this issue, it can take more than 10 seconds.
Since the purpose of this command is to provide information to help diagnose a failure, I've changed it to only run when creating a log file.
PR Checklist:
- [x] All new features have been tested
- [x] All new features have been documented
- [x] I have read the CONTRIBUTING.md file
- [x] I will abide by the code of conduct
Codecov Report
Merging #832 (a2ee22e) into main (d4dc16d) will increase coverage by
0.13%. The diff coverage is100.00%.
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/briefcase/integrations/android_sdk.py | 99.09% <ø> (-0.01%) |
:arrow_down: |
| src/briefcase/commands/base.py | 98.11% <100.00%> (+0.01%) |
:arrow_up: |
| src/briefcase/console.py | 100.00% <100.00%> (ø) |
|
| src/briefcase/platforms/android/gradle.py | 97.14% <100.00%> (+3.93%) |
:arrow_up: |
Thanks, your changes all look good.
using a single log instance, and passing that through the calls, rather than capturing the log after it has been re-created.
Agreed, and the same is true of the AndroidSDK object, which is currently instantiated multiple times if Briefcase does multiple build / update / run sub-commands. The AndroidSDK currently uses self.command to access various lower-level services like the logger. Refactoring it to bypass the command object and access these things directly would be quite disruptive, so it might be easier to just make sure that there's a single AndroidSDK instance with a reference to the top-level command object.