@@ -623,6 +623,24 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi
623
623
pkg_uuid = explicit_project_deps_get (project_file, name)
624
624
return PkgId (pkg_uuid, name)
625
625
end
626
+ d = parsed_toml (project_file)
627
+ exts = get (d, " extensions" , nothing ):: Union{Dict{String, Any}, Nothing}
628
+ if exts != = nothing
629
+ # Check if `where` is an extension of the project
630
+ if where . name in keys (exts) && where . uuid == uuid5 (proj. uuid, where . name)
631
+ # Extensions can load weak deps...
632
+ weakdeps = get (d, " weakdeps" , nothing ):: Union{Dict{String, Any}, Nothing}
633
+ if weakdeps != = nothing
634
+ wuuid = get (weakdeps, name, nothing ):: Union{String, Nothing}
635
+ if wuuid != = nothing
636
+ return PkgId (UUID (wuuid), name)
637
+ end
638
+ # ... and they can load same deps as the project itself
639
+ mby_uuid = explicit_project_deps_get (project_file, name)
640
+ mby_uuid === nothing || return PkgId (mby_uuid, name)
641
+ end
642
+ end
643
+ end
626
644
# look for manifest file and `where` stanza
627
645
return explicit_manifest_deps_get (project_file, where , name)
628
646
elseif project_file
@@ -640,6 +658,8 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
640
658
# if `pkg` matches the project, return the project itself
641
659
return project_file_path (project_file)
642
660
end
661
+ mby_ext = project_file_ext_path (project_file, pkg. name)
662
+ mby_ext === nothing || return mby_ext
643
663
# look for manifest file and `where` stanza
644
664
return explicit_manifest_uuid_path (project_file, pkg)
645
665
elseif project_file
@@ -649,6 +669,25 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi
649
669
return nothing
650
670
end
651
671
672
+
673
+ function find_ext_path (project_path:: String , extname:: String )
674
+ extfiledir = joinpath (project_path, " ext" , extname, extname * " .jl" )
675
+ isfile (extfiledir) && return extfiledir
676
+ return joinpath (project_path, " ext" , extname * " .jl" )
677
+ end
678
+
679
+ function project_file_ext_path (project_file:: String , name:: String )
680
+ d = parsed_toml (project_file)
681
+ p = project_file_path (project_file)
682
+ exts = get (d, " extensions" , nothing ):: Union{Dict{String, Any}, Nothing}
683
+ if exts != = nothing
684
+ if name in keys (exts)
685
+ return find_ext_path (p, name)
686
+ end
687
+ end
688
+ return nothing
689
+ end
690
+
652
691
# find project file's top-level UUID entry (or nothing)
653
692
function project_file_name_uuid (project_file:: String , name:: String ):: PkgId
654
693
d = parsed_toml (project_file)
@@ -880,9 +919,7 @@ function explicit_manifest_uuid_path(project_file::String, pkg::PkgId)::Union{No
880
919
error (" failed to find source of parent package: \" $name \" " )
881
920
end
882
921
p = normpath (dirname (parent_path), " .." )
883
- extfiledir = joinpath (p, " ext" , pkg. name, pkg. name * " .jl" )
884
- isfile (extfiledir) && return extfiledir
885
- return joinpath (p, " ext" , pkg. name * " .jl" )
922
+ return find_ext_path (p, pkg. name)
886
923
end
887
924
end
888
925
end
@@ -1164,6 +1201,18 @@ end
1164
1201
function insert_extension_triggers (env:: String , pkg:: PkgId ):: Union{Nothing,Missing}
1165
1202
project_file = env_project_file (env)
1166
1203
if project_file isa String
1204
+ # Look in project for extensions to insert
1205
+ proj_pkg = project_file_name_uuid (project_file, pkg. name)
1206
+ if pkg == proj_pkg
1207
+ d_proj = parsed_toml (project_file)
1208
+ weakdeps = get (d_proj, " weakdeps" , nothing ):: Union{Nothing, Vector{String}, Dict{String,Any}}
1209
+ extensions = get (d_proj, " extensions" , nothing ):: Union{Nothing, Dict{String, Any}}
1210
+ extensions === nothing && return
1211
+ weakdeps === nothing && return
1212
+ return _insert_extension_triggers (pkg, extensions, weakdeps)
1213
+ end
1214
+
1215
+ # Now look in manifest
1167
1216
manifest_file = project_file_manifest_path (project_file)
1168
1217
manifest_file === nothing && return
1169
1218
d = get_deps (parsed_toml (manifest_file))
0 commit comments