Skip to content

Commit

Permalink
allow glue pkgs to load deps of parent directly
Browse files Browse the repository at this point in the history
  • Loading branch information
KristofferC committed Nov 27, 2022
1 parent e1d044f commit 517fc06
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
12 changes: 7 additions & 5 deletions base/loading.jl
Original file line number Diff line number Diff line change
Expand Up @@ -564,8 +564,8 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi
return PkgId(pkg_uuid, name)
end
# Check for this being a dependency to a glue module
glue_dep = project_file_gluedeps_get(project_file, where, name)
glue_dep === nothing || return glue_dep
# glue_dep = project_file_gluedeps_get(project_file, where, name)
# glue_dep === nothing || return glue_dep
# look for manifest file and `where` stanza
return explicit_manifest_deps_get(project_file, where, name)
elseif project_file
Expand All @@ -583,7 +583,7 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
# if `pkg` matches the project, return the project itself
return project_file_path(project_file)
end
# Only used when the package is loading the glue pkg itself
# Only used when the project is loading the glue pkg itself
# which is currently not supported
# mby_glue = project_file_glue_path(project_file, pkg.name)
# mby_glue === nothing || return mby_glue
Expand All @@ -606,7 +606,6 @@ function project_file_name_uuid(project_file::String, name::String)::PkgId
end

function project_file_gluedeps_get(project_file::String, where::PkgId, name::String)
# Check for glue...
d = parsed_toml(project_file)
glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing}
project_id = project_file_name_uuid(project_file, "")
Expand All @@ -618,7 +617,8 @@ function project_file_gluedeps_get(project_file::String, where::PkgId, name::Str
gluedepses = get(d, "gluedeps", nothing)::Union{Dict{String, Any}, Nothing}
return PkgId(UUID(gluedepses[name]::String), name)
end
name == project_id.name && return project_id
# Fall back to normal rules for loading a dep for a a package
return identify_package(project_id, name)
end
end
return nothing
Expand Down Expand Up @@ -831,6 +831,8 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St
end
end
end
# `name` is not a glue pkg, do standard lookup as if this was the parent
return identify_package(PkgId(UUID(uuid), dep_name), name)
end
end
end
Expand Down
5 changes: 3 additions & 2 deletions doc/src/manual/code-loading.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,6 @@ They are loaded when all the packages on the right hand side (the glue dependenc
If a glue package only has one glue dependency the lit of glue dependencies can be written as just a string for breviety.
The location for the entry point of the glue package is either in `glue/GlueFoo.jl` or `glue/GlueFoo/GlueFoo.jl` for
glue package `GlueFoo`.
The glue package can be viewed as a somewhat normal package that has the glue dependencies and the main package as dependencies.
The content of a glue package is often structured as:

```
Expand All @@ -387,7 +386,9 @@ end
```

When a package with glue packages is added to an environment, the `gluedeps` and `gluepkgs` sections
are stored in the manifest file in the section for that package.
are stored in the manifest file in the section for that package. The dependency lookup rules for
a package are the same as for its "parent" except that the listed glue dependencies are also
part of its dependencies.
### Package/Environment Preferences

Preferences are dictionaries of metadata that influence package behavior within an environment.
Expand Down

0 comments on commit 517fc06

Please sign in to comment.