-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attempting to move build_app.jl code into a function inside ApplicationBuilder. #9
Conversation
So, this change breaks things. Basically, the problem comes from mixing two services in the same Module: providing runtime code for the built applications to call ( More specifically, the problem is that, after this change, the
|
These are some solutions I can think of:
My gut says either the separate Modules or separate Packages solutions are probably best? |
Sorry I cannot provide a good contribution on this as I do not have enough experience with |
Ah, no, sorry, this is unrelated to #4. In the current state of this PR (273ea73), the problem is as follows:
I'm not sure why that fails, but it shouldn't really matter -- there's no reason for the user's application code to be running Does that make more sense? |
Right, I understand now. Does this happen to be same issue? Sorry, I made a mistake copying the right link in the previous comment. |
Ah, sorry, yes it's exactly what you described here:
You explained it much more succinctly than me. :) |
So, I've gone ahead and tried solution number 4 above, and that did fix things. (I think the test failure was just a flake; i'm retrying it now.) It's here in this commit i just pushed: 7f246bd Does it seem overly complicated to you? It prevents exactly the cycle you described in your link. The tests all pass locally now. :) |
Pull Request Test Coverage Report for Build 45
💛 - Coveralls |
# Can find the code's path from what the full_binary_name ends in. | ||
m = match(r".app/Contents/MacOS/[^/]+$", full_binary_name) | ||
if m != nothing | ||
resources_dir = joinpath(dirname(dirname(full_binary_name)), "Resources") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I was wondering if you wanted to set the default path to the Resources directory or straight to the bundle root, so now the user would have to specify paths to libraries by "Libraries/..."
instead of "../Libraries/...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah i think that makes lots of sense. Want to discuss that in a separate thread?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here: #10
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, wherever you prefer. :-) I do this by default in #7 because it makes things convenient.
src/BuildApp.jl
Outdated
|
||
include("sign_mac_app.jl") | ||
|
||
function build_app_bundle(parsed_args) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was wondering if build_app_bundle
could be of a similar API as described in #7. Since the user is primarily going to be interacting with this function, perhaps it would be nice if he can specify an array of paths to libraries and array of paths to resources. What do you think? :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, absolutely. This commit was just the first step (the PR was work-in-progress). Sorry that wasn't clear!
I was just specifically hoping to get your feedback on splitting the Modules.
That said, i've just pushed up a commit that makes this cleaner!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah, let me make the resources
and libraries
args a bit nicer, like the way you have them.
Otherwise, I think the API looks like you have it in #7 now? Yes, the goal of this PR was exactly that, to make the API match what you had in #7 so that the windows and mac versions could be the same, since I agree the API as you have it is the nicest! :)
I think Solution 4 is the best too. Forgive me, but could I clarify one thing? With this solution, are you saying that the build script would look like this: using ApplicationBundler
libs = [...]
res = [...]
build_app_bundle("path/to/script_to_be_compiled.jl", libraries = libs, resources = res) and the function Base.@ccallable julia_main(ARGS)
ApplicationBundler.Utils.chdir_if_bundle()
...
end ? Do I understand correctly? |
Okay great. Thanks! That's how it is now.
Yes, almost exactly. The only modification to your example is that for the build-script, That's how it looks now: ApplicationBuilder.jl/build_app.jl Line 1 in 14fae3e
|
And the application code is exactly as you have it: ApplicationBuilder.jl/examples/hello.jl Lines 4 to 5 in 14fae3e
|
Oh I see. So you're saying that if we put |
e99d3f0
to
4f6df98
Compare
Haha yep that's exactly it! Does that make sense? It feels sort of hacky... but idk it's only for the build-script so maybe that's not too terrible? There doesn't seem to be any other way to group together related modules in a single package. I think this isn't bad -- at least for now! :) Although, just for clarity, I just thought it was clearer to put |
For sure, I agree. 👍 I think this PR looks good now, I shall refactor #7 to do the same. |
!! thanks! :) You should be able to refactor off of this branch. Actually, if you think it's okay now, do you want me to go ahead and merge then? |
EDIT: |
Go ahead and merge, once tests pass. No, I think the package can stay as |
Okay thanks i will. I'm copying your comment over to #11 as well. Sorry! |
Add a new submodule (`App`) for "runtime" utilities needed by applications built through this package. This is in prepration for moving the body of build_app.jl inside the main ApplicationBuilder module.
(This is a simple copy/paste with no modifications.)
The runtime utilities for user application code will be evaluated in the top-level module, and build-time code in a separate module. This prevents build-time code from being evaluated during compilation of the user application code, accidentally.
Make all the args explicit, with well defined defaults, and change build_app.jl to simply parse user args and then pipe them to `BuildApp.build_app_bundle(juliaprog_main; parsed_args...)`.
Renames `test/examples.jl` to `test/build_app-cli.jl` since it's testing the actual command line interface to the code. Changes the test file to `include` the code instead of spawn a child process to calculate more accurate coverage info.
test/examples.jl -> test/BuildApp.jl and test/build_app-cli.jl
4f6df98
to
93cc079
Compare
93cc079
to
2e90268
Compare
Codecov Report
@@ Coverage Diff @@
## master #9 +/- ##
===========================================
+ Coverage 20% 72.41% +52.41%
===========================================
Files 1 3 +2
Lines 10 116 +106
===========================================
+ Hits 2 84 +82
- Misses 8 32 +24
Continue to review full report at Codecov.
|
Rebased and merged! :) (look at that Coverage bump! haha wooot) |
We should eventually also probably split this into a bunch of smaller functions, since that will make probably make swapping out the different OS functionality easier.. but that is a task for the future! :p EDIT: |
No description provided.