Skip to content

Commit

Permalink
add opt-in auto precompilation after Pkg.add, instantiate, update
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Sep 23, 2020
1 parent 5c18022 commit 0ca4e1c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ function add(ctx::Context, pkgs::Vector{PackageSpec}; preserve::PreserveLevel=PR
end

Operations.add(ctx, pkgs, new_git; preserve=preserve, platform=platform)
_do_auto_precompile() && Pkg.precompile()
return
end

Expand Down Expand Up @@ -243,6 +244,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec};
ensure_resolved(ctx, pkgs)
end
Operations.up(ctx, pkgs, level)
_do_auto_precompile() && Pkg.precompile()
return
end

Expand Down Expand Up @@ -892,6 +894,8 @@ function build(ctx::Context, pkgs::Vector{PackageSpec}; verbose=false, kwargs...
Operations.build(ctx, pkgs, verbose)
end

_do_auto_precompile() = parse(Int, get(ENV, "JULIA_PKG_PRECOMPILE_AUTO", "0")) == 1

precompile() = precompile(Context())
function precompile(ctx::Context)
printpkgstyle(ctx, :Precompiling, "project...")
Expand Down Expand Up @@ -1063,6 +1067,8 @@ function instantiate(ctx::Context; manifest::Union{Bool, Nothing}=nothing,
Operations.download_artifacts(ctx, pkgs; platform=platform, verbose=verbose)
# Run build scripts
Operations.build_versions(ctx, union(UUID[pkg.uuid for pkg in new_apply], new_git); verbose=verbose)

_do_auto_precompile() && Pkg.precompile()
end


Expand Down

0 comments on commit 0ca4e1c

Please sign in to comment.