Skip to content

Commit b13bd2d

Browse files
authored
support the "path" key in Project.toml, (#3756)
code loading has support for this so Pkg should too
1 parent 7311051 commit b13bd2d

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Types.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,7 @@ Base.@kwdef mutable struct Project
247247
uuid::Union{UUID, Nothing} = nothing
248248
version::Union{VersionTypes, Nothing} = nothing
249249
manifest::Union{String, Nothing} = nothing
250+
path::Union{String, Nothing} = nothing
250251
# Sections
251252
deps::Dict{String,UUID} = Dict{String,UUID}()
252253
# deps that are also in weakdeps for backwards compat
@@ -576,7 +577,8 @@ function read_package(path::String)
576577
pkgerror("expected a `uuid` entry in project file at `$(abspath(path))`")
577578
end
578579
name = project.name
579-
if !isfile(joinpath(dirname(path), "src", "$name.jl"))
580+
pkgpath = joinpath(dirname(path), something(project.path, ""))
581+
if !isfile(joinpath(pkgpath, "src", "$name.jl"))
580582
pkgerror("expected the file `src/$name.jl` to exist for package `$name` at `$(dirname(path))`")
581583
end
582584
return project

src/project.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function Project(raw::Dict; file=nothing)
122122
project.other = raw
123123
project.name = get(raw, "name", nothing)::Union{String, Nothing}
124124
project.manifest = get(raw, "manifest", nothing)::Union{String, Nothing}
125+
project.path = get(raw, "path", nothing)::Union{String, Nothing}
125126
project.uuid = read_project_uuid(get(raw, "uuid", nothing))
126127
project.version = read_project_version(get(raw, "version", nothing))
127128
project.deps = read_project_deps(get(raw, "deps", nothing), "deps")
@@ -179,6 +180,7 @@ function destructure(project::Project)::Dict
179180
entry!("uuid", project.uuid)
180181
entry!("version", project.version)
181182
entry!("manifest", project.manifest)
183+
entry!("path", project.path)
182184
entry!("deps", merge(project.deps, project._deps_weak))
183185
entry!("weakdeps", project.weakdeps)
184186
entry!("extras", project.extras)

0 commit comments

Comments
 (0)