-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.jl
executable file
·62 lines (53 loc) · 1.57 KB
/
install.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
51
52
53
54
55
56
57
58
59
60
61
62
#!/usr/bin/env -S julia --threads=4 --startup=no --color yes
NEEDED_VERSION = v"1.10"
if VERSION < NEEDED_VERSION
throw("Currently running Julia $VERSION but the ASKEM environment requires $NEEDED_VERSION")
end
import Pkg
Pkg.activate(".")
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/JuliaRegistries/General.git"))
Pkg.Registry.add(Pkg.RegistrySpec(url="https://github.com/mimiframework/MimiRegistry.git"))
Pkg.instantiate()
target = !(length(ARGS) == 0) ? lowercase(ARGS[1]) : "local"
env_dir =
if target == "local"
env_dir = homedir() * "/.julia/environments/askem/"
if !isdir(env_dir)
mkpath(env_dir)
else
@warn "An ASKEM environment is already installed.\n Would you like to overwrite your current ASKEM environment? [yes/no]"
if lowercase(readline()) != "yes"
@info "Canceling install..."
exit()
end
@warn "Overwriting ASKEM environment...."
end
cp("Project.toml", env_dir * "Project.toml"; force=true)
cp("Manifest.toml", env_dir * "Manifest.toml"; force=true)
env_dir
else
"/"
end
Pkg.activate(env_dir)
Pkg.instantiate()
Pkg.precompile()
import PrecompileTools: @compile_workload, @recompile_invalidations
@recompile_invalidations begin
using Decapodes
end
@compile_workload begin
include("./precompile.jl")
end
if target == "local"
@info """
Run either
```
julia # enter the Julia Repl
julia> ] activate @askem
```
or
```
julia --project="@askem" --startup=no --color yes
```
"""
end