Skip to content

Commit

Permalink
Add etc/is_loaded_directly_tool.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
lgoettgens committed Oct 28, 2024
1 parent 4c5f377 commit 768a505
Show file tree
Hide file tree
Showing 6 changed files with 46 additions and 0 deletions.
5 changes: 5 additions & 0 deletions etc/is_loaded_directly/PkgA/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = "PkgA"
uuid = "6c9b85ad-11d6-47d3-a110-c5d298566edc"

[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
10 changes: 10 additions & 0 deletions etc/is_loaded_directly/PkgA/src/PkgA.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module PkgA

import AbstractAlgebra: is_loaded_directly

function __init__()
println("PkgA is loaded directly: ", is_loaded_directly())
end


end # module PkgA
5 changes: 5 additions & 0 deletions etc/is_loaded_directly/PkgB/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
name = "PkgB"
uuid = "f73b4364-4a9c-47d5-9866-25d0a9321a67"

[deps]
PkgA = "6c9b85ad-11d6-47d3-a110-c5d298566edc"
5 changes: 5 additions & 0 deletions etc/is_loaded_directly/PkgB/src/PkgB.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module PkgB

using PkgA

end # module PkgB
4 changes: 4 additions & 0 deletions etc/is_loaded_directly/Project.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[deps]
AbstractAlgebra = "c3fe647b-3220-5bb0-a1ea-a7954cac585d"
PkgA = "6c9b85ad-11d6-47d3-a110-c5d298566edc"
PkgB = "f73b4364-4a9c-47d5-9866-25d0a9321a67"
17 changes: 17 additions & 0 deletions etc/is_loaded_directly_tool.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using Pkg
cd(joinpath(@__DIR__, "is_loaded_directly"))
Pkg.activate(".")
Pkg.develop(PackageSpec(path="PkgA"))
Pkg.develop(PackageSpec(path="PkgB"))
Pkg.develop(PackageSpec(path=joinpath("..", "..")))
Pkg.precompile()

println("####### Loading PkgA directly")
withenv("JULIA_DEBUG" => "AbstractAlgebra") do
run(`$(Base.julia_cmd()) --project=. -e 'using PkgA'`)
end

println("####### Loading PkgA indirectly")
withenv("JULIA_DEBUG" => "AbstractAlgebra") do
run(`$(Base.julia_cmd()) --project=. -e 'using PkgB'`)
end

0 comments on commit 768a505

Please sign in to comment.