beeware / beeware/briefcase

"briefcase clean" command to delete all build artifacts

Open
#1,859 8 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
3.3k
Forks
549
Avg merge
1d 4h
Merged PRs (30d)
40

Description

### What is the problem or limitation you are having?

I opened [a PR for discussion](https://github.com/beeware/briefcase/pull/1830) earlier that jump started a discussion but as i've gone through the workflow a bit more I realized that my quick off the cuff implementation would not have provided the feature i actually want. Here's a concrete explanation of why a `briefcase clean` or similar option be useful to me and why the current situation is a bit rough:

### Situation
I have setup a `macos Xcode` project with `bootstrap create` and then made manual minor modifications to the `project.pbxproj` to get a couple of compile flags in there that i want. i would like to be able to clean up build artifacts but _not_ have to run `briefcase create` all over again.

### My current workflow for cleaning and rebuilding looks something like this:
1. `rm -fr build/illmaticapp/macos/xcode` (not strictly necesssary bc step 2 will do this anyways but illustrative)
1. `briefcase create macos Xcode`
1. `git checkout build/illmaticapp/macos/xcode/Illmatic App.xcodeproj/project.pbxproj` (to get my changes back - i have my customizations stored in version control)
1. `briefcase build macos Xcode`

### Describe the solution you'd like

1. Given that the `.xcodeproj` dir is a product of `briefcase create` I would like an approach to cleaning `build` artifacts that doesn't also blow away the `create` artifacts.
2. Above and beyond that basic functionality ideally `briefcase clean` would also have some kind of intelligence and or optionality around blowing away 3rd party `app_packages` for the various python package / chip architecture combinations because as far as i know those aren't always really "build products" of the app being developed[^1], they're just fixtures downloaded from `pypi` or whatever and avoiding redownloading them would speed things up considerably.

The `build/illmaticapp/macos/xcode` dir has a whole lot of stuff going on though so as a semi-new user it's very unclear to me what should be deleted when i'm trying to delete build artifacts so i end up having to recreate from scratch every time.

### Describe alternatives you've considered

We discussed on [my PR](https://github.com/beeware/briefcase/pull/1830) the possibilities of:
1. `rm -fr build/macos/` (not ideal for reasons outlined above)
1. implement as `briefcase clean macos Xcode` (@freakboy3742's suggestion which is in line with classic hits of the 1970s like `make clean` and makes a lot of sense to me for that reason)
1. implement as `briefcase build macos Xcode --clean` (my original suggestion, which made sense to me as a new user - the first place i was looking for any kind of build cleanup option was by running `briefcase build --help`)

### Additional context

_No response_

[^1]: At least, as far as I know. Briefcase's packaging has worked so well for me that I've never had to look into the details of whate is or isn't happening as far as importing 3rd party packages into the bundle other than this situation, where i'm looking to be absolutely sure no artifacts of previous builds could possibly be interfering / causing problems with the next build.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the existing `briefcase create` and `briefcase build` command entry points, the `build/illmaticapp/macos/xcode` directory, and PR #1830. Determine which contents are build artifacts versus the generated `.xcodeproj` and optional `app_packages`; done means a clean operation removes the intended products without requiring `create` again.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system, cli
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.