@@ -93,6 +93,58 @@ if !test_relocated_depot
93
93
end
94
94
end
95
95
96
+ @testset " #52161" begin
97
+ # Take the src files from two RelocationTestPkg1 and RelocationTestPkg2,
98
+ # which are each located in depot1 and depot2, respectively, and
99
+ # add them as include_dependency()s to a new pkg Foo, which will be precompiled into depot3.
100
+ # After loading the include_dependency()s of Foo should refer to depot1 depot2 each.
101
+ test_harness () do
102
+ mktempdir () do depot1
103
+ # precompile RelocationTestPkg1 in depot1
104
+ cp (joinpath (@__DIR__ ," RelocationTestPkg1" ),joinpath (depot1," RelocationTestPkg1" ))
105
+ pushfirst! (LOAD_PATH , depot1)
106
+ pushfirst! (DEPOT_PATH , depot1)
107
+ pkg = Base. identify_package (" RelocationTestPkg1" )
108
+ Base. require (pkg)
109
+ mktempdir () do depot2
110
+ cp (joinpath (@__DIR__ ," RelocationTestPkg2" ),joinpath (depot2," RelocationTestPkg2" ))
111
+ # precompile RelocationTestPkg2 in depot2
112
+ pushfirst! (LOAD_PATH , depot2)
113
+ pushfirst! (DEPOT_PATH , depot2)
114
+ pkg = Base. identify_package (" RelocationTestPkg2" )
115
+ Base. require (pkg)
116
+ # precompile Foo into in depot3
117
+ mktempdir () do depot3
118
+ pushfirst! (LOAD_PATH , depot3)
119
+ pushfirst! (DEPOT_PATH , depot3)
120
+ foofile = joinpath (depot3, " Foo.jl" )
121
+ write (foofile, """
122
+ module Foo
123
+ using RelocationTestPkg1
124
+ using RelocationTestPkg2
125
+ srcfile1 = joinpath(pkgdir(RelocationTestPkg1), "src", "RelocationTestPkg1.jl")
126
+ srcfile2 = joinpath(pkgdir(RelocationTestPkg2), "src", "RelocationTestPkg2.jl")
127
+ @show srcfile1
128
+ @show srcfile2
129
+ include_dependency(srcfile1)
130
+ include_dependency(srcfile2)
131
+ end
132
+ """ )
133
+ pkg = Base. identify_package (" Foo" )
134
+ Base. require (pkg)
135
+ cachefile = joinpath (depot3, " compiled" , " v1.11" , " Foo.ji" )
136
+ _, (deps, _, _), _... = Base. parse_cache_header (cachefile)
137
+ @test map (x -> x. filename, deps) ==
138
+ [ joinpath (depot3, " Foo.jl" ),
139
+ joinpath (depot1, " RelocationTestPkg1" , " src" , " RelocationTestPkg1.jl" ),
140
+ joinpath (depot2, " RelocationTestPkg2" , " src" , " RelocationTestPkg2.jl" ) ]
141
+ end
142
+ end
143
+ end
144
+ end
145
+ end
146
+
147
+
96
148
else
97
149
98
150
@testset " load stdlib from test/relocatedepot" begin
0 commit comments