Skip to content

Commit

Permalink
support the "path" key in Project.toml, (JuliaLang#3756)
Browse files Browse the repository at this point in the history
code loading has support for this so Pkg should too
  • Loading branch information
KristofferC authored Jan 30, 2024
1 parent 7311051 commit b13bd2d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/Types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ Base.@kwdef mutable struct Project
uuid::Union{UUID, Nothing} = nothing
version::Union{VersionTypes, Nothing} = nothing
manifest::Union{String, Nothing} = nothing
path::Union{String, Nothing} = nothing
# Sections
deps::Dict{String,UUID} = Dict{String,UUID}()
# deps that are also in weakdeps for backwards compat
Expand Down Expand Up @@ -576,7 +577,8 @@ function read_package(path::String)
pkgerror("expected a `uuid` entry in project file at `$(abspath(path))`")
end
name = project.name
if !isfile(joinpath(dirname(path), "src", "$name.jl"))
pkgpath = joinpath(dirname(path), something(project.path, ""))
if !isfile(joinpath(pkgpath, "src", "$name.jl"))
pkgerror("expected the file `src/$name.jl` to exist for package `$name` at `$(dirname(path))`")
end
return project
Expand Down
2 changes: 2 additions & 0 deletions src/project.jl
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function Project(raw::Dict; file=nothing)
project.other = raw
project.name = get(raw, "name", nothing)::Union{String, Nothing}
project.manifest = get(raw, "manifest", nothing)::Union{String, Nothing}
project.path = get(raw, "path", nothing)::Union{String, Nothing}
project.uuid = read_project_uuid(get(raw, "uuid", nothing))
project.version = read_project_version(get(raw, "version", nothing))
project.deps = read_project_deps(get(raw, "deps", nothing), "deps")
Expand Down Expand Up @@ -179,6 +180,7 @@ function destructure(project::Project)::Dict
entry!("uuid", project.uuid)
entry!("version", project.version)
entry!("manifest", project.manifest)
entry!("path", project.path)
entry!("deps", merge(project.deps, project._deps_weak))
entry!("weakdeps", project.weakdeps)
entry!("extras", project.extras)
Expand Down

0 comments on commit b13bd2d

Please sign in to comment.