Skip to content

Commit 0ce3c8e

Browse files
authored
Add script kwarg to create_library to enable running of custom Julia code (#748)
1 parent 96383ce commit 0ce3c8e

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/PackageCompiler.jl

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -868,6 +868,8 @@ compiler (can also include extra arguments to the compiler, like `-g`).
868868
transitive dependencies into the sysimage. This only makes a difference if some
869869
packages do not load all their dependencies when themselves are loaded. Defaults to `true`.
870870
871+
- `script::String`: Path to a file that gets executed in the `--output-o` process.
872+
871873
### Advanced keyword arguments
872874
873875
- `cpu_target::String`: The value to use for `JULIA_CPU_TARGET` when building the system image.
@@ -890,7 +892,9 @@ function create_library(package_dir::String,
890892
cpu_target::String=default_app_cpu_target(),
891893
include_lazy_artifacts::Bool=false,
892894
sysimage_build_args::Cmd=``,
893-
include_transitive_dependencies::Bool=true)
895+
include_transitive_dependencies::Bool=true,
896+
script::Union{Nothing,String}=nothing
897+
)
894898

895899

896900
warn_official()
@@ -927,7 +931,7 @@ function create_library(package_dir::String,
927931
create_sysimage_workaround(ctx, sysimg_path, precompile_execution_file,
928932
precompile_statements_file, incremental, filter_stdlibs, cpu_target;
929933
sysimage_build_args, include_transitive_dependencies, julia_init_c_file, version,
930-
soname)
934+
soname, script)
931935

932936
if version !== nothing && Sys.isunix()
933937
cd(dirname(sysimg_path)) do
@@ -989,7 +993,8 @@ function create_sysimage_workaround(
989993
include_transitive_dependencies::Bool,
990994
julia_init_c_file::Union{Nothing,String},
991995
version::Union{Nothing,VersionNumber},
992-
soname::Union{Nothing,String}
996+
soname::Union{Nothing,String},
997+
script::Union{Nothing,String}
993998
)
994999
package_name = ctx.env.pkg.name
9951000
project = dirname(ctx.env.project_file)
@@ -1005,6 +1010,7 @@ function create_sysimage_workaround(
10051010

10061011
create_sysimage([package_name]; sysimage_path, project,
10071012
incremental=true,
1013+
script=script,
10081014
precompile_execution_file,
10091015
precompile_statements_file,
10101016
cpu_target,

0 commit comments

Comments
 (0)