diff --git a/stdlib/Pkg3/.travis.yml b/stdlib/Pkg3/.travis.yml index 92e21fc5c42a6..d1dfc96794d90 100644 --- a/stdlib/Pkg3/.travis.yml +++ b/stdlib/Pkg3/.travis.yml @@ -19,8 +19,9 @@ branches: script: - if [[ -a .git/shallow ]]; then git fetch --unshallow; fi - - julia --check-bounds=yes -e 'Pkg.clone(pwd()); Pkg.build("Pkg3"); Pkg.test("Pkg3"; coverage=true)' + - julia --check-bounds=yes -e 'using UUIDs; write("Project.toml", replace(read("Project.toml", String), r"uuid = .*?\n" =>"uuid = \"$(uuid4())\"")); import Pkg3; Pkg3.build(); Pkg3.test(; coverage=true)' after_success: - - julia -e 'cd(Pkg.dir("Pkg3")); Pkg.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' + - julia -e 'import Pkg3; Pkg3.add("Documenter"); include("docs/make.jl")' + - julia -e 'import Pkg3; Pkg3.add("Coverage"); using Coverage; Codecov.submit(Codecov.process_folder())' diff --git a/stdlib/Pkg3/REQUIRE b/stdlib/Pkg3/REQUIRE deleted file mode 100644 index 4aa321c1e26fe..0000000000000 --- a/stdlib/Pkg3/REQUIRE +++ /dev/null @@ -1 +0,0 @@ -julia 0.7- diff --git a/stdlib/Pkg3/appveyor.yml b/stdlib/Pkg3/appveyor.yml index 3a2777692c3f8..56eb35ae291e9 100644 --- a/stdlib/Pkg3/appveyor.yml +++ b/stdlib/Pkg3/appveyor.yml @@ -32,8 +32,8 @@ build_script: # Need to convert from shallow to complete for Pkg.clone to work - IF EXIST .git\shallow (git fetch --unshallow) - C:\projects\julia\bin\julia -e "versioninfo(); - Pkg.clone(pwd(), \"Pkg3\"); Pkg.build(\"Pkg3\")" + using UUIDs; write(\"Project.toml\", replace(read(\"Project.toml\", String), r\"uuid = .*?\\n\" => \"uuid = \\\"\$(uuid4())\\\"\")); import Pkg3; Pkg3.build()" test_script: - - C:\projects\julia\bin\julia -e "Pkg.test(\"Pkg3\")" + - C:\projects\julia\bin\julia -e "import Pkg3; Pkg3.test(; coverage=true)" diff --git a/stdlib/Pkg3/docs/src/index.md b/stdlib/Pkg3/docs/src/index.md index 289511fd25906..06787670b6ed2 100644 --- a/stdlib/Pkg3/docs/src/index.md +++ b/stdlib/Pkg3/docs/src/index.md @@ -322,6 +322,7 @@ Downloaded MacroTools ─ v0.4.0 The dependencies of the unregistered package (here `MacroTools`) got installed. For unregistered packages we could have given a branch (or commit SHA) to track using `#`, just like for registered packages. + ## Developing packages Let’s say we found a bug in one of our dependencies, e.g. `JSON` that we want to fix. We can get the full git-repo using the `develop` command @@ -352,7 +353,7 @@ It is also possible to give a local path as the argument to `develop` which will Overriding the dependency path for a non registered package is done by giving the git-repo url as an argument to `develop`. -### Updating dependencies +## Updating dependencies When new versions of packages the project is using are released, it is a good idea to update. Simply calling `up` will try to update *all* the dependencies of the project. Sometimes this is not what you want. You can specify a subset of the dependencies to upgrade by giving them as arguments to `up`, e.g: @@ -375,7 +376,17 @@ If you just want install the packages that are given by the current `Manifest.to (HelloWorld) pkg> up --manifest --fixed ``` -### Preview mode +## Precompiling the project + +The REPL command `precompile` can be used to precompile all the dependencies in the project. You can for example do + +``` +(HelloWorld) pkg> update; precompile +``` + +do update the dependencies and then precompile them. + +## Preview mode If you just want to see the effects of running a command, but not change your state you can `preview` a command. For example: @@ -393,7 +404,7 @@ or will show you the effects adding `Plots`, or doing a full upgrade, respectively, would have on your project. However, nothing would be installed and your `Project.toml` and `Manfiest.toml` are untouched. -### Using someone elses project +## Using someone elses project Simple clone their project using e.g. `git clone`, `cd` to the project directory and call @@ -402,3 +413,5 @@ Simple clone their project using e.g. `git clone`, `cd` to the project directory ``` This will install the packages at the same state that the project you cloned was using. + + diff --git a/stdlib/Pkg3/src/API.jl b/stdlib/Pkg3/src/API.jl index bc4d651a05bfc..0947e812106f1 100644 --- a/stdlib/Pkg3/src/API.jl +++ b/stdlib/Pkg3/src/API.jl @@ -7,7 +7,7 @@ import Dates import LibGit2 import ..depots, ..logdir, ..devdir, ..print_first_command_header -import ..Operations, ..Display, ..GitTools +import ..Operations, ..Display, ..GitTools, ..Pkg3 using ..Types, ..TOML @@ -15,8 +15,10 @@ preview_info() = printstyled("───── Preview mode ─────\n"; c include("generate.jl") +parse_package(pkg) = Pkg3.REPLMode.parse_package(pkg; context=Pkg3.REPLMode.CMD_ADD) + add_or_develop(pkg::Union{String, PackageSpec}; kwargs...) = add_or_develop([pkg]; kwargs...) -add_or_develop(pkgs::Vector{String}; kwargs...) = add_or_develop([PackageSpec(pkg) for pkg in pkgs]; kwargs...) +add_or_develop(pkgs::Vector{String}; kwargs...) = add_or_develop([parse_package(pkg) for pkg in pkgs]; kwargs...) 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...) @@ -27,6 +29,7 @@ function add_or_develop(ctx::Context, pkgs::Vector{PackageSpec}; mode::Symbol, k new_git = handle_repos_develop!(ctx, pkgs) else new_git = handle_repos_add!(ctx, pkgs; upgrade_or_add=true) + update_registry(ctx) end project_deps_resolve!(ctx.env, pkgs) registry_resolve!(ctx.env, pkgs) @@ -34,6 +37,7 @@ function add_or_develop(ctx::Context, pkgs::Vector{PackageSpec}; mode::Symbol, k ensure_resolved(ctx.env, pkgs, registry=true) Operations.add_or_develop(ctx, pkgs; new_git=new_git) ctx.preview && preview_info() + return end add(args...; kwargs...) = add_or_develop(args...; mode = :add, kwargs...) @@ -53,24 +57,15 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) manifest_resolve!(ctx.env, pkgs) Operations.rm(ctx, pkgs) ctx.preview && preview_info() + return end -up(;kwargs...) = up(PackageSpec[]; kwargs...) -up(pkg::Union{String, PackageSpec}; kwargs...) = up([pkg]; kwargs...) -up(pkgs::Vector{String}; kwargs...) = up([PackageSpec(pkg) for pkg in pkgs]; kwargs...) -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() - +function update_registry(ctx) # Update the registry errors = Tuple{String, String}[] if ctx.preview - info("Skipping updating registry in preview mode") + @info("Skipping updating registry in preview mode") else for reg in registries() if isdir(joinpath(reg, ".git")) @@ -86,7 +81,13 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}; return end branch = LibGit2.headname(repo) - GitTools.fetch(repo) + try + GitTools.fetch(repo) + catch e + e isa LibGit2.GitError || rethrow(e) + push!(errors, (reg, "failed to fetch from repo")) + return + end ff_succeeded = try LibGit2.merge!(repo; branch="refs/remotes/origin/$branch", fastforward=true) catch e @@ -107,7 +108,6 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}; end end end - if !isempty(errors) warn_str = "Some registries failed to update:" for (reg, err) in errors @@ -115,7 +115,20 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}; end @warn warn_str end + return +end +up(;kwargs...) = up(PackageSpec[]; kwargs...) +up(pkg::Union{String, PackageSpec}; kwargs...) = up([pkg]; kwargs...) +up(pkgs::Vector{String}; kwargs...) = up([PackageSpec(pkg) for pkg in pkgs]; kwargs...) +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) if isempty(pkgs) if mode == PKGMODE_PROJECT for (name::String, uuidstr::String) in ctx.env.project["deps"] @@ -135,6 +148,7 @@ function up(ctx::Context, pkgs::Vector{PackageSpec}; end Operations.up(ctx, pkgs) ctx.preview && preview_info() + return end @@ -149,6 +163,7 @@ function pin(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) project_deps_resolve!(ctx.env, pkgs) ensure_resolved(ctx.env, pkgs) Operations.pin(ctx, pkgs) + return end @@ -163,11 +178,12 @@ function free(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) registry_resolve!(ctx.env, pkgs) ensure_resolved(ctx.env, pkgs; registry=true) Operations.free(ctx, pkgs) + return end -test(;kwargs...) = test(PackageSpec[], kwargs...) +test(;kwargs...) = test(PackageSpec[]; kwargs...) test(pkg::Union{String, PackageSpec}; kwargs...) = test([pkg]; kwargs...) test(pkgs::Vector{String}; kwargs...) = test([PackageSpec(pkg) for pkg in pkgs]; kwargs...) test(pkgs::Vector{PackageSpec}; kwargs...) = test(Context(), pkgs; kwargs...) @@ -186,6 +202,7 @@ function test(ctx::Context, pkgs::Vector{PackageSpec}; coverage=false, kwargs... manifest_resolve!(ctx.env, pkgs) ensure_resolved(ctx.env, pkgs) Operations.test(ctx, pkgs; coverage=coverage) + return end @@ -299,6 +316,7 @@ function gc(ctx::Context=Context(); period = Dates.Week(6), kwargs...) byte_save_str = length(paths_to_delete) == 0 ? "" : ("saving " * @sprintf("%.3f %s", bytes, Base._mem_units[mb])) @info("Deleted $(length(paths_to_delete)) package installations $byte_save_str") ctx.preview && preview_info() + return end @@ -317,6 +335,7 @@ function _get_deps!(ctx::Context, pkgs::Vector{PackageSpec}, uuids::Vector{UUID} end _get_deps!(ctx, pkgs, uuids) end + return end build(pkgs...) = build([PackageSpec(pkg) for pkg in pkgs]) @@ -349,6 +368,7 @@ function build(ctx::Context, pkgs::Vector{PackageSpec}; kwargs...) length(uuids) == 0 && (@info("no packages to build"); return) Operations.build_versions(ctx, uuids; might_need_to_resolve=true) ctx.preview && preview_info() + return end init() = init(Context()) @@ -357,6 +377,82 @@ function init(ctx::Context, path::String=pwd()) print_first_command_header() Context!(ctx; env = EnvCache(joinpath(path, "Project.toml"))) Operations.init(ctx) + return +end + +##################################### +# Backwards compatibility with Pkg2 # +##################################### + +function clone(pkg::String...) + @warn "Pkg.clone is only kept for legacy CI script reasons, please use `add`" maxlog=1 + add(joinpath(pkg...)) +end + +function dir(pkg::String, paths::String...) + @warn "Pkg.dir is only kept for legacy CI script reasons" maxlog=1 + pkgid = Base.identify_package(pkg) + pkgid == nothing && return nothing + path = Base.locate_package(pkgid) + pkgid == nothing && return nothing + return joinpath(abspath(path, "..", "..", paths...)) +end + + +function precompile(ctx::Context) + printpkgstyle(ctx, :Precompiling, "project...") + + pkgids = [Base.PkgId(UUID(uuid), name) for (name, uuid) in ctx.env.project["deps"] if !(UUID(uuid) in keys(ctx.stdlibs))] + if ctx.env.pkg !== nothing && isfile( joinpath( dirname(ctx.env.project_file), "src", ctx.env.pkg.name * ".jl")) + push!(pkgids, Base.PkgId(ctx.env.pkg.uuid, ctx.env.pkg.name)) + end + + needs_to_be_precompiled = String[] + for pkg in pkgids + paths = Base.find_all_in_cache_path(pkg) + sourcepath = Base.locate_package(pkg) + if sourcepath == nothing + cmderror("couldn't find path to $(pkg.name) when trying to precompilie project") + end + found_matching_precompile = false + for path_to_try in paths::Vector{String} + staledeps = Base.stale_cachefile(sourcepath, path_to_try) + if !(staledeps isa Bool) + found_matching_precompile = true + end + end + if !found_matching_precompile + # Only precompile packages that has contains `__precompile__` or `__precompile__(true)` + source = read(sourcepath, String) + if occursin(r"__precompile__\(\)|__precompile__\(true\)", source) + push!(needs_to_be_precompiled, pkg.name) + end + end + end + + # Perhaps running all the imports in the same process would avoid some overheda. + # Julia starts pretty fast though (0.3 seconds) + code = join(["import " * pkg for pkg in needs_to_be_precompiled], '\n') * "\nexit(0)" + for (i, pkg) in enumerate(needs_to_be_precompiled) + code = """ + empty!(Base.DEPOT_PATH) + append!(Base.DEPOT_PATH, $(repr(map(abspath, DEPOT_PATH)))) + empty!(Base.DL_LOAD_PATH) + append!(Base.DL_LOAD_PATH, $(repr(map(abspath, Base.DL_LOAD_PATH)))) + empty!(Base.LOAD_PATH) + append!(Base.LOAD_PATH, $(repr(Base.LOAD_PATH))) + import $pkg + """ + printpkgstyle(ctx, :Precompiling, pkg, " [$i of $(length(needs_to_be_precompiled))]") + run(pipeline(ignorestatus(``` + $(Base.julia_cmd()) -O$(Base.JLOptions().opt_level) --color=no --history-file=no + --startup-file=$(Base.JLOptions().startupfile != 2 ? "yes" : "no") + --compiled-modules="yes" + --depwarn=no + --eval $code + ```))) + end + return nothing end end # module diff --git a/stdlib/Pkg3/src/Operations.jl b/stdlib/Pkg3/src/Operations.jl index b7c879c9a2496..acfc6d4caed1f 100644 --- a/stdlib/Pkg3/src/Operations.jl +++ b/stdlib/Pkg3/src/Operations.jl @@ -106,7 +106,7 @@ function collect_fixed!(ctx::Context, pkgs::Vector{PackageSpec}, uuid_to_name::D uuid_to_pkg[pkg.uuid] = pkg uuid_to_name[pkg.uuid] = pkg.name - found_project = collect_project!(pkg, path, fix_deps_map) + found_project = collect_project!(ctx, pkg, path, fix_deps_map) if !found_project collect_require!(ctx, pkg, path, fix_deps_map) end @@ -127,7 +127,7 @@ function collect_fixed!(ctx::Context, pkgs::Vector{PackageSpec}, uuid_to_name::D return fixed end -function collect_project!(pkg::PackageSpec, path::String, fix_deps_map::Dict{UUID,Vector{PackageSpec}}) +function collect_project!(ctx::Context, pkg::PackageSpec, path::String, fix_deps_map::Dict{UUID,Vector{PackageSpec}}) project_file = joinpath(path, "Project.toml") fix_deps_map[pkg.uuid] = valtype(fix_deps_map)() !isfile(project_file) && return false @@ -137,7 +137,12 @@ function collect_project!(pkg::PackageSpec, path::String, fix_deps_map::Dict{UUI deppkg = PackageSpec(deppkg_name, UUID(uuid), vspec) push!(fix_deps_map[pkg.uuid], deppkg) end - pkg.version = VersionNumber(get(project, "version", "0.0")) + if haskey(project, "version") + pkg.version = VersionNumber(project["version"]) + else + @warn "project file for $(pkg.name) is missing a `version` entry" + set_maximum_version_registry!(ctx.env, pkg) + end return true end diff --git a/stdlib/Pkg3/src/Pkg3.jl b/stdlib/Pkg3/src/Pkg3.jl index a4f4ecd111a40..fcbeea74b731b 100644 --- a/stdlib/Pkg3/src/Pkg3.jl +++ b/stdlib/Pkg3/src/Pkg3.jl @@ -40,6 +40,10 @@ include("REPLMode.jl") import .API: add, rm, up, test, gc, init, build, installed, pin, free, checkout, develop, generate const update = up +# legacy CI script support +import .API: clone, dir + + import .REPLMode: @pkg_str export @pkg_str diff --git a/stdlib/Pkg3/src/REPLMode.jl b/stdlib/Pkg3/src/REPLMode.jl index 6a6371b490278..7278b2c613766 100644 --- a/stdlib/Pkg3/src/REPLMode.jl +++ b/stdlib/Pkg3/src/REPLMode.jl @@ -14,7 +14,7 @@ using ..Types, ..Display, ..Operations ############ @enum(CommandKind, CMD_HELP, CMD_STATUS, CMD_SEARCH, CMD_ADD, CMD_RM, CMD_UP, CMD_TEST, CMD_GC, CMD_PREVIEW, CMD_INIT, CMD_BUILD, CMD_FREE, - CMD_PIN, CMD_CHECKOUT, CMD_DEVELOP, CMD_GENERATE) + CMD_PIN, CMD_CHECKOUT, CMD_DEVELOP, CMD_GENERATE, CMD_PRECOMPILE) struct Command kind::CommandKind @@ -52,6 +52,7 @@ const cmds = Dict( "develop" => CMD_DEVELOP, "dev" => CMD_DEVELOP, "generate" => CMD_GENERATE, + "precompile" => CMD_PRECOMPILE, ) ################# @@ -135,11 +136,11 @@ let uuid = raw"(?i)[0-9a-z]{8}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{4}-[0-9a-z]{12}( global const name_uuid_re = Regex("^$name\\s*=\\s*($uuid)\$") end -function parse_package(word::AbstractString; context=nothing)# ::PackageSpec +function parse_package(word::AbstractString; context=nothing)::PackageSpec word = replace(word, "~" => homedir()) if context in (CMD_ADD, CMD_DEVELOP) && isdir(word) pkg = PackageSpec() - pkg.repo = Types.GitRepo(word) + pkg.repo = Types.GitRepo(abspath(word)) return pkg elseif occursin(uuid_re, word) return PackageSpec(UUID(word)) @@ -163,14 +164,22 @@ end ################ # REPL parsing # ################ -const lex_re = r"^[\?\./\+\-](?!\-) | [^@\#\s]+\s*=\s*[^@\#\s]+ | \#\s*[^@\#\s]* | @\s*[^@\#\s]* | [^@\#\s]+"x +const lex_re = r"^[\?\./\+\-](?!\-) | [^@\#\s;]+\s*=\s*[^@\#\s;]+ | \#\s*[^@\#\s;]* | @\s*[^@\#\s;]* | [^@\#\s;]+|;"x const Token = Union{Command, Option, VersionRange, String, Rev} -function tokenize(cmd::String)::Vector{Token} +function tokenize(cmd::String)::Vector{Vector{Token}} + words = map(m->m.match, eachmatch(lex_re, cmd)) + commands = Vector{Token}[] + while !isempty(words) + push!(commands, tokenize!(words)) + end + return commands +end + +function tokenize!(words::Vector{<:AbstractString})::Vector{Token} print_first_command_header() tokens = Token[] - words = map(m->m.match, eachmatch(lex_re, cmd)) help_mode = false preview_mode = false # First parse a Command or a modifier (help / preview) + Command @@ -196,7 +205,9 @@ function tokenize(cmd::String)::Vector{Token} # Now parse the arguments / options to the command while !isempty(words) word = popfirst!(words) - if first(word) == '-' + if word == ";" + return tokens + elseif first(word) == '-' push!(tokens, parse_option(word)) elseif first(word) == '@' push!(tokens, VersionRange(strip(word[2:end]))) @@ -209,14 +220,17 @@ function tokenize(cmd::String)::Vector{Token} return tokens end + ############# # Execution # ############# function do_cmd(repl::REPL.AbstractREPL, input::String; do_rethrow=false) try - tokens = tokenize(input) - do_cmd!(tokens, repl) + commands = tokenize(input) + for command in commands + do_cmd!(command, repl) + end catch err if do_rethrow rethrow(err) @@ -269,6 +283,7 @@ function do_cmd!(tokens::Vector{Token}, repl) cmd.kind == CMD_PIN ? Base.invokelatest( do_pin!, ctx, tokens) : cmd.kind == CMD_FREE ? Base.invokelatest( do_free!, ctx, tokens) : cmd.kind == CMD_GENERATE ? Base.invokelatest( do_generate!, ctx, tokens) : + cmd.kind == CMD_PRECOMPILE ? Base.invokelatest( do_precompile!, ctx, tokens) : cmderror("`$cmd` command not yet implemented") return end @@ -283,6 +298,8 @@ backspace when the input line is empty or press Ctrl+C. pkg> [--env=...] cmd [opts] [args] +Multiple commands can be given on the same line by interleaving a `;` between the commands. + **Environment** The `--env` meta option determines which project environment to manipulate. By @@ -323,6 +340,8 @@ What action you want the package manager to take: `develop`: clone the full package repo locally for development `free`: undos a `pin` or `develop` + +`precompile`: precompile all the project dependencies """ const helps = Dict( @@ -466,6 +485,10 @@ const helps = Dict( pkg> develop Example#c37b675 pkg> develop https://github.com/JuliaLang/Example.jl#master ``` + """, CMD_PRECOMPILE => md""" + precompile + + Precompile all the dependencies of the project by running `import` on all of them in a new process. """ ) @@ -712,6 +735,13 @@ function do_generate!(ctx::Context, tokens::Vector{Token}) API.generate(pkg) end +function do_precompile!(ctx::Context, tokens::Vector{Token}) + if !isempty(tokens) + cmderror("`precompile` does not take any arguments") + end + API.precompile(ctx) +end + ###################### # REPL mode creation # @@ -817,7 +847,7 @@ function completions(full, index) # tokenize input, don't offer any completions for invalid commands tokens = try - tokenize(join(pre_words[1:end-1], ' ')) + tokenize(join(pre_words[1:end-1], ' '))[end] catch return String[], 0:-1, false end diff --git a/stdlib/Pkg3/src/Types.jl b/stdlib/Pkg3/src/Types.jl index 186e544d4fe98..667853b9be6d4 100644 --- a/stdlib/Pkg3/src/Types.jl +++ b/stdlib/Pkg3/src/Types.jl @@ -628,7 +628,7 @@ end const refspecs = ["+refs/*:refs/remotes/cache/*"] -const reg_pkg = r"(?:^|[/\\])(\w+?)(?:\.jl)?(?:\.git)?$" +const reg_pkg = r"(?:^|[/\\])(\w+?)(?:\.jl)?(?:\.git)?(?:\/)?$" # Windows sometimes throw on `isdir`... function isdir_windows_workaround(path::String) @@ -775,12 +775,17 @@ end function parse_package!(env, pkg, project_path) found_project_file = false for projname in project_names - if isfile(joinpath(project_path, "Project.toml")) + if isfile(joinpath(project_path, projname)) found_project_file = true project_data = parse_toml(project_path, "Project.toml") pkg.uuid = UUID(project_data["uuid"]) pkg.name = project_data["name"] - pkg.version = VersionNumber(get(project_data, "version", "0.0")) + if haskey(project_data, "version") + pkg.version = VersionNumber(project_data["version"]) + else + @warn "project file for $(pkg.name) is missing a `version` entry" + Pkg3.Operations.set_maximum_version_registry!(env, pkg) + end break end end diff --git a/stdlib/Pkg3/test/pkg.jl b/stdlib/Pkg3/test/pkg.jl index 801d8b3d8334c..4c43ccafb5807 100644 --- a/stdlib/Pkg3/test/pkg.jl +++ b/stdlib/Pkg3/test/pkg.jl @@ -143,6 +143,20 @@ temp_pkg_dir() do project_path end Pkg3.rm(TEST_PKG.name) + + @testset "legacy CI script" begin + mktempdir() do dir + LibGit2.clone("https://github.com/JuliaLang/Example.jl", joinpath(dir, "Example.jl")) + cd(joinpath(dir, "Example.jl")) do + let Pkg = Pkg3 + Pkg.clone(pwd()) + Pkg.build("Example") + Pkg.test("Example"; coverage=true) + @test isfile(Pkg.dir("Example", "src", "Example.jl")) + end + end + end + end end temp_pkg_dir() do project_path diff --git a/stdlib/Pkg3/test/repl.jl b/stdlib/Pkg3/test/repl.jl index b0b6965ee0f72..1bb1ac78737ff 100644 --- a/stdlib/Pkg3/test/repl.jl +++ b/stdlib/Pkg3/test/repl.jl @@ -56,7 +56,7 @@ temp_pkg_dir() do project_path; cd(project_path) do; mktempdir() do tmp_pkg_path @test Pkg3.installed()[TEST_PKG.name] > v pkg = "UnregisteredWithoutProject" p = git_init_package(tmp_pkg_path, joinpath(@__DIR__, "test_packages/$pkg")) - Pkg3.REPLMode.pkgstr("add $p") + Pkg3.REPLMode.pkgstr("add $p; precompile") @eval import $(Symbol(pkg)) @test Pkg3.installed()[pkg] == v"0.0" Pkg3.test("UnregisteredWithoutProject") @@ -138,7 +138,7 @@ temp_pkg_dir() do project_path; cd(project_path) do cp(p2_path, p2_new_path) Pkg3.REPLMode.pkgstr("develop $(p1_new_path)") Pkg3.REPLMode.pkgstr("develop $(p2_new_path)") - Pkg3.REPLMode.pkgstr("build") + Pkg3.REPLMode.pkgstr("build; precompile") @test locate_name("UnregisteredWithProject") == joinpath(p1_new_path, "src", "UnregisteredWithProject.jl") @test locate_name("UnregisteredWithoutProject") == joinpath(p2_new_path, "src", "UnregisteredWithoutProject.jl") @test Pkg3.installed()["UnregisteredWithProject"] == v"0.1.0" diff --git a/stdlib/Pkg3/test/test_packages/UnregisteredWithoutProject/src/UnregisteredWithoutProject.jl b/stdlib/Pkg3/test/test_packages/UnregisteredWithoutProject/src/UnregisteredWithoutProject.jl index 661908156cb47..09aa3d0968990 100644 --- a/stdlib/Pkg3/test/test_packages/UnregisteredWithoutProject/src/UnregisteredWithoutProject.jl +++ b/stdlib/Pkg3/test/test_packages/UnregisteredWithoutProject/src/UnregisteredWithoutProject.jl @@ -1,3 +1,4 @@ +__precompile__() module UnregisteredWithoutProject if !isfile(joinpath(@__DIR__, "..", "deps", "deps.jl"))