-
-
Notifications
You must be signed in to change notification settings - Fork 476
Description
Describe the bug
If you run a command such as open, build, or create with the -a option, all apps are finalized, rather than just the app being operated on.
This results in the finalization of configurations that aren't being used. This isn't a huge problem, but it is unnecessary processing.
Steps to reproduce
- Generate an empty project configuration for an app with a formal name of
App 1 - Add the following to the bottom of the generated
pyproject.toml:
[tool.briefcase.app.app2]
formal_name = "App2"
description = "My second application"
long_description = """More details about the app should go here.
"""
sources = [
"src/app2",
]
external_package_path = "something"
- Duplicate the app content. From the same directory as
pyproject.toml, run:
cp -r src/app1 src/app2
(or the windows equivalent, duplicating src/app1 as src/app2
4. Run briefcase create -a app1.
5. See Error:
Briefcase configuration error: 'app2' is declared as an external app, but also defines 'sources'. External apps (apps defining 'external_package_path') cannot define sources.
This is flagging a valid configuration error in app2; but given that the command is only running app1, this validation should not be performed.
Expected behavior
Finalization for app2 should not be executed when specifying -a app1.
Screenshots
No response
Environment
- Operating System: All
- Python version: All
- Software versions:
- Briefcase: 0.3.26+
Logs
Additional context
The issue is caused by the sequence of operations for finalize() in the base command. It currently takes a single AppConfig or None; If None is provided, all apps are finalized.
finalize() is invoked passing in an app argument if it is provided - but when -a is used, the app argument will be None, and app_name contains the actual app name.
finalize() should be modified to require a list of AppConfig objects (and not accept None). The updated finalize() command should then be invoked after the list of apps to be processed has been confirmed.
In cases where there is no list of apps (such as new), an empty list should be passed to finalize(); if there can only be one app (e.g., run), a list of one item should be passed.