Base.pkgorigins is useful for referencing non-Julia assets that live inside a package directory — e.g. pkgdir(@__MODULE__)/assets/index.html — in a relocatable way. This works out of the box with pkgimages.
With sysimages it does not: the recorded paths point at the build machine. The usual remedy is to patch Base.pkgorigins, as the Dyad distribution does in patch-pkgorigins-paths.jl.
JuliaC currently exposes no API for applying such a patch at compile time. To get consistent behaviour across platforms, AppBundler instead patches at runtime from @main:
import AppEnv
function (@main)(ARGS)
AppEnv.init()
# application code
return 0
end
This works, but has drawbacks:
- Stale paths ship anyway. Patching in memory leaves the build-machine strings in the binary, where
strings finds them.
- Opt-in and silent when forgotten.
AppEnv.init() must run first; miss it and asset lookups quietly point at a nonexistent path.
- Adds an AppEnv dependency to the application project.
Compile-time patching seems preferable. Besides being simpler, it also avoids leaking build paths into the shipped artifact — something the Dyad team raised as a concern, since those paths can expose details of their CI infrastructure.
Would an API for this be in scope for JuliaC?
Base.pkgoriginsis useful for referencing non-Julia assets that live inside a package directory — e.g.pkgdir(@__MODULE__)/assets/index.html— in a relocatable way. This works out of the box with pkgimages.With sysimages it does not: the recorded paths point at the build machine. The usual remedy is to patch
Base.pkgorigins, as the Dyad distribution does inpatch-pkgorigins-paths.jl.JuliaC currently exposes no API for applying such a patch at compile time. To get consistent behaviour across platforms, AppBundler instead patches at runtime from
@main:This works, but has drawbacks:
stringsfinds them.AppEnv.init()must run first; miss it and asset lookups quietly point at a nonexistent path.Compile-time patching seems preferable. Besides being simpler, it also avoids leaking build paths into the shipped artifact — something the Dyad team raised as a concern, since those paths can expose details of their CI infrastructure.
Would an API for this be in scope for JuliaC?