briefcase icon indicating copy to clipboard operation
briefcase copied to clipboard

Allow excluding files and folders from the build

Open dominickj-tdi opened this issue 3 years ago • 2 comments

I'd like for there to be a way to exclude files and folders from the final application build. I have a number of files in the src folder which are only needed for development and not on clients actually running the application.

A simple excludes parameter in the pyproject.toml would be ideal. something like this:

[tool.briefcase.app.myapp]
formal_name = "My App"
description = "My App"
icon = "src/myapp/client/resources/client"
sources = ['src/myapp']
sources_exclude = [
    '*.ui',
    '*.xcf',
    '*.qrc',
    'src/myapp/server',
    'src/myapp/tests',
    '**/__pycache__']

I need to keep these files in the source tree for development, but packaging them up with the application doesn't really do any good, and just means extra data to send over the network and store on everyone's hard drives.

As an extra bonus, it would also be nice to have a minify option for all the Python source files as well, but that's a separate issue.

dominickj-tdi avatar Dec 31 '20 22:12 dominickj-tdi

Completely agreed that the packaged app should only include the files that are required for it to run. My only question is about the "spelling" of the feature, and how values in the exclude list are interpreted. Keeping consistency with conventions like .gitignore files would be a good starting point here.

It would also be interesting to see how this could potentially interact with #215, which is another feature request related to minimising packaged size. An "exclude" list that operates on the level of the packaged app could be potentially interesting.

freakboy3742 avatar Jan 02 '21 05:01 freakboy3742

Yes, that was more or less my intent to use a syntax similar to .gitignore. The main difference was that I left off the trailing slash from directories in my example above to make it consistent with with the sources parameter, which based on the documentation doesn't seem to use a trailing slash. Beyond that, I'd be in favor of copying the .gitignore syntax entirely, just because most developers would already be familiar with that syntax.

dominickj-tdi avatar Jan 04 '21 18:01 dominickj-tdi