cd(@__DIR__)

module Tools

function run_julia(args...)
    cd(@__DIR__)
    julia = Base.julia_cmd()[1]
    @time run(`$julia --color=yes --startup-file=no --project $args`)
    nothing
end

setup() = run_julia("setup.jl")

compile() = run_julia("compile.jl")

function weave()
    cd(@__DIR__)

    opts = String[]
    if isfile("Exercice.so")
        @info "Using custom system image: Exercice.so"
        push!(opts, "-JExercice.so")
    end

    run_julia(opts..., "weave.jl")
end

end

nothing
