File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed
Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -1185,6 +1185,13 @@ function precompile(ctx::Context, pkgs::Vector{PackageSpec}; internal_call::Bool
11851185 end
11861186end
11871187
1188+ function precompile (f, args... ; kwargs... )
1189+ Base. ScopedValues. @with _autoprecompilation_enabled_scoped => false begin
1190+ f ()
1191+ Pkg. precompile (args... ; kwargs... )
1192+ end
1193+ end
1194+
11881195function tree_hash (repo:: LibGit2.GitRepo , tree_hash:: String )
11891196 try
11901197 return LibGit2. GitObject (repo, tree_hash)
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ usable_io(io) = (io isa Base.TTY) || (io isa IOContext{IO} && io.io isa Base.TTY
7272can_fancyprint (io:: IO ) = (usable_io (io)) && (get (ENV , " CI" , nothing ) != " true" )
7373
7474_autoprecompilation_enabled:: Bool = true
75- _autoprecompilation_enabled_scoped = ScopedValue {Bool} (true )
75+ _autoprecompilation_enabled_scoped = Base . ScopedValues . ScopedValue {Bool} (true )
7676autoprecompilation_enabled (state:: Bool ) = (autoprecompilation_enabled = state)
7777function should_autoprecompile ()
7878 if Base. JLOptions (). use_compiled_modules == 1 &&
@@ -219,11 +219,21 @@ const add = API.add
219219 Pkg.precompile(; strict::Bool=false, timing::Bool=false)
220220 Pkg.precompile(pkg; strict::Bool=false, timing::Bool=false)
221221 Pkg.precompile(pkgs; strict::Bool=false, timing::Bool=false)
222+ Pkg.precompile(f, args...; kwargs...)
222223
223224Precompile all or specific dependencies of the project in parallel.
224225
225226Set `timing=true` to show the duration of the precompilation of each dependency.
226227
228+ To delay autoprecompilation of multiple Pkg actions until the end use.
229+ This may be most efficient while manipulating the environment in various ways.
230+
231+ ```julia
232+ Pkg.precompile() do
233+ # Pkg actions here
234+ end
235+ ```
236+
227237!!! note
228238 Errors will only throw when precompiling the top-level dependencies, given that
229239 not all manifest dependencies may be loaded by the top-level dependencies on the given system.
You can’t perform that action at this time.
0 commit comments