Skip to content

Commit

Permalink
fix rm: project.extras also contain dependency names
Browse files Browse the repository at this point in the history
(cherry picked from commit 27d452d, PR #985)
  • Loading branch information
00vareladavid authored and fredrikekre committed Feb 11, 2019
1 parent 93b6d6d commit af69f3c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/Operations.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,7 @@ function rm(ctx::Context, pkgs::Vector{PackageSpec})
end
deps_names = collect(keys(ctx.env.project["deps"]))
if haskey(ctx.env.project, "targets")
append!(deps_names, keys(ctx.env.project["extras"]))
filter!(ctx.env.project["targets"]) do (target, deps)
!isempty(filter!(in(deps_names), deps))
end
Expand Down
12 changes: 12 additions & 0 deletions test/pkg.jl
Original file line number Diff line number Diff line change
Expand Up @@ -549,6 +549,18 @@ end
end
end

#issue #876
@testset "targets should survive add/rm" begin
temp_pkg_dir() do project_path; cd_tempdir() do tmpdir
cp(joinpath(@__DIR__, "project", "good", "pkg.toml"), "Project.toml")
targets = deepcopy(Pkg.Types.read_project("Project.toml")["targets"])
Pkg.activate(".")
Pkg.add("Example")
Pkg.rm("Example")
@test targets == Pkg.Types.read_project("Project.toml")["targets"]
end end
end

include("repl.jl")
include("api.jl")

Expand Down
21 changes: 21 additions & 0 deletions test/project/good/pkg.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name = "Pkg"
keywords = ["package", "management"]
license = "MIT"
desc = "The next-generation Julia package manager."
version = "1.0.0"

[deps]
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
LibGit2 = "76f85450-5226-5b5a-8eaa-529ad045b433"
Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a"
Printf = "de0858da-6303-5e67-8744-51eddeeeb8d7"
REPL = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
Random = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
SHA = "ea8e919c-243c-51af-8825-aaa63cd721ce"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"

[extras]
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"

[targets]
test = ["Test"]

0 comments on commit af69f3c

Please sign in to comment.