From 3b82a7ea2a17cbf2eb3ffd83f624e2ed749c85a5 Mon Sep 17 00:00:00 2001 From: Elliot Saba Date: Tue, 1 Dec 2020 01:36:50 +0000 Subject: [PATCH] Exclude JLLs from system image This excludes JLLs from the system image, which prevents them from affecting start-up time, while still participating in Pkg resolution logic. We will be able to add these back in to the system image once we have fully transitioned to a lazy ccall interface. --- base/sysimg.jl | 21 +-------------------- contrib/print_sorted_stdlibs.jl | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/base/sysimg.jl b/base/sysimg.jl index 598253e5e72951..36c40e4ae748a2 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -20,6 +20,7 @@ if Base.is_primary_base_module # load some stdlib packages but don't put their names in Main let # Stdlibs sorted in dependency, then alphabetical, order by contrib/print_sorted_stdlibs.jl + # Run with the `--exclude-jlls` option to filter out all JLL packages stdlibs = [ # No dependencies :ArgTools, @@ -30,7 +31,6 @@ let :Libdl, :Logging, :Mmap, - :MozillaCACerts_jll, :NetworkOptions, :SHA, :Serialization, @@ -38,25 +38,12 @@ let :Unicode, # 1-depth packages - :CompilerSupportLibraries_jll, :DelimitedFiles, - :GMP_jll, - :LibOSXUnwind_jll, - :LibUV_jll, - :LibUnwind_jll, :LinearAlgebra, :Markdown, - :MbedTLS_jll, - :OpenLibm_jll, - :PCRE2_jll, :Printf, :Random, :Tar, - :Zlib_jll, - :dSFMT_jll, - :libLLVM_jll, - :nghttp2_jll, - :p7zip_jll, # 2-depth packages :Dates, @@ -64,21 +51,15 @@ let :Future, :InteractiveUtils, :LibGit2, - :LibSSH2_jll, - :MPFR_jll, - :OpenBLAS_jll, :Profile, :SparseArrays, :UUIDs, # 3-depth packages - :LibCURL_jll, - :LibGit2_jll, :REPL, :SharedArrays, :Statistics, :SuiteSparse, - :SuiteSparse_jll, :TOML, :Test, diff --git a/contrib/print_sorted_stdlibs.jl b/contrib/print_sorted_stdlibs.jl index 521776ea5abd75..3ff391ef5883b7 100644 --- a/contrib/print_sorted_stdlibs.jl +++ b/contrib/print_sorted_stdlibs.jl @@ -1,6 +1,21 @@ #!/usr/bin/env julia using TOML +function check_flag(flag) + idxs = findall(flag .== ARGS) + for idx in reverse(idxs) + popat!(ARGS, idx) + end + return !isempty(idxs) +end + +if check_flag("--help") || check_flag("-h") + println("Usage: julia print_sorted_stdlibs.jl [stdlib_dir] [--exclude-jlls]") +end + +# Allow users to ask for JLL or no JLLs +exclude_jlls = check_flag("--exclude-jlls") + # Default to the `stdlib/vX.Y` directory STDLIB_DIR = get(ARGS, 1, joinpath(@__DIR__, "..", "usr", "share", "julia", "stdlib")) vXYdirs = readdir(STDLIB_DIR) @@ -59,9 +74,16 @@ end sorted_projects = sort(collect(keys(project_depths)), lt=project_isless) +if exclude_jlls + filter!(p -> !endswith(p, "_jll"), sorted_projects) +end + # Print out sorted projects, ready to be pasted into `sysimg.jl` last_depth = 0 println(" # Stdlibs sorted in dependency, then alphabetical, order by contrib/print_sorted_stdlibs.jl") +if exclude_jlls + println(" # Run with the `--exclude-jlls` option to filter out all JLL packages") +end println(" stdlibs = [") println(" # No dependencies") for p in sorted_projects