Skip to content

Conversation

@freakboy3742
Copy link
Member

An alternate approach to #271.

Instead of pre-emptively deleting Android NDK (and other) content, clean up builds and other caches after each build. Docker builds were already being cleaned up; this gives another layer of cleanup.

PR Checklist:

  • All new features have been tested
  • All new features have been documented
  • I have read the CONTRIBUTING.md file
  • I will abide by the code of conduct

@freakboy3742
Copy link
Member Author

Based on this part of the log, it looks like we pull back 3.8GB just by cleaning up Flatpak.

@freakboy3742 freakboy3742 marked this pull request as ready for review December 4, 2025 04:26
@freakboy3742 freakboy3742 requested a review from mhsmith December 4, 2025 04:33
@rmartin16
Copy link
Member

rmartin16 commented Dec 4, 2025

As an extension of this idea, I don't think much of ~/.cache/briefcase is shared between target platform builds....but some platforms download quite a bit for the build.

[edit] and wherever the android emulator gets downloaded

@freakboy3742
Copy link
Member Author

As an extension of this idea, I don't think much of ~/.cache/briefcase is shared between target platform builds....but some platforms download quite a bit for the build.

[edit] and wherever the android emulator gets downloaded

True...

We seem to have avoided the immediate problem right now; perhaps it might be worth turning this into a feature on Briefcase? We've had a suggestion of a briefcase clean command in the past; with some additional flags to hit caches and other resources, it would save us from needing to hard-code specifics into this workflow.

@mhsmith mhsmith merged commit 0e47df6 into main Dec 4, 2025
145 of 146 checks passed
@mhsmith mhsmith deleted the optimize-cleanup branch December 4, 2025 09:21
@freakboy3742
Copy link
Member Author

beeware/briefcase#1859 is already tracking the "clean" idea; I've added more details there.

@mhsmith
Copy link
Member

mhsmith commented Dec 24, 2025

There's been at least 1 failure in this cleanup on Android:

+ rm -rf build dist
rm: cannot remove 'build/verifyapp/android/gradle/app/build/intermediates/dex/release/mergeDexRelease/classes.dex': Device or resource busy
Error: Process completed with exit code 1.

This will be because the Gradle daemon is still running, and has open references to some of the files we're trying to delete. If this happens again, it can probably be worked around by adding something like this before the rm:

cd build/*/android/gradle
./gradlew --stop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants