-
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
julia 1.0 support: Merge "build-time" and "run-time" modules BuildApp and App into ApplicationBuilder #18
Conversation
@ranjanan: Hey, can I get your opinion on this if you have a moment? I've split this package up into two, moving the application building stuff out of the parallel Then i've moved all the runtime stuff from I think this makes a lot more sense. What do you think? Thanks!! :D |
Pull Request Test Coverage Report for Build 185
💛 - Coveralls |
7f72198
to
8851ec4
Compare
@NHDaly I've been watching this package from afar. If it were me, I'd just rename the inner module to |
😄 Haha awesome, thanks for dropping in!! :D
Ah, so that's exactly the problem: that's not how it's currently structured even though it should be. Currently (at HEAD), it's the outer module that holds the "runtime utils" ( The reasoning is this:
To rephrase SO what we've done so far is have them as "siblings". That is, the "outer module",
So then, you can now get the runtime utilities by first importing using ApplicationBuilder; using BuildApp But i think that's still not great. First of all, it's non-standard, so here's an understandability drawback. Second, it's brittle: if you flip the order of those
Yeah, so you're right that confusion is my main motivation for splitting it out. It's all the weirdness that I described above, including the name part. Also, the reason I first started doing it was that I had a problem with docstrings not showing up, and someone on slack said this might fix it, but it didn't...
I'm interested in this. What do you mean by that? I'm open to other suggestions for how to proceed. I do think splitting them up is a bit cleaner, but the things I don't like about it are α) that on But I do like that everything becomes more standard, so I'm currently leaning towards this being a good idea. What do you think? :) Thanks for jumping in here with me!! |
@NHDaly, are you not able to implement this way? module ApplicationBuilder
module BuildUtils
...
end
module RuntimeUtils
...
end
end |
Unfortunately no. That's what we had at first, and it causes both submodules to be loaded and compiled when the outer module is imported. I actually can't find any documentation for that behavior in the manual (https://docs.julialang.org/en/release-0.6/manual/modules/), but that seems to be the case based on my simple experimentation. Consider: julia> module Outer
println("compiling Outer")
module A
println("compiling A")
end
module B
println("compiling B")
end
end
compiling Outer
compiling A
compiling B
>> Outer So the problem is that in order for an app to import |
Here's what I'm talking about in the actual code. I've made the change we're talking about here: And this is the failure: julia> using ApplicationBuilder.BuildApp
PARSING (&& COMPILING) ApplicationBuilder
PARSING (&& COMPILING) BuildApp
julia> build_app_bundle("/Users/Daly/.julia/v0.6/ApplicationBuilder/examples/hello.jl")
...
PARSING (&& COMPILING) ApplicationBuilder
PARSING (&& COMPILING) BuildApp
ERROR: LoadError: LoadError: LoadError: LoadError: LoadError: GCC wasn't found. Please make sure that gcc is on the path and run Pkg.build("PackageCompiler")
while loading /Users/daly/.julia/v0.6/PackageCompiler/src/static_julia.jl, in expression starting on line 11
while loading /Users/daly/.julia/v0.6/PackageCompiler/src/PackageCompiler.jl, in expression starting on line 28
while loading /Users/daly/.julia/v0.6/ApplicationBuilder/src/BuildApp.jl, in expression starting on line 5
while loading /Users/daly/.julia/v0.6/ApplicationBuilder/src/ApplicationBuilder.jl, in expression starting on line 16
while loading /Users/Daly/.julia/v0.6/ApplicationBuilder/examples/hello.jl, in expression starting on line 1
ERROR: failed process: Process(`/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia -Cx86-64 -J/Applications/Julia-0.6.app/Contents/Resources/julia
/lib/julia/sys.dylib --compile=yes --depwarn=yes --precompiled=no --compilecache=no --startup-file=no -O3 -g0 --output-o hello.o -e '
empty!(Base.LOAD_CACHE_PATH) # reset / remove any builtin paths
push!(Base.LOAD_CACHE_PATH, "cache_ji_v0.6.4") # enable usage of precompiled files
Sys.__init__(); Base.early_init(); # JULIA_HOME is not defined, initializing manually
include("/Users/Daly/.julia/v0.6/ApplicationBuilder/examples/hello.jl") # include Julia program file
empty!(Base.LOAD_CACHE_PATH) # reset / remove build-system-relative paths'`, ProcessExited(1)) [1] It makes me sooooo sadddddd! :((( |
Okay actually, it turns out that the current approach cannot work in Julia v0.7, because a package cannot modify the So i think i'm going to pull the trigger and merge in this PR!!! :) Reach out to me if you have concerns, but i'm gonna try to do this today before my talk tomorrow! 😂😅😂 |
I don't think I'm quite following all of this (probably because I haven't had time to actually look at the source code itself), but for your reference what I meant by "in a directory under src" was that all of the runtime stuff would just get housed in a directory under src so you'd have something like Again, I haven't really wrapped my head around things here, so feel free to utterly discard, but I figured I should at least clarify what I meant before. |
Thanks a million, @non-Jedi. Yeah, thanks, that does make sense. I played around with that as well, but -- as far as I can tell -- it still doesn't make v0.7 (and/or v1.0) happy. :( So i'm going to play with getting everything to pass as the two separate packages, and if it works out, great! And if in the future, if we figure out a better way to move forward, these can always be re-combined! :) Thanks again! |
73ae7d3
to
beb5a0c
Compare
(jk, I've just gone ahead and pushed up a |
Remove unnecessary split-modules by always performing `change_dir_if_bundle` automatically, and thus removing the need for users to `import ApplicationBuilder` into their programs! :) Fix deprecations/warnings to get up to 1.0 support.
OKAY! Good news: So I've restructured everything, and I think this is going to be the right solution. :) After merging this, we can let it sit for a few days, and then if it looks good, i'll go ahead and officially register it on METADATA! :) SO, here's what we did: This means that we no longer have any "runtime utilities", so we no longer need two separate modules. Therefore, I've moved everything back into Because this is a breaking change from before, I've also added a (15:08:38) julia0.6> using ApplicationBuilder; using BuildApp # BuildApp no longer exists
Warning: ApplicationBuilder has changed a bit since julia 0.6:
- `module BuildApp` has been removed. You should remove `using BuildApp`
from your build scripts to build with julia v0.7.
- You should also remove `using ApplicationBuilder` from the source-code of
programs being built, since the `change_dir_if_bundle` behavior will
now come default for all applications. `using ApplicationBuilder` in
your program source may cause it to fail to build.
This message will be removed in the next version of ApplicationBuilder.
WARNING: Your Julia system image is not compiled natively for this CPU architecture.
Please run `PackageCompiler.force_native_image!()` for optimal Julia performance
ERROR: ArgumentError: Module BuildApp not found in current path.
Run `Pkg.add("BuildApp")` to install the BuildApp package.
Stacktrace:
[1] _require(::Symbol) at ./loading.jl:435
[2] require(::Symbol) at ./loading.jl:405 and (15:11:38) julia0.6> mktemp() do f,_
write(f, """using ApplicationBuilder
Base.@ccallable function julia_main(ARGS::Vector{String})::Cint
ApplicationBuilder.App.change_dir_if_bundle()
println("HELLO!")
return 0
end
""")
build_app_bundle(f);
end
~~~~~~ Creating mac app in "/Users/daly/Documents/developer/code/games/FTLBSG/builddir/tmpvIhINE.app" ~~~~~~~
~~~~~~ Compiling a binary from '/var/folders/5j/c6kd481j4l71m802wh5qp6vc0000gn/T/tmpvIhINE'... ~~~~~~~
Julia program file:
"/Users/daly/Documents/developer/code/games/FTLBSG/builddir/tmpvIhINE.app/Contents/MacOS/applicationbuilderutils.jl"
C program file:
"/Users/daly/.julia/v0.6/ApplicationBuilder/src/program.c"
Build directory:
"/Users/daly/Documents/developer/code/games/FTLBSG/builddir/tmpvIhINE.app/Contents/MacOS"
Warning: ApplicationBuilder has changed a bit since julia 0.6:
- `module BuildApp` has been removed. You should remove `using BuildApp`
from your build scripts to build with julia v0.7.
- You should also remove `using ApplicationBuilder` from the source-code of
programs being built, since the `change_dir_if_bundle` behavior will
now come default for all applications. `using ApplicationBuilder` in
your program source may cause it to fail to build.
This message will be removed in the next version of ApplicationBuilder.
ERROR: LoadError: LoadError: LoadError: LoadError: LoadError: GCC wasn't found. Please make sure that gcc is on the path and run Pkg.build("PackageCompiler")
while loading /Users/daly/.julia/v0.6/PackageCompiler/src/static_julia.jl, in expression starting on line 11
while loading /Users/daly/.julia/v0.6/PackageCompiler/src/PackageCompiler.jl, in expression starting on line 28
...
ERROR: failed process: Process(`/Applications/Julia-0.6.app/Contents/Resources/julia/bin/julia -Cx86-64 -J/Applications/Julia-0.6.app/Contents/Resources/julia/lib/julia/sys.dylib --compile=yes --depwarn=yes --pr
... So I'm going to merge this in now once CI passes! :) And then i'll cut a new version, and after a few days we can add this to METADATA and maybe remove the warnings then. |
@ranjanan does that all look good to you too? :) It was fun to hang out over last week!! |
Okay, all the tests pass locally, and on Travis they all pass except the one that is still waiting on FluxML/MacroTools.jl#85 to be merged. I'm going to merge this in now, and bump the version number! |
Split out
change_dir_if_bundle
into a new package,ApplicationBuilderRuntimeUtils.jl
.This way, there's not the weird inner package
BuildApp
, which has almost thesame name as ApplicationBuilder, and I think is sort of confusing. I think
doing it this way really clears up the dependency relationship between the two
modules, and still allows application-code to only import the runtime
dependencies!