Genie.jl
Genie.jl copied to clipboard
Warning "App does not have Controller in its dependencies" when loading app
Describe the bug
When using Genie.loadapp()
, loading the routes.jl
file triggers a warning that the Genie app is missing the controller modules from it's dependencies.
Error stacktrace The example below produces the following output:
β Warning: 2021-03-13 18:08:53 Package Testapp does not have TestsController in its dependencies:
β - If you have Testapp checked out for development and have
β added TestsController as a dependency but haven't updated your primary
β environment's manifest file, try `Pkg.resolve()`.
β - Otherwise you may need to report an issue with Testapp
β Loading TestsController into Testapp from project dependency, future warnings for Testapp are suppressed.
To reproduce
Start the Julia REPL and make sure to have Genie
in the current environment. Type the following
using Genie
Genie.newapp("testapp")
Genie.newresource("test")
Edit the TestController.jl
file to contain
module TestsController
function webinterface()
html("Nothing to see here")
end
end
Edit the routes.jl
file so that it looks like
using Genie.Router
using TestsController
route("/") do
serve_static_file("welcome.html")
end
route("/web", TestsController.webinterface)
Restart the REPL, navigate to the app folder and type the following to trigger the warning:
using Genie
Genie.loadapp()
Expected behavior No warning about missing dependencies. This bug does not affect the actual Genie app operation, not getting a warning is more of a "nice to have".
Additional context
julia> versioninfo()
Julia Version 1.5.4
Commit 69fcb5745b (2021-03-11 19:13 UTC)
Platform Info:
OS: macOS (x86_64-apple-darwin18.7.0)
CPU: Intel(R) Core(TM) i5-6267U CPU @ 2.90GHz
WORD_SIZE: 64
LIBM: libopenlibm
LLVM: libLLVM-9.0.1 (ORCJIT, skylake)
Environment:
JULIA_EDITOR = "/Applications/Programmieren/Visual Studio Code.app/Contents/Resources/app/bin/code"
JULIA_NUM_THREADS = 4
(Test) pkg> st
Status `~/Uni/Code/Eurogames 2021 Registration/Test/Project.toml`
[c43c736e] Genie v1.16.1
@sdobber Thanks for opening this. Should not cause any problems but it's worth having it here so we don't forget to look into it.
I've asked around on discord, I'm not really sure why Julia complains about it, given that obviously it finds and uses the file... Maybe something changed in how modules are loaded in Julia...
To suppress loading warnings for Testapp, add top of routes.jl
:
push!(Base.modules_warned_for, Base.PkgId(Testapp))
Caveat: All future warnings for Testapp are suppressed! Use pop! to undo.
@UniqueTokens Thanks for sharing this, I didn't know it, it's a great tip!
Keeping this open though as best address the cause/source of the warning, especially as it only comes up in a couple of apps. There's something that's triggering this behavior in some cases...
@sdobber @UniqueTokens For now I've added the code to suppress the loading warning, can't quite figure out what's causing the warning yet. New apps will include this.