forked from MakieOrg/Makie.jl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
relocatability.jl
50 lines (38 loc) · 1.23 KB
/
relocatability.jl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
module_src = """
module MakieApp
using GLMakie
function julia_main()::Cint
screen = display(scatter(1:4))
# wait(screen) commented out to test if this blocks anything, but didn't change anything
return 0 # if things finished successfully
end
end # module MakieApp
"""
using Pkg, Test
makie_dir = pwd()
tmpdir = mktempdir()
# create a temporary project
cd(tmpdir)
Pkg.generate("MakieApp")
Pkg.activate("MakieApp")
paths = [makie_dir, joinpath(makie_dir, "MakieCore"), joinpath(makie_dir, "GLMakie")]
Pkg.develop(map(x-> (;path=x), paths))
open("MakieApp/src/MakieApp.jl", "w") do io
print(io, module_src)
end
Pkg.activate(".")
Pkg.add("PackageCompiler")
using PackageCompiler
create_app(joinpath(pwd(), "MakieApp"), "executable"; force=true, incremental=true, include_transitive_dependencies=false)
exe = joinpath(pwd(), "executable", "bin", "MakieApp")
@test success(`$(exe)`)
julia_pkg_dir = joinpath(Base.DEPOT_PATH[1], "packages")
@test isdir(julia_pkg_dir)
mvd_julia_pkg_dir = julia_pkg_dir * ".old"
# Move package dir so that we can test relocatability (hardcoded paths to package dir being invalid now)
try
mv(julia_pkg_dir, mvd_julia_pkg_dir)
@test success(`$(exe)`)
catch e
mv(mvd_julia_pkg_dir, julia_pkg_dir)
end