PeaceFounder / AppBundler.jl

Bundle your Julia application
MIT License
58 stars 3 forks source link

Suggestions on AppBundler #2

Open mpeters2 opened 10 months ago

mpeters2 commented 10 months ago

First off, I want to say "thank-you" for doing this. Appbundler.jl seems like a huge step for the Julia community: being able to distribute double-clickable applications is a big deal, and without this tool, I wouldn't know where to begin to start tackling this issue. The fact that you've tried to do this for MacOS, Windows, and Linux is even more impressive!

I realize that this is not the final polished version, and it is really a first draft, but I wanted to give some feedback on the documentation that would allow Appbundler to be more accessible to the Julia community at large.

1) Could you explain the recipes in more detail? What are they for? How do they work? When should I use them, and how do I use them?

2) I found this example confusing: "bundle_app(MacOS(:x86_64), APP_DIR, "$BUILD_DIR/gtkapp-x64.app")". I'm no MacOS/Unix command-line expert (I'm guessing most of the incoming Julia users are not), but when I read this, I assumed the $BUILD_DIR was some sort of special variable. I initially tried something like this:

AppBundler.bundle_app(MacOS(:aarch64), "/Users/…/Development/AppBuilderVersion/Trichromacy", "$BUILD_DIR/Trichromacy.app")

…and got this as an error:

ERROR: UndefVarError: `BUILD_DIR` not defined`

Of course, this works:

AppBundler.bundle_app(MacOS(:aarch64), "/Users/…/Development/Trichromacy/AppBuilderVersion/Trichromacy", "/Users/…/Development/Trichromacy/AppBuilderVersion/Trichromacy.app")

Is $BUILD_DIR a variable that we should know about? Is it part of AppBundler, but isn't working for some reason? If not, maybe it would be easier to show an example like this:

AppBundler.bundle_app(MacOS(:aarch64), "/Users/…/Development/myAppProject/myApp", "/Users/…/Development/myAppProject/myApp.app")

Take home message: When in doubt, pretend we are dumb!

MacOS

https://www.youtube.com/watch?v=OpR9-onRZko

sudo codesign --verbose --deep --force --sign "MyCertificate" --options runtime --entitlements "/Users/…/Development/myAppProject/myApp.app/Contents/MacOS/Resources/Entitlements.plist" "/Users/…/Development/myAppProject/myApp.app"

Overall, this is a really cool tool! I can't thank you enough for doing this, as I think this has the potential to have a huge effect on the future of Julia outside of academia.

JanisErdmanis commented 10 months ago

The recipe system is used when a bundle for either platform is made. It consists of a list of rules specified within the AppBundler.jl/recipes.jl file for each platform. Each rule specifies its origin and destination. The origin/destination can be directories or files. In case the rule is for a file, additional parameters on whether it is treated as a template and whether it needs to be executable (for Linux and macOS) can be provided.

During the build step of a bundle, the rules are run in sequence. The files are copied from the origin to the destination. If the origin of a rule exists in the meta directory, the files are taken from there; otherwise, the origin for a rule is taken from the AppBundler.jl /recipes folder. When the default path of an origin is unspecified, the rule is skipped.

The last bit in the picture is interfering rules. When a previous rule has already affected the destination, the new rule respects the previous rule and skips merging in a particular file. This is useful for flattening the configuration directory structure while retaining the possibility of following a more hierarchical organisation used by the bundle.

In situations when the bundling does not work for the users, which I would like to hear about, they can modify bundle_app for their needs, which is only 40 lines of code to change, add or remove rules.

Let me know how well you could follow this description so I can consider this explanation as part of the docs. I also improved docs bundle_app and added more information on how one can generate a code signing certificate.

mpeters2 commented 10 months ago

Does that mean that if I do not have a meta folder in my source folder, AppBundler automatically picks the correct recipe from AppBuilder/recipes?

mpeters2 commented 10 months ago

BTW: After AppBundler has matured, I think it would be great if the VSCode team could make it part of the user interface, so that users could click a single button to compile a standalone app.

JanisErdmanis commented 10 months ago

Does that mean that if I do not have a meta folder in my source folder, AppBundler automatically picks the correct recipe from AppBuilder/recipes?

It is more delicate than that. The recipe consists of a list of rules which has origin location. If the origin for the rule exists in the MyApp/meta folder, then it is taken from there. If origin doesn't exist there, the rule is taken from AppBundler.jl/recipes unless it doesn't exist there either, in which case it is skipped. This is done for every recipe rule sequentially.