Skip to content

Commit

Permalink
enable unconditional PKG3 precompile (#27105)
Browse files Browse the repository at this point in the history
* enable unconditional PKG3 precompile

* reduce the number of precompile statements
  • Loading branch information
KristofferC authored May 28, 2018
1 parent a1e79f0 commit 2603b57
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 406 deletions.
11 changes: 1 addition & 10 deletions stdlib/Pkg/src/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Random
import Dates
import LibGit2

import ..depots, ..logdir, ..devdir, ..print_first_command_header
import ..depots, ..logdir, ..devdir
import ..Operations, ..Display, ..GitTools, ..Pkg
using ..Types, ..TOML

Expand All @@ -22,7 +22,6 @@ add_or_develop(pkgs::Vector{String}; kwargs...) = add_or_develop([par
add_or_develop(pkgs::Vector{PackageSpec}; kwargs...) = add_or_develop(Context(), pkgs; kwargs...)

function add_or_develop(ctx::Context, pkgs::Vector{PackageSpec}; mode::Symbol, kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
if mode == :develop
Expand Down Expand Up @@ -50,7 +49,6 @@ rm(pkgs::Vector{String}; kwargs...) = rm([PackageSpec(pkg) for pkg in pkgs]
rm(pkgs::Vector{PackageSpec}; kwargs...) = rm(Context(), pkgs; kwargs...)

function rm(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
project_deps_resolve!(ctx.env, pkgs)
Expand Down Expand Up @@ -126,7 +124,6 @@ up(pkgs::Vector{PackageSpec}; kwargs...) = up(Context(), pkgs; kwargs...)

function up(ctx::Context, pkgs::Vector{PackageSpec};
level::UpgradeLevel=UPLEVEL_MAJOR, mode::PackageMode=PKGMODE_PROJECT, kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
update_registry(ctx)
Expand Down Expand Up @@ -158,7 +155,6 @@ pin(pkgs::Vector{String}; kwargs...) = pin([PackageSpec(pkg) for pkg
pin(pkgs::Vector{PackageSpec}; kwargs...) = pin(Context(), pkgs; kwargs...)

function pin(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
project_deps_resolve!(ctx.env, pkgs)
Expand All @@ -173,7 +169,6 @@ free(pkgs::Vector{String}; kwargs...) = free([PackageSpec(pkg) for pk
free(pkgs::Vector{PackageSpec}; kwargs...) = free(Context(), pkgs; kwargs...)

function free(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
registry_resolve!(ctx.env, pkgs)
Expand Down Expand Up @@ -205,7 +200,6 @@ test(pkgs::Vector{String}; kwargs...) = test([PackageSpec(pkg) for p
test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...)

function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
if isempty(pkgs)
Expand Down Expand Up @@ -234,7 +228,6 @@ end


function gc(ctx::Context=Context(); period = Dates.Week(6), kwargs...)
print_first_command_header()
function recursive_dir_size(path)
sz = 0
for (root, dirs, files) in walkdir(path)
Expand Down Expand Up @@ -360,7 +353,6 @@ build(pkg::PackageSpec) = build([pkg])
build(pkgs::Vector{PackageSpec}) = build(Context(), pkgs)

function build(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...)
print_first_command_header()
Context!(ctx; kwargs...)
ctx.preview && preview_info()
if isempty(pkgs)
Expand Down Expand Up @@ -390,7 +382,6 @@ end
init() = init(Context())
init(path::String) = init(Context(env=EnvCache(path)), path)
function init(ctx::Context, path::String=pwd())
print_first_command_header()
Context!(ctx; env = EnvCache(joinpath(path, "Project.toml")))
Operations.init(ctx)
return
Expand Down
24 changes: 1 addition & 23 deletions stdlib/Pkg/src/Pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,6 @@ depots() = Base.DEPOT_PATH
logdir() = joinpath(depots()[1], "logs")
devdir() = get(ENV, "JULIA_PKG_DEVDIR", joinpath(homedir(), ".julia", "dev"))

have_warned_session = false
function print_first_command_header()
global have_warned_session
have_warned_session && return
isinteractive() || return
if !PKG3_IS_PRECOMPILED && !haskey(ENV, "JULIA_PKG3_DISABLE_PRECOMPILE_WARNING")
@info """
Pkg is running without precompile statements, first action will be slow.
Rebuild julia with the environment variable `JULIA_PKG3_PRECOMPILE` set to enable precompilation of Pkg.
This message can be disabled by setting the env variable `JULIA_PKG3_DISABLE_PRECOMPILE_WARNING`.
"""
end
have_warned_session = true
end

# load snapshotted dependencies
include("../ext/TOML/src/TOML.jl")

Expand Down Expand Up @@ -66,13 +51,6 @@ using .Types
using UUIDs
import LibGit2
import Dates
# This crashes low memory systems and some of Julia's CI
# so keep it disabled by default for now.
if haskey(ENV, "JULIA_PKG3_PRECOMPILE")
const PKG3_IS_PRECOMPILED = true
include("precompile.jl")
else
const PKG3_IS_PRECOMPILED = false
end
include("precompile.jl")

end # module
3 changes: 1 addition & 2 deletions stdlib/Pkg/src/REPLMode.jl
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ using UUIDs
import REPL
import REPL: LineEdit, REPLCompletions

import ..devdir, ..print_first_command_header, ..API
import ..devdir, ..API
using ..Types, ..Display, ..Operations

############
Expand Down Expand Up @@ -180,7 +180,6 @@ function tokenize(cmd::String)::Vector{Vector{Token}}
end

function tokenize!(words::Vector{<:AbstractString})::Vector{Token}
print_first_command_header()
tokens = Token[]
help_mode = false
preview_mode = false
Expand Down
Loading

0 comments on commit 2603b57

Please sign in to comment.