Skip to content

Commit 412c8f4

Browse files
author
KristofferC
committed
WIP: move Pkg out of the sysimage
1 parent a84882e commit 412c8f4

File tree

6 files changed

+30
-19
lines changed

6 files changed

+30
-19
lines changed

base/sysimg.jl

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ let
6868

6969
# 5-depth packages
7070
:Downloads,
71-
72-
# 6-depth packages
73-
:Pkg,
7471
]
7572
# PackageCompiler can filter out stdlibs so it can be empty
7673
maxlen = maximum(textwidth.(string.(stdlibs)); init=0)

contrib/generate_precompile.jl

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ if Artifacts !== nothing
153153
"""
154154
end
155155

156-
Pkg = get(Base.loaded_modules,
157-
Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"),
158-
nothing)
159-
160-
if Pkg !== nothing
161-
# TODO: Split Pkg precompile script into REPL and script part
162-
repl_script = Pkg.precompile_script * repl_script # do larger workloads first for better parallelization
163-
end
164-
165156
FileWatching = get(Base.loaded_modules,
166157
Base.PkgId(Base.UUID("7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"), "FileWatching"),
167158
nothing)
@@ -192,7 +183,6 @@ if InteractiveUtils !== nothing
192183
end
193184

194185
const JULIA_PROMPT = "julia> "
195-
const PKG_PROMPT = "pkg> "
196186
const SHELL_PROMPT = "shell> "
197187
const HELP_PROMPT = "help?> "
198188

@@ -366,7 +356,6 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
366356
while !eof(output_copy)
367357
strbuf *= String(readavailable(output_copy))
368358
occursin(JULIA_PROMPT, strbuf) && break
369-
occursin(PKG_PROMPT, strbuf) && break
370359
occursin(SHELL_PROMPT, strbuf) && break
371360
occursin(HELP_PROMPT, strbuf) && break
372361
sleep(0.1)
@@ -455,7 +444,7 @@ generate_precompile_statements() = try # Make sure `ansi_enablecursor` is printe
455444
println()
456445
# Seems like a reasonable number right now, adjust as needed
457446
# comment out if debugging script
458-
n_succeeded > (have_repl ? 900 : 90) || @warn "Only $n_succeeded precompile statements"
447+
n_succeeded > (have_repl ? 650 : 90) || @warn "Only $n_succeeded precompile statements"
459448

460449
fetch(step1) == :ok || throw("Step 1 of collecting precompiles failed.")
461450
fetch(step2) == :ok || throw("Step 2 of collecting precompiles failed.")

pkgimage.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ $(eval $(call sysimg_builder,LibCURL,LibCURL_jll MozillaCACerts_jll))
125125
$(eval $(call sysimg_builder,Downloads,ArgTools FileWatching LibCURL NetworkOptions))
126126

127127
# 6-depth packages
128-
$(eval $(call sysimg_builder,Pkg,Dates LibGit2 Libdl Logging Printf Random SHA UUIDs)) # Markdown REPL
128+
$(eval $(call pkgimg_builder,Pkg,Dates LibGit2 Libdl Logging Printf Random SHA UUIDs)) # Markdown REPL
129129

130130
# 7-depth packages
131131
$(eval $(call pkgimg_builder,LazyArtifacts,Artifacts Pkg))

stdlib/Pkg.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
PKG_BRANCH = master
2-
PKG_SHA1 = 047734e4c7e2b5e99622b4803ec4ad0d49f1d1d3
2+
PKG_SHA1 = 00c86128c0f2abc00b21b3825af782fa52c469fb
33
PKG_GIT_URL := https://github.com/JuliaLang/Pkg.jl.git
44
PKG_TAR_URL = https://api.github.com/repos/JuliaLang/Pkg.jl/tarball/$1

stdlib/REPL/src/REPL.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1111,6 +1111,31 @@ function setup_interface(
11111111
edit_insert(s, '?')
11121112
end
11131113
end,
1114+
']' => function (s::MIState,o...)
1115+
if isempty(s) || position(LineEdit.buffer(s)) == 0
1116+
pkgid = Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg")
1117+
if Base.locate_package(pkgid) !== nothing # Only try load Pkg if we can find it
1118+
Pkg = Base.require(Base.PkgId(Base.UUID("44cfe95a-1eb2-52ea-b672-e2afdf69b78f"), "Pkg"))
1119+
# Pkg should have loaded its REPL mode by now, let's find it so we can transition to it.
1120+
pkg_mode = nothing
1121+
for mode in repl.interface.modes
1122+
if mode isa LineEdit.Prompt && mode.complete isa Pkg.REPLMode.PkgCompletionProvider
1123+
pkg_mode = mode
1124+
break
1125+
end
1126+
end
1127+
# TODO: Cache the `pkg_mode`?
1128+
if pkg_mode !== nothing
1129+
buf = copy(LineEdit.buffer(s))
1130+
transition(s, pkg_mode) do
1131+
LineEdit.state(s, pkg_mode).input_buffer = buf
1132+
end
1133+
return
1134+
end
1135+
end
1136+
end
1137+
edit_insert(s, ']')
1138+
end,
11141139

11151140
# Bracketed Paste Mode
11161141
"\e[200~" => (s::MIState,o...)->begin

test/precompile.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,8 +401,8 @@ precompile_test_harness(false) do dir
401401
[:ArgTools, :Artifacts, :Base64, :CRC32c, :Dates,
402402
:Downloads, :FileWatching, :Future, :InteractiveUtils, :libblastrampoline_jll,
403403
:LibCURL, :LibCURL_jll, :LibGit2, :Libdl, :LinearAlgebra,
404-
:Logging, :Markdown, :Mmap, :MozillaCACerts_jll, :NetworkOptions, :OpenBLAS_jll, :Pkg, :Printf,
405-
:p7zip_jll, :REPL, :Random, :SHA, :Serialization, :Sockets,
404+
:Logging, :Markdown, :Mmap, :MozillaCACerts_jll, :NetworkOptions, :OpenBLAS_jll, :Printf,
405+
:REPL, :Random, :SHA, :Serialization, :Sockets,
406406
:TOML, :Tar, :Test, :UUIDs, :Unicode,
407407
:nghttp2_jll]
408408
),

0 commit comments

Comments
 (0)