beeware / briefcase

Tools to support converting a Python project into a standalone native application.
https://briefcase.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
2.61k stars 366 forks source link

Improve support for bootstrapping a development environment without an active network connection #738

Open freakboy3742 opened 2 years ago

freakboy3742 commented 2 years ago

When you run a briefcase command for the first time, it requires an active network connection, and will download multiple gigabytes of tools. This is particularly bad on macOS/iOS (which require Xcode) and Android (which needs the sdkmanager an associated tools). This is a problem in bandwidth-limited scenarios (like tutorial sessions or conference wifi). It can also be a problem in environments where network access is limited or compromised (e.g., behind aggressive corporate firewalls)

It should be possible to give someone a USB drive populated with files, and bootstrap their briefcase installation.

Describe the solution you'd like

A new command: briefcase bootstrap <platform> <folder>

will inspect <folder>, and install all the tools needed for <platform>. This may not 100% remove the need for network activity, but it should be possible to dramatically lower the initial bandwidth/time requirement.

A parallel command/option will also be required to create the archive folder in the first place (briefcase bootstrap --create <platform> <folder>?)

Describe alternatives you've considered

No real options, other than requiring an active network connection.

Additional context

Support packages and templates can be copied directly from the source folder; it may be desirable to require them to be stored in zip format.

The Android sdkmanager has support for a --package_file argument that can be used to directly install packages from a zip file. It's not clear

There is likely not much we can do about Xcode, as it can't be distributed outside the App Store.

jlgimeno commented 1 year ago

It is possible to download and install the Xcode .xip file if one has an Apple Developer account. I'd say that would be an edge case for the typical briefcase user.

freakboy3742 commented 1 year ago

See #388 for an other issue related to offline operation

mhsmith commented 1 year ago

To build offline for Android, as well as sdkmanager packages, you would also need cached copies of all the necessary Gradle plugins and libraries. I think the only feasible way of doing that would be to actually do a build, and then save a copy of the ~/.gradle directory.

freakboy3742 commented 6 months ago

The code is open source, so you're of course free to fork if you choose... but is there a reason you've chosen to advertise a fork, rather than contribute a pull request?

I'd be more than happy to review a PR implementing an offline mode, and merge that change if/when it passes review - that's why this is an open feature request on the repo.

freakboy3742 commented 6 months ago

For posterity - the fork described here is a non-starter from the perspective of Briefcase as a project. It addresses a very limited subset of bootstrapping, in a way that isn't compatible with the long-term maintenance of Briefcase templates. See the review of the PR for details.