From e1d044fd0df2f5f495b3b79d32ac750d43be709e Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Wed, 23 Nov 2022 14:01:38 +0100 Subject: [PATCH 1/7] Add support for "glue packages" to code loading This allows packages to define "glue packages" which are modules that are automatically loaded when a set of other packages are loaded into the Julia session. --- NEWS.md | 6 +- base/loading.jl | 318 ++++++++++++++++-- doc/src/manual/code-loading.md | 39 +++ test/loading.jl | 32 ++ test/project/GluePkgs/GlueDep.jl/Project.toml | 3 + .../GluePkgs/GlueDep.jl/src/GlueDep.jl | 5 + test/project/GluePkgs/GlueDep2/Project.toml | 3 + .../project/GluePkgs/GlueDep2/src/GlueDep2.jl | 5 + .../HasDepWithGluePkgs.jl/Manifest.toml | 25 ++ .../HasDepWithGluePkgs.jl/Project.toml | 8 + .../src/HasDepWithGluePkgs.jl | 13 + .../GluePkgs/HasGluePkgs.jl/Manifest.toml | 7 + .../GluePkgs/HasGluePkgs.jl/Project.toml | 11 + .../GluePkgs/HasGluePkgs.jl/glue/GluePkg.jl | 13 + .../glue/GluePkgFolder/GluePkgFolder.jl | 9 + .../HasGluePkgs.jl/src/HasGluePkgs.jl | 10 + 16 files changed, 481 insertions(+), 26 deletions(-) create mode 100644 test/project/GluePkgs/GlueDep.jl/Project.toml create mode 100644 test/project/GluePkgs/GlueDep.jl/src/GlueDep.jl create mode 100644 test/project/GluePkgs/GlueDep2/Project.toml create mode 100644 test/project/GluePkgs/GlueDep2/src/GlueDep2.jl create mode 100644 test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml create mode 100644 test/project/GluePkgs/HasDepWithGluePkgs.jl/Project.toml create mode 100644 test/project/GluePkgs/HasDepWithGluePkgs.jl/src/HasDepWithGluePkgs.jl create mode 100644 test/project/GluePkgs/HasGluePkgs.jl/Manifest.toml create mode 100644 test/project/GluePkgs/HasGluePkgs.jl/Project.toml create mode 100644 test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkg.jl create mode 100644 test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkgFolder/GluePkgFolder.jl create mode 100644 test/project/GluePkgs/HasGluePkgs.jl/src/HasGluePkgs.jl diff --git a/NEWS.md b/NEWS.md index 1a0cd19825320..d37695279e952 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,7 +4,11 @@ Julia v1.10 Release Notes New language features --------------------- - +New feature for packages that allows loading a piece of code based on other +packages being loaded in the Julia session. +This has similar applications as the Requires.jl package but also +supports precompilation and setting compatibility. +Look in the documentation for Pkg.jl for "glue packages" for more information. Language changes ---------------- diff --git a/base/loading.jl b/base/loading.jl index a5df7c24408ae..16fb8ddb0402f 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -563,8 +563,11 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi pkg_uuid = explicit_project_deps_get(project_file, name) 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 # look for manifest file and `where` stanza - return explicit_manifest_deps_get(project_file, uuid, name) + return explicit_manifest_deps_get(project_file, where, name) elseif project_file # if env names a directory, search it return implicit_manifest_deps_get(env, where, name) @@ -578,8 +581,12 @@ function manifest_uuid_path(env::String, pkg::PkgId)::Union{Nothing,String,Missi proj = project_file_name_uuid(project_file, pkg.name) if proj == pkg # if `pkg` matches the project, return the project itself - return project_file_path(project_file, pkg.name) + return project_file_path(project_file) end + # Only used when the package 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 # look for manifest file and `where` stanza return explicit_manifest_uuid_path(project_file, pkg) elseif project_file @@ -598,7 +605,41 @@ function project_file_name_uuid(project_file::String, name::String)::PkgId return PkgId(uuid, name) end -function project_file_path(project_file::String, name::String) +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, "") + if glue !== nothing && where.uuid == uuid5(project_id.uuid, where.name) + gluedeps = get(glue, where.name, nothing)::Union{Nothing, String, Vector{String}} + if gluedeps !== nothing + if gluedeps isa String && name == gluedeps || + gluedeps isa Vector{String} && name in gluedeps + 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 + end + end + return nothing +end + +function project_file_glue_path(project_file::String, name::String) + d = parsed_toml(project_file) + p = project_file_path(project_file) + glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing} + if glue !== nothing + if name in keys(glue) + gluefile = joinpath(p, "glue", name * ".jl") + isfile(gluefile) && return gluefile + gluefiledir = joinpath(p, "glue", name, name * ".jl") + isfile(gluefiledir) && return gluefiledir + end + end + return nothing +end + +function project_file_path(project_file::String) d = parsed_toml(project_file) joinpath(dirname(project_file), get(d, "path", "")::String) end @@ -679,15 +720,26 @@ end function explicit_project_deps_get(project_file::String, name::String)::Union{Nothing,UUID} d = parsed_toml(project_file) root_uuid = dummy_uuid(project_file) + mby_uuid_project = get(d, "uuid", nothing)::Union{String, Nothing} + uuid_project = mby_uuid_project === nothing ? root_uuid : UUID(mby_uuid_project) if get(d, "name", nothing)::Union{String, Nothing} === name - uuid = get(d, "uuid", nothing)::Union{String, Nothing} - return uuid === nothing ? root_uuid : UUID(uuid) + return uuid_project end deps = get(d, "deps", nothing)::Union{Dict{String, Any}, Nothing} if deps !== nothing uuid = get(deps, name, nothing)::Union{String, Nothing} uuid === nothing || return UUID(uuid) end + + #= + # Unclear if this is needed + glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing} + if glue !== nothing + if name in keys(glue) + return uuid5(uuid_project, name) + end + end + =# return nothing end @@ -716,9 +768,10 @@ end # find `where` stanza and return the PkgId for `name` # return `nothing` if it did not find `where` (indicating caller should continue searching) -function explicit_manifest_deps_get(project_file::String, where::UUID, name::String)::Union{Nothing,PkgId} +function explicit_manifest_deps_get(project_file::String, where::PkgId, name::String)::Union{Nothing,PkgId} manifest_file = project_file_manifest_path(project_file) manifest_file === nothing && return nothing # manifest not found--keep searching LOAD_PATH + d = get_deps(parsed_toml(manifest_file)) found_where = false found_name = false @@ -728,16 +781,21 @@ function explicit_manifest_deps_get(project_file::String, where::UUID, name::Str entry = entry::Dict{String, Any} uuid = get(entry, "uuid", nothing)::Union{String, Nothing} uuid === nothing && continue - if UUID(uuid) === where + if UUID(uuid) === where.uuid found_where = true + gluepkgs = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} + if gluepkgs !== nothing + if name in keys(gluepkgs) + return PkgId(uuid5(where.uuid, name), name) + end + end # deps is either a list of names (deps = ["DepA", "DepB"]) or # a table of entries (deps = {"DepA" = "6ea...", "DepB" = "55d..."} deps = get(entry, "deps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing} - deps === nothing && continue if deps isa Vector{String} found_name = name in deps break - else + elseif deps isa Dict{String, Any} deps = deps::Dict{String, Any} for (dep, uuid) in deps uuid::String @@ -746,6 +804,35 @@ function explicit_manifest_deps_get(project_file::String, where::UUID, name::Str end end end + else # Check for glue modules + gluepkgs = get(entry, "gluepkgs", nothing) + if gluepkgs !== nothing + if where.name in keys(gluepkgs) && where.uuid == uuid5(UUID(uuid), where.name) + found_where = true + if name == dep_name + return PkgId(UUID(uuid), name) + end + glue_entry = gluepkgs[where.name] + if glue_entry isa String && name == glue_entry || + glue_entry isa Vector{String} && name in glue_entry + gluedeps = get(entry, "gluedeps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing} + if gluedeps !== nothing + if gluedeps isa Vector{String} + found_name = name in gluedeps + break + elseif gluedeps isa Dict{String, Any} + gluedeps = gluedeps::Dict{String, Any} + for (dep, uuid) in gluedeps + uuid::String + if dep === name + return PkgId(UUID(uuid), name) + end + end + end + end + end + end + end end end end @@ -769,15 +856,33 @@ function explicit_manifest_uuid_path(project_file::String, pkg::PkgId)::Union{No d = get_deps(parsed_toml(manifest_file)) entries = get(d, pkg.name, nothing)::Union{Nothing, Vector{Any}} - entries === nothing && return nothing # TODO: allow name to mismatch? - for entry in entries - entry = entry::Dict{String, Any} - uuid = get(entry, "uuid", nothing)::Union{Nothing, String} - uuid === nothing && continue - if UUID(uuid) === pkg.uuid - return explicit_manifest_entry_path(manifest_file, pkg, entry) + if entries !== nothing + for entry in entries + entry = entry::Dict{String, Any} + uuid = get(entry, "uuid", nothing)::Union{Nothing, String} + uuid === nothing && continue + if UUID(uuid) === pkg.uuid + return explicit_manifest_entry_path(manifest_file, pkg, entry) + end end end + + # Glue + for (name, entries::Vector{Any}) in d + for entry in entries + uuid = get(entry, "uuid", nothing)::Union{Nothing, String} + gluedeps = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} + if gluedeps !== nothing && pkg.name in keys(gluedeps) && uuid !== nothing && uuid5(UUID(uuid), pkg.name) == pkg.uuid + p = normpath(dirname(locate_package(PkgId(UUID(uuid), name))), "..") + gluefile = joinpath(p, "glue", pkg.name * ".jl") + isfile(gluefile) && return gluefile + gluefiledir = joinpath(p, "glue", pkg.name, pkg.name * ".jl") + isfile(gluefiledir) && return gluefiledir + return nothing + end + end + end + return nothing end @@ -958,6 +1063,7 @@ end function run_package_callbacks(modkey::PkgId) assert_havelock(require_lock) unlock(require_lock) + run_glue_callbacks() try for callback in package_callbacks invokelatest(callback, modkey) @@ -972,6 +1078,163 @@ function run_package_callbacks(modkey::PkgId) nothing end + +######## +# Glue # +######## + +mutable struct GlueId + const id::PkgId # Could be symbol? + const parentid::PkgId + const triggers::Vector{PkgId} # What packages have to be loaded for the glue module to get loaded + triggered::Bool + succeeded::Bool +end + +const GLUE_PKG_DORMITORY = GlueId[] + +function insert_glue_triggers(pkg::PkgId) + pkg.uuid === nothing && return + for env in load_path() + insert_glue_triggers(env, pkg) + break # For now, only insert triggers for packages in the first load_path. + end +end + +function insert_glue_triggers(env::String, pkg::PkgId)::Union{Nothing,Missing} + project_file = env_project_file(env) + if project_file isa String + proj = project_file_name_uuid(project_file, pkg.name) + if proj == pkg + insert_glue_triggers_project(project_file, pkg) + else + return insert_glue_triggers_manifest(project_file, pkg) + end + end + return nothing +end + +function insert_glue_triggers_project(project_file::String, parent::PkgId) + d = parsed_toml(project_file) + gluedeps = get(d, "gluedeps", nothing)::Union{Nothing, Dict{String, Any}} + gluepkgs = get(d, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} + gluepkgs === nothing && return + gluedeps === nothing && return + _insert_glue_triggers(parent, gluepkgs, gluedeps) +end + +function insert_glue_triggers_manifest(project_file::String, parent::PkgId) + manifest_file = project_file_manifest_path(project_file) + manifest_file === nothing && return + d = get_deps(parsed_toml(manifest_file)) + for (dep_name, entries) in d + entries::Vector{Any} + for entry in entries + entry = entry::Dict{String, Any} + uuid = get(entry, "uuid", nothing)::Union{String, Nothing} + uuid === nothing && continue + if UUID(uuid) === parent.uuid + gluedeps = get(entry, "gluedeps", nothing)::Union{Nothing, Vector{String}, Dict{String,Any}} + gluepkgs = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} + gluepkgs === nothing && return + gluedeps === nothing && return + if gluedeps isa Dict{String, Any} + return _insert_glue_triggers(parent, gluepkgs, gluedeps) + end + + d_gluedeps = Dict{String, String}() + for (dep_name, entries) in d + dep_name in gluedeps || continue + entries::Vector{Any} + if length(entries) != 1 + error("expected a single entry for $(repr(name)) in $(repr(project_file))") + end + entry = first(entries)::Dict{String, Any} + uuid = get(entry, "uuid", nothing)::Union{String, Nothing} + d_gluedeps[dep_name] = uuid + end + @assert length(d_gluedeps) == length(gluedeps) + return _insert_glue_triggers(parent, gluepkgs, d_gluedeps) + end + end + end + return +end + +function _insert_glue_triggers(parent::PkgId, gluepkgs::Dict{String, <:Any}, gluedeps::Dict{String, <:Any}) + for (glue_entry::String, triggers::Union{String, Vector{String}}) in gluepkgs + triggers isa String && (triggers = [triggers]) + triggers_id = PkgId[] + id = PkgId(uuid5(parent.uuid, glue_entry), glue_entry) + for trigger in triggers + # TODO: Better error message if this lookup fails? + uuid_trigger = UUID(gluedeps[trigger]::String) + push!(triggers_id, PkgId(uuid_trigger, trigger)) + end + gid = GlueId(id, parent, triggers_id, false, false) + push!(GLUE_PKG_DORMITORY, gid) + end +end + +function run_glue_callbacks(; force::Bool=false) + try + for glueid in GLUE_PKG_DORMITORY + glueid.succeeded && continue + !force && glueid.triggered && continue + if all(in(keys(Base.loaded_modules)), glueid.triggers) + gluepkg_not_allowed_load = nothing + glueid.triggered = true + # It is possible that some of the triggers were loaded in an environment + # below the one of the parent. This will cause a load failure when the + # glue pkg tries to load the triggers. Therefore, check this first + # before loading the glue pkg. + for trigger in glueid.triggers + pkgenv = Base.identify_package_env(glueid.id, trigger.name) + if pkgenv === nothing + gluepkg_not_allowed_load = trigger + break + else + pkg, env = pkgenv + path = Base.locate_package(pkg, env) + if path === nothing + gluepkg_not_allowed_load = trigger + break + end + end + end + if gluepkg_not_allowed_load !== nothing + @debug "Glue package $(glueid.id.name) of $(glueid.parentid.name) not loaded due to \ + $(gluepkg_not_allowed_load.name) loaded in environment lower in load path" + else + require(glueid.id) + @debug "Glue package $(glueid.id.name) of $(glueid.parentid.name) loaded" + end + glueid.succeeded = true + end + end + catch + # Try to continue loading if loading a glue package errors + errs = current_exceptions() + @error "Error during loading of glue code" exception=errs + end + nothing +end + +""" + get_gluepkg(parent::Module, gluepkg::Symbol) + +Return the module for `gluepkg` of `parent` or return `nothing` if the glue +package is not loaded. +""" +get_gluepkg(parent::Module, gluepkg::Symbol) = get_gluepkg(PkgId(parent), gluepkg) +function get_gluepkg(parentid::PkgId, gluepkg::Symbol) + parentid.uuid === nothing && return nothing + gluepkgid = PkgId(uuid5(parentid.uuid, string(gluepkg)), string(gluepkg)) + return get(loaded_modules, gluepkgid, nothing) +end + +# End glue + # loads a precompile cache file, after checking stale_cachefile tests function _tryrequire_from_serialized(modkey::PkgId, build_id::UInt64) assert_havelock(require_lock) @@ -995,6 +1258,7 @@ function _tryrequire_from_serialized(modkey::PkgId, build_id::UInt64) notify(loading, loaded, all=true) end if loaded isa Module + insert_glue_triggers(modkey) run_package_callbacks(modkey) end end @@ -1035,6 +1299,7 @@ function _tryrequire_from_serialized(modkey::PkgId, path::String, sourcepath::St notify(loading, loaded, all=true) end if loaded isa Module + insert_glue_triggers(modkey) run_package_callbacks(modkey) end end @@ -1239,7 +1504,7 @@ function require(into::Module, mod::Symbol) LOADING_CACHE[] = LoadingCache() try uuidkey_env = identify_package_env(into, String(mod)) - # Core.println("require($(PkgId(into)), $mod) -> $uuidkey from env \"$env\"") + # Core.println("require($(PkgId(into)), $mod) -> $uuidkey_env") if uuidkey_env === nothing where = PkgId(into) if where.uuid === nothing @@ -1279,14 +1544,6 @@ function require(into::Module, mod::Symbol) end end -mutable struct PkgOrigin - path::Union{String,Nothing} - cachepath::Union{String,Nothing} - version::Union{VersionNumber,Nothing} -end -PkgOrigin() = PkgOrigin(nothing, nothing, nothing) -const pkgorigins = Dict{PkgId,PkgOrigin}() - require(uuidkey::PkgId) = @lock require_lock _require_prelocked(uuidkey) function _require_prelocked(uuidkey::PkgId, env=nothing) @@ -1297,6 +1554,7 @@ function _require_prelocked(uuidkey::PkgId, env=nothing) error("package `$(uuidkey.name)` did not define the expected \ module `$(uuidkey.name)`, check for typos in package module name") end + insert_glue_triggers(uuidkey) # After successfully loading, notify downstream consumers run_package_callbacks(uuidkey) else @@ -1305,6 +1563,14 @@ function _require_prelocked(uuidkey::PkgId, env=nothing) return newm end +mutable struct PkgOrigin + path::Union{String,Nothing} + cachepath::Union{String,Nothing} + version::Union{VersionNumber,Nothing} +end +PkgOrigin() = PkgOrigin(nothing, nothing, nothing) +const pkgorigins = Dict{PkgId,PkgOrigin}() + const loaded_modules = Dict{PkgId,Module}() const loaded_modules_order = Vector{Module}() const module_keys = IdDict{Module,PkgId}() # the reverse @@ -1479,6 +1745,7 @@ function _require_from_serialized(uuidkey::PkgId, path::String) set_pkgorigin_version_path(uuidkey, nothing) newm = _tryrequire_from_serialized(uuidkey, path) newm isa Module || throw(newm) + insert_glue_triggers(uuidkey) # After successfully loading, notify downstream consumers run_package_callbacks(uuidkey) return newm @@ -1711,6 +1978,7 @@ function create_expr_cache(pkg::PkgId, input::String, output::String, concrete_d "w", stdout) # write data over stdin to avoid the (unlikely) case of exceeding max command line size write(io.in, """ + empty!(Base.GLUE_PKG_DORMITORY) # If we have a custom sysimage with `GLUE_PKG_DORMITORY` prepopulated Base.include_package_for_output($(pkg_str(pkg)), $(repr(abspath(input))), $(repr(depot_path)), $(repr(dl_load_path)), $(repr(load_path)), $deps, $(repr(source_path(nothing)))) """) diff --git a/doc/src/manual/code-loading.md b/doc/src/manual/code-loading.md index d6f359f83d5cb..693742313bc4f 100644 --- a/doc/src/manual/code-loading.md +++ b/doc/src/manual/code-loading.md @@ -348,7 +348,46 @@ The subscripted `rootsᵢ`, `graphᵢ` and `pathsᵢ` variables correspond to th 2. Packages in non-primary environments can end up using incompatible versions of their dependencies even if their own environments are entirely compatible. This can happen when one of their dependencies is shadowed by a version in an earlier environment in the stack (either by graph or path, or both). Since the primary environment is typically the environment of a project you're working on, while environments later in the stack contain additional tools, this is the right trade-off: it's better to break your development tools but keep the project working. When such incompatibilities occur, you'll typically want to upgrade your dev tools to versions that are compatible with the main project. +### "Glue" packages and dependencies +A "glue package" is a module that is automatically loaded when a specified set of other packages (called "glue dependencies") are loaded in the current Julia session. +These are defined by adding the following two sections to a package's `Project.toml` file: + +```toml +name = "MyPackage" + +[gluedeps] +GlueDep = "c9a23..." # uuid +OtherGlueDep = "862e..." # uuid + +[gluepkgs] +GlueFoo = "GlueDep" +GlueBar = ["GlueDep", "OtherGlueDep"] +... +``` + +The keys under `gluepkgs` are the name of the glue packages. +They are loaded when all the packages on the right hand side (the glue dependencies) of the glue package are loaded. +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: + +``` +module GlueFoo + +# Load main package and glue dependencies +using MyPackage, GlueDep + +# Extend functionality in main package with types from the glue dependencies +MyPackage.func(x::GlueDep.SomeStruct) = ... + +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. ### Package/Environment Preferences Preferences are dictionaries of metadata that influence package behavior within an environment. diff --git a/test/loading.jl b/test/loading.jl index d057f0b3c3702..b1cf078439e58 100644 --- a/test/loading.jl +++ b/test/loading.jl @@ -991,5 +991,37 @@ end end end + +@testset "GluePkgs" begin + old_depot_path = copy(DEPOT_PATH) + try + tmp = mktempdir() + push!(empty!(DEPOT_PATH), joinpath(tmp, "depot")) + + proj = joinpath(@__DIR__, "project", "GluePkgs", "HasDepWithGluePkgs.jl") + for i in 1:2 # Once when requiring precomilation, once where it is already precompiled + cmd = `$(Base.julia_cmd()) --project=$proj --startup-file=no -e ' + begin + using HasGluePkgs + Base.get_gluepkg(HasGluePkgs, :GluePkg) === nothing || error("unexpectedly got a glue module") + HasGluePkgs.glue_loaded && error("glue_loaded set") + using HasDepWithGluePkgs + Base.get_gluepkg(HasGluePkgs, :GluePkg).gluevar == 1 || error("gluevar in GluePkg not set") + HasGluePkgs.glue_loaded || error("glue_loaded not set") + HasGluePkgs.glue_folder_loaded && error("glue_folder_loaded set") + HasDepWithGluePkgs.do_something() || error("do_something errored") + using GlueDep2 + HasGluePkgs.glue_folder_loaded || error("glue_folder_loaded not set") + + end + '` + @test success(cmd) + end + finally + copy!(DEPOT_PATH, old_depot_path) + end +end + + empty!(Base.DEPOT_PATH) append!(Base.DEPOT_PATH, original_depot_path) diff --git a/test/project/GluePkgs/GlueDep.jl/Project.toml b/test/project/GluePkgs/GlueDep.jl/Project.toml new file mode 100644 index 0000000000000..a075e6219c5bd --- /dev/null +++ b/test/project/GluePkgs/GlueDep.jl/Project.toml @@ -0,0 +1,3 @@ +name = "GlueDep" +uuid = "fa069be4-f60b-4d4c-8b95-f8008775090c" +version = "0.1.0" diff --git a/test/project/GluePkgs/GlueDep.jl/src/GlueDep.jl b/test/project/GluePkgs/GlueDep.jl/src/GlueDep.jl new file mode 100644 index 0000000000000..1e79be6dd1a60 --- /dev/null +++ b/test/project/GluePkgs/GlueDep.jl/src/GlueDep.jl @@ -0,0 +1,5 @@ +module GlueDep + +struct GlueDepStruct end + +end # module GlueDep diff --git a/test/project/GluePkgs/GlueDep2/Project.toml b/test/project/GluePkgs/GlueDep2/Project.toml new file mode 100644 index 0000000000000..4672bdbef8fa8 --- /dev/null +++ b/test/project/GluePkgs/GlueDep2/Project.toml @@ -0,0 +1,3 @@ +name = "GlueDep2" +uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" +version = "0.1.0" diff --git a/test/project/GluePkgs/GlueDep2/src/GlueDep2.jl b/test/project/GluePkgs/GlueDep2/src/GlueDep2.jl new file mode 100644 index 0000000000000..8bb9f4e7fd835 --- /dev/null +++ b/test/project/GluePkgs/GlueDep2/src/GlueDep2.jl @@ -0,0 +1,5 @@ +module GlueDep2 + +greet() = print("Hello World!") + +end # module GlueDep2 diff --git a/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml new file mode 100644 index 0000000000000..2bd02a308a163 --- /dev/null +++ b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml @@ -0,0 +1,25 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.10.0-DEV" +manifest_format = "2.0" +project_hash = "7cbe1857ecc6692a8cc8be428a5ad5073531ff98" + +[[deps.GlueDep]] +path = "../GlueDep.jl" +uuid = "fa069be4-f60b-4d4c-8b95-f8008775090c" +version = "0.1.0" + +[[deps.GlueDep2]] +path = "../GlueDep2" +uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" +version = "0.1.0" + +[[deps.HasGluePkgs]] +gluedeps = ["GlueDep", "GlueDep2"] +path = "../HasGluePkgs.jl" +uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" +version = "0.1.0" + + [deps.HasGluePkgs.gluepkgs] + GluePkg = "GlueDep" + GluePkgFolder = ["GlueDep", "GlueDep2"] diff --git a/test/project/GluePkgs/HasDepWithGluePkgs.jl/Project.toml b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Project.toml new file mode 100644 index 0000000000000..f644cec26180c --- /dev/null +++ b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Project.toml @@ -0,0 +1,8 @@ +name = "HasDepWithGluePkgs" +uuid = "d4ef3d4a-8e22-4710-85d8-c6cf2eb9efca" +version = "0.1.0" + +[deps] +GlueDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" +GlueDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" +HasGluePkgs = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" diff --git a/test/project/GluePkgs/HasDepWithGluePkgs.jl/src/HasDepWithGluePkgs.jl b/test/project/GluePkgs/HasDepWithGluePkgs.jl/src/HasDepWithGluePkgs.jl new file mode 100644 index 0000000000000..c61e26731683f --- /dev/null +++ b/test/project/GluePkgs/HasDepWithGluePkgs.jl/src/HasDepWithGluePkgs.jl @@ -0,0 +1,13 @@ +module HasDepWithGluePkgs + +using HasGluePkgs: HasGluePkgs, HasGluePkgsStruct +using GlueDep: GlueDepStruct +# Loading GlueDep makes the glue module "GluePkg" load + +function do_something() + HasGluePkgs.foo(HasGluePkgsStruct()) == 1 || error() + HasGluePkgs.foo(GlueDepStruct()) == 2 || error() + return true +end + +end # module diff --git a/test/project/GluePkgs/HasGluePkgs.jl/Manifest.toml b/test/project/GluePkgs/HasGluePkgs.jl/Manifest.toml new file mode 100644 index 0000000000000..55f7958701a75 --- /dev/null +++ b/test/project/GluePkgs/HasGluePkgs.jl/Manifest.toml @@ -0,0 +1,7 @@ +# This file is machine-generated - editing it directly is not advised + +julia_version = "1.10.0-DEV" +manifest_format = "2.0" +project_hash = "c87947f1f1f070eea848950c304d668a112dec3d" + +[deps] diff --git a/test/project/GluePkgs/HasGluePkgs.jl/Project.toml b/test/project/GluePkgs/HasGluePkgs.jl/Project.toml new file mode 100644 index 0000000000000..f7520ccaaabf9 --- /dev/null +++ b/test/project/GluePkgs/HasGluePkgs.jl/Project.toml @@ -0,0 +1,11 @@ +name = "HasGluePkgs" +uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" +version = "0.1.0" + +[gluedeps] +GlueDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" +GlueDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" + +[gluepkgs] +GluePkg = "GlueDep" +GluePkgFolder = ["GlueDep", "GlueDep2"] diff --git a/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkg.jl b/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkg.jl new file mode 100644 index 0000000000000..2d2cc46a6ca66 --- /dev/null +++ b/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkg.jl @@ -0,0 +1,13 @@ +module GluePkg + +using HasGluePkgs, GlueDep + +HasGluePkgs.foo(::GlueDep.GlueDepStruct) = 2 + +function __init__() + HasGluePkgs.glue_loaded = true +end + +const gluevar = 1 + +end diff --git a/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkgFolder/GluePkgFolder.jl b/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkgFolder/GluePkgFolder.jl new file mode 100644 index 0000000000000..28ae155e174be --- /dev/null +++ b/test/project/GluePkgs/HasGluePkgs.jl/glue/GluePkgFolder/GluePkgFolder.jl @@ -0,0 +1,9 @@ +module GluePkgFolder + +using GlueDep, GlueDep2, HasGluePkgs + +function __init__() + HasGluePkgs.glue_folder_loaded = true +end + +end diff --git a/test/project/GluePkgs/HasGluePkgs.jl/src/HasGluePkgs.jl b/test/project/GluePkgs/HasGluePkgs.jl/src/HasGluePkgs.jl new file mode 100644 index 0000000000000..5607d1d936cda --- /dev/null +++ b/test/project/GluePkgs/HasGluePkgs.jl/src/HasGluePkgs.jl @@ -0,0 +1,10 @@ +module HasGluePkgs + +struct HasGluePkgsStruct end + +foo(::HasGluePkgsStruct) = 1 + +glue_loaded = false +glue_folder_loaded = false + +end # module From c0f540379e70b019cfede75d937ea0dcd8311e39 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Sun, 27 Nov 2022 08:53:59 +0100 Subject: [PATCH 2/7] allow glue pkgs to load deps of parent directly --- base/loading.jl | 12 +++++++----- doc/src/manual/code-loading.md | 5 +++-- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 16fb8ddb0402f..96f726a218963 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -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 @@ -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 @@ -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, "") @@ -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 @@ -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 diff --git a/doc/src/manual/code-loading.md b/doc/src/manual/code-loading.md index 693742313bc4f..dba4f6e7c7733 100644 --- a/doc/src/manual/code-loading.md +++ b/doc/src/manual/code-loading.md @@ -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: ``` @@ -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. From fa4aa595dae41f6fc3ce263ef22e85c71126f2be Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Sun, 27 Nov 2022 13:21:39 +0100 Subject: [PATCH 3/7] get rid of some non-needed code --- base/loading.jl | 57 ------------------------------------------------- 1 file changed, 57 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 96f726a218963..4b038d091d4de 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -563,9 +563,6 @@ function manifest_deps_get(env::String, where::PkgId, name::String)::Union{Nothi pkg_uuid = explicit_project_deps_get(project_file, name) 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 # look for manifest file and `where` stanza return explicit_manifest_deps_get(project_file, where, name) elseif project_file @@ -583,10 +580,6 @@ 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 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 # look for manifest file and `where` stanza return explicit_manifest_uuid_path(project_file, pkg) elseif project_file @@ -605,40 +598,6 @@ function project_file_name_uuid(project_file::String, name::String)::PkgId return PkgId(uuid, name) end -function project_file_gluedeps_get(project_file::String, where::PkgId, name::String) - d = parsed_toml(project_file) - glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing} - project_id = project_file_name_uuid(project_file, "") - if glue !== nothing && where.uuid == uuid5(project_id.uuid, where.name) - gluedeps = get(glue, where.name, nothing)::Union{Nothing, String, Vector{String}} - if gluedeps !== nothing - if gluedeps isa String && name == gluedeps || - gluedeps isa Vector{String} && name in gluedeps - gluedepses = get(d, "gluedeps", nothing)::Union{Dict{String, Any}, Nothing} - return PkgId(UUID(gluedepses[name]::String), name) - end - # Fall back to normal rules for loading a dep for a a package - return identify_package(project_id, name) - end - end - return nothing -end - -function project_file_glue_path(project_file::String, name::String) - d = parsed_toml(project_file) - p = project_file_path(project_file) - glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing} - if glue !== nothing - if name in keys(glue) - gluefile = joinpath(p, "glue", name * ".jl") - isfile(gluefile) && return gluefile - gluefiledir = joinpath(p, "glue", name, name * ".jl") - isfile(gluefiledir) && return gluefiledir - end - end - return nothing -end - function project_file_path(project_file::String) d = parsed_toml(project_file) joinpath(dirname(project_file), get(d, "path", "")::String) @@ -730,16 +689,6 @@ function explicit_project_deps_get(project_file::String, name::String)::Union{No uuid = get(deps, name, nothing)::Union{String, Nothing} uuid === nothing || return UUID(uuid) end - - #= - # Unclear if this is needed - glue = get(d, "gluepkgs", nothing)::Union{Dict{String, Any}, Nothing} - if glue !== nothing - if name in keys(glue) - return uuid5(uuid_project, name) - end - end - =# return nothing end @@ -783,12 +732,6 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St uuid === nothing && continue if UUID(uuid) === where.uuid found_where = true - gluepkgs = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} - if gluepkgs !== nothing - if name in keys(gluepkgs) - return PkgId(uuid5(where.uuid, name), name) - end - end # deps is either a list of names (deps = ["DepA", "DepB"]) or # a table of entries (deps = {"DepA" = "6ea...", "DepB" = "55d..."} deps = get(entry, "deps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing} From b46096c469e663d7d7d95268240094735fdfa055 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Tue, 29 Nov 2022 16:35:50 +0100 Subject: [PATCH 4/7] gluedeps -> weakdeps --- base/loading.jl | 46 +++++++++---------- doc/src/manual/code-loading.md | 17 ++++--- .../HasDepWithGluePkgs.jl/Manifest.toml | 2 +- .../GluePkgs/HasGluePkgs.jl/Project.toml | 2 +- 4 files changed, 33 insertions(+), 34 deletions(-) diff --git a/base/loading.jl b/base/loading.jl index 4b038d091d4de..8bbdb9e3444e2 100644 --- a/base/loading.jl +++ b/base/loading.jl @@ -758,14 +758,14 @@ function explicit_manifest_deps_get(project_file::String, where::PkgId, name::St glue_entry = gluepkgs[where.name] if glue_entry isa String && name == glue_entry || glue_entry isa Vector{String} && name in glue_entry - gluedeps = get(entry, "gluedeps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing} - if gluedeps !== nothing - if gluedeps isa Vector{String} - found_name = name in gluedeps + weakdeps = get(entry, "weakdeps", nothing)::Union{Vector{String}, Dict{String, Any}, Nothing} + if weakdeps !== nothing + if weakdeps isa Vector{String} + found_name = name in weakdeps break - elseif gluedeps isa Dict{String, Any} - gluedeps = gluedeps::Dict{String, Any} - for (dep, uuid) in gluedeps + elseif weakdeps isa Dict{String, Any} + weakdeps = weakdeps::Dict{String, Any} + for (dep, uuid) in weakdeps uuid::String if dep === name return PkgId(UUID(uuid), name) @@ -816,8 +816,8 @@ function explicit_manifest_uuid_path(project_file::String, pkg::PkgId)::Union{No for (name, entries::Vector{Any}) in d for entry in entries uuid = get(entry, "uuid", nothing)::Union{Nothing, String} - gluedeps = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} - if gluedeps !== nothing && pkg.name in keys(gluedeps) && uuid !== nothing && uuid5(UUID(uuid), pkg.name) == pkg.uuid + weakdeps = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} + if weakdeps !== nothing && haskey(weakdeps, pkg.name) && uuid !== nothing && uuid5(UUID(uuid), pkg.name) == pkg.uuid p = normpath(dirname(locate_package(PkgId(UUID(uuid), name))), "..") gluefile = joinpath(p, "glue", pkg.name * ".jl") isfile(gluefile) && return gluefile @@ -1061,11 +1061,11 @@ end function insert_glue_triggers_project(project_file::String, parent::PkgId) d = parsed_toml(project_file) - gluedeps = get(d, "gluedeps", nothing)::Union{Nothing, Dict{String, Any}} + weakdeps = get(d, "weakdeps", nothing)::Union{Nothing, Dict{String, Any}} gluepkgs = get(d, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} gluepkgs === nothing && return - gluedeps === nothing && return - _insert_glue_triggers(parent, gluepkgs, gluedeps) + weakdeps === nothing && return + _insert_glue_triggers(parent, gluepkgs, weakdeps) end function insert_glue_triggers_manifest(project_file::String, parent::PkgId) @@ -1079,41 +1079,41 @@ function insert_glue_triggers_manifest(project_file::String, parent::PkgId) uuid = get(entry, "uuid", nothing)::Union{String, Nothing} uuid === nothing && continue if UUID(uuid) === parent.uuid - gluedeps = get(entry, "gluedeps", nothing)::Union{Nothing, Vector{String}, Dict{String,Any}} + weakdeps = get(entry, "weakdeps", nothing)::Union{Nothing, Vector{String}, Dict{String,Any}} gluepkgs = get(entry, "gluepkgs", nothing)::Union{Nothing, Dict{String, Any}} gluepkgs === nothing && return - gluedeps === nothing && return - if gluedeps isa Dict{String, Any} - return _insert_glue_triggers(parent, gluepkgs, gluedeps) + weakdeps === nothing && return + if weakdeps isa Dict{String, Any} + return _insert_glue_triggers(parent, gluepkgs, weakdeps) end - d_gluedeps = Dict{String, String}() + d_weakdeps = Dict{String, String}() for (dep_name, entries) in d - dep_name in gluedeps || continue + dep_name in weakdeps || continue entries::Vector{Any} if length(entries) != 1 error("expected a single entry for $(repr(name)) in $(repr(project_file))") end entry = first(entries)::Dict{String, Any} uuid = get(entry, "uuid", nothing)::Union{String, Nothing} - d_gluedeps[dep_name] = uuid + d_weakdeps[dep_name] = uuid end - @assert length(d_gluedeps) == length(gluedeps) - return _insert_glue_triggers(parent, gluepkgs, d_gluedeps) + @assert length(d_weakdeps) == length(weakdeps) + return _insert_glue_triggers(parent, gluepkgs, d_weakdeps) end end end return end -function _insert_glue_triggers(parent::PkgId, gluepkgs::Dict{String, <:Any}, gluedeps::Dict{String, <:Any}) +function _insert_glue_triggers(parent::PkgId, gluepkgs::Dict{String, <:Any}, weakdeps::Dict{String, <:Any}) for (glue_entry::String, triggers::Union{String, Vector{String}}) in gluepkgs triggers isa String && (triggers = [triggers]) triggers_id = PkgId[] id = PkgId(uuid5(parent.uuid, glue_entry), glue_entry) for trigger in triggers # TODO: Better error message if this lookup fails? - uuid_trigger = UUID(gluedeps[trigger]::String) + uuid_trigger = UUID(weakdeps[trigger]::String) push!(triggers_id, PkgId(uuid_trigger, trigger)) end gid = GlueId(id, parent, triggers_id, false, false) diff --git a/doc/src/manual/code-loading.md b/doc/src/manual/code-loading.md index dba4f6e7c7733..1dd406d92f2a1 100644 --- a/doc/src/manual/code-loading.md +++ b/doc/src/manual/code-loading.md @@ -350,25 +350,24 @@ The subscripted `rootsᵢ`, `graphᵢ` and `pathsᵢ` variables correspond to th Since the primary environment is typically the environment of a project you're working on, while environments later in the stack contain additional tools, this is the right trade-off: it's better to break your development tools but keep the project working. When such incompatibilities occur, you'll typically want to upgrade your dev tools to versions that are compatible with the main project. ### "Glue" packages and dependencies -A "glue package" is a module that is automatically loaded when a specified set of other packages (called "glue dependencies") are loaded in the current Julia session. -These are defined by adding the following two sections to a package's `Project.toml` file: +A "glue package" is a module that is automatically loaded when a specified set of other packages (its "glue dependencies") are loaded in the current Julia session. The glue dependencies of a glue package is a subset of those packages listed under the `[weakdeps]` section of a Project file. Glue packages are defined under the `[gluepkgs]` section in the project file: ```toml name = "MyPackage" -[gluedeps] +[weakdeps] GlueDep = "c9a23..." # uuid OtherGlueDep = "862e..." # uuid [gluepkgs] -GlueFoo = "GlueDep" GlueBar = ["GlueDep", "OtherGlueDep"] +GlueFoo = "GlueDep" ... ``` The keys under `gluepkgs` are the name of the glue packages. -They are loaded when all the packages on the right hand side (the glue dependencies) of the glue package are loaded. -If a glue package only has one glue dependency the lit of glue dependencies can be written as just a string for breviety. +They are loaded when all the packages on the right hand side (the glue dependencies) of that glue package are loaded. +If a glue package only has one glue dependency the list of glue dependencies can be written as just a string for brevity. 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 content of a glue package is often structured as: @@ -385,10 +384,10 @@ MyPackage.func(x::GlueDep.SomeStruct) = ... end ``` -When a package with glue packages is added to an environment, the `gluedeps` and `gluepkgs` sections +When a package with glue packages is added to an environment, the `weakdeps` and `gluepkgs` sections 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. +a package are the same as for its "parent" except that the listed glue dependencies are also considered as +dependencies. ### Package/Environment Preferences Preferences are dictionaries of metadata that influence package behavior within an environment. diff --git a/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml index 2bd02a308a163..db987547ea8bb 100644 --- a/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml +++ b/test/project/GluePkgs/HasDepWithGluePkgs.jl/Manifest.toml @@ -15,7 +15,7 @@ uuid = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" version = "0.1.0" [[deps.HasGluePkgs]] -gluedeps = ["GlueDep", "GlueDep2"] +weakdeps = ["GlueDep", "GlueDep2"] path = "../HasGluePkgs.jl" uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" version = "0.1.0" diff --git a/test/project/GluePkgs/HasGluePkgs.jl/Project.toml b/test/project/GluePkgs/HasGluePkgs.jl/Project.toml index f7520ccaaabf9..9c971456f0629 100644 --- a/test/project/GluePkgs/HasGluePkgs.jl/Project.toml +++ b/test/project/GluePkgs/HasGluePkgs.jl/Project.toml @@ -2,7 +2,7 @@ name = "HasGluePkgs" uuid = "4d3288b3-3afc-4bb6-85f3-489fffe514c8" version = "0.1.0" -[gluedeps] +[weakdeps] GlueDep = "fa069be4-f60b-4d4c-8b95-f8008775090c" GlueDep2 = "55982ee5-2ad5-4c40-8cfe-5e9e1b01500d" From 1f1d204e7a63cc28a7b81c9e87de3c11f776fe57 Mon Sep 17 00:00:00 2001 From: Kristoffer Date: Fri, 25 Nov 2022 19:19:22 +0100 Subject: [PATCH 5/7] bump Pkg version to one supporting glue --- .../Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/md5 | 1 - .../Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/sha512 | 1 - .../Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/md5 | 1 + .../Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/sha512 | 1 + stdlib/Pkg.version | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) delete mode 100644 deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/md5 delete mode 100644 deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/sha512 create mode 100644 deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/md5 create mode 100644 deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/sha512 diff --git a/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/md5 b/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/md5 deleted file mode 100644 index 8e1c22b677fcd..0000000000000 --- a/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/md5 +++ /dev/null @@ -1 +0,0 @@ -4fe1e70708ff64fae949facfa3a7d419 diff --git a/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/sha512 b/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/sha512 deleted file mode 100644 index 72bc2e7bdaf20..0000000000000 --- a/deps/checksums/Pkg-ed6a5497e46ed541b2718c404c0f468b7f92263a.tar.gz/sha512 +++ /dev/null @@ -1 +0,0 @@ -806b5e215a4670b6bceaa85b20ebf305f07fd84700e02f2471ed52c18ee01323dd151141efff1904678aedbf832b72c6ab9fb031ea30189c897d934870c99c35 diff --git a/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/md5 b/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/md5 new file mode 100644 index 0000000000000..d8d2a175b3b38 --- /dev/null +++ b/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/md5 @@ -0,0 +1 @@ +bd49ed22b9fa0f86885d26265cc09161 diff --git a/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/sha512 b/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/sha512 new file mode 100644 index 0000000000000..b1f1756fd625c --- /dev/null +++ b/deps/checksums/Pkg-f1a47ed18bd3a306e318143befe9466a5f5fd571.tar.gz/sha512 @@ -0,0 +1 @@ +c531b521fa0976f8c155d06c226824b65e3542f0c06e0b0fcb4052e6027f1baf749566e0191f8a83ab0a13165825447f71474d3685b282ffbf3e270a64e21c17 diff --git a/stdlib/Pkg.version b/stdlib/Pkg.version index faff813896433..2e77bbaf13789 100644 --- a/stdlib/Pkg.version +++ b/stdlib/Pkg.version @@ -1,4 +1,4 @@ PKG_BRANCH = master -PKG_SHA1 = ed6a5497e46ed541b2718c404c0f468b7f92263a +PKG_SHA1 = f1a47ed18bd3a306e318143befe9466a5f5fd571 PKG_GIT_URL := https://github.com/JuliaLang/Pkg.jl.git PKG_TAR_URL = https://api.github.com/repos/JuliaLang/Pkg.jl/tarball/$1 From 012b4c169aea0f742cd442a8397575147cc081bc Mon Sep 17 00:00:00 2001 From: Ian Date: Tue, 29 Nov 2022 23:50:52 -0500 Subject: [PATCH 6/7] Revert "Reintroduce SparseArrays in the system image (#46278)" This reverts commit 237c8d342ea00a74abf61100fadc73de05ce649e. --- base/sysimg.jl | 1 - test/precompile.jl | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/base/sysimg.jl b/base/sysimg.jl index ef7bad929b743..bdd383620be0c 100644 --- a/base/sysimg.jl +++ b/base/sysimg.jl @@ -59,7 +59,6 @@ let :InteractiveUtils, :LibGit2, :Profile, - :SparseArrays, :UUIDs, # 3-depth packages diff --git a/test/precompile.jl b/test/precompile.jl index 5b49ad4a3b31a..778c7dd9f6c03 100644 --- a/test/precompile.jl +++ b/test/precompile.jl @@ -372,7 +372,7 @@ precompile_test_harness(false) do dir :LazyArtifacts, :LibCURL, :LibCURL_jll, :LibGit2, :Libdl, :LinearAlgebra, :Logging, :Markdown, :Mmap, :MozillaCACerts_jll, :NetworkOptions, :OpenBLAS_jll, :Pkg, :Printf, :Profile, :p7zip_jll, :REPL, :Random, :SHA, :Serialization, :SharedArrays, :Sockets, - :SparseArrays, :TOML, :Tar, :Test, :UUIDs, :Unicode, + :TOML, :Tar, :Test, :UUIDs, :Unicode, :nghttp2_jll] ), ) From c8f1f00d81f280c7b7d4025ac67916c655d201f1 Mon Sep 17 00:00:00 2001 From: Ian Date: Wed, 30 Nov 2022 01:49:43 -0500 Subject: [PATCH 7/7] bump Statistics to trial branch --- stdlib/Statistics.version | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/stdlib/Statistics.version b/stdlib/Statistics.version index 362aec5bdc1f3..835c4695c3fdf 100644 --- a/stdlib/Statistics.version +++ b/stdlib/Statistics.version @@ -1,4 +1,4 @@ -STATISTICS_BRANCH = master -STATISTICS_SHA1 = 20fbe576ec406180b1dddf4c7fbe16458a7aef21 -STATISTICS_GIT_URL := https://github.com/JuliaStats/Statistics.jl.git -STATISTICS_TAR_URL = https://api.github.com/repos/JuliaStats/Statistics.jl/tarball/$1 +STATISTICS_BRANCH = ib/glue +STATISTICS_SHA1 = 86454ce6e8f6dc11e548921be8522d790dc1ea86 +STATISTICS_GIT_URL := https://github.com/IanButterworth/Statistics.jl.git +STATISTICS_TAR_URL = https://api.github.com/repos/IanButterworth/Statistics.jl/tarball/$1