Skip to content

Commit c0f5403

Browse files
committed
allow glue pkgs to load deps of parent directly
1 parent e1d044f commit c0f5403

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

base/loading.jl

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -564,8 +564,8 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi
564564
return PkgId(pkg_uuid, name)
565565
end
566566
# Check for this being a dependency to a glue module
567-
glue_dep = project_file_gluedeps_get(project_file, where, name)
568-
glue_dep === nothing || return glue_dep
567+
# glue_dep = project_file_gluedeps_get(project_file, where, name)
568+
# glue_dep === nothing || return glue_dep
569569
# look for manifest file and `where` stanza
570570
return explicit_manifest_deps_get(project_file, where, name)
571571
elseif project_file
@@ -583,7 +583,7 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
583583
# if `pkg` matches the project, return the project itself
584584
return project_file_path(project_file)
585585
end
586-
# Only used when the package is loading the glue pkg itself
586+
# Only used when the project is loading the glue pkg itself
587587
# which is currently not supported
588588
# mby_glue = project_file_glue_path(project_file, pkg.name)
589589
# mby_glue === nothing || return mby_glue
@@ -606,7 +606,6 @@ function project_file_name_uuid(project_file::String, name::String)::PkgId
606606
end
607607

608608
function project_file_gluedeps_get(project_file::String, where::PkgId, name::String)
609-
# Check for glue...
610609
d = parsed_toml(project_file)
611610
glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing}
612611
project_id = project_file_name_uuid(project_file, "")
@@ -618,7 +617,8 @@ function project_file_gluedeps_get(project_file::String, where::PkgId, name::Str
618617
gluedepses = get(d, "gluedeps", nothing)::Union{Dict{String, Any}, Nothing}
619618
return PkgId(UUID(gluedepses[name]::String), name)
620619
end
621-
name == project_id.name && return project_id
620+
# Fall back to normal rules for loading a dep for a a package
621+
return identify_package(project_id, name)
622622
end
623623
end
624624
return nothing
@@ -831,6 +831,8 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St
831831
end
832832
end
833833
end
834+
# `name` is not a glue pkg, do standard lookup as if this was the parent
835+
return identify_package(PkgId(UUID(uuid), dep_name), name)
834836
end
835837
end
836838
end

doc/src/manual/code-loading.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,6 @@ They are loaded when all the packages on the right hand side (the glue dependenc
371371
If a glue package only has one glue dependency the lit of glue dependencies can be written as just a string for breviety.
372372
The location for the entry point of the glue package is either in `glue/GlueFoo.jl` or `glue/GlueFoo/GlueFoo.jl` for
373373
glue package `GlueFoo`.
374-
The glue package can be viewed as a somewhat normal package that has the glue dependencies and the main package as dependencies.
375374
The content of a glue package is often structured as:
376375

377376
```
@@ -387,7 +386,9 @@ end
387386
```
388387

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

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

0 commit comments

Comments
 (0)