Update sysimage and build scripts

feature/collection-disposal
Alinson S. Xavier 4 years ago
parent 9ebb2e49f9
commit ee58af73f0

@ -1,15 +1,11 @@
JULIA := julia --color=yes --project=@.
JULIA := julia --project=.
SRC_FILES := $(wildcard src/*.jl test/*.jl)
VERSION := 0.5
all: docs test
build/sysimage.so: src/sysimage.jl Project.toml Manifest.toml
mkdir -p build
$(JULIA) src/sysimage.jl
build/test.log: $(SRC_FILES) build/sysimage.so
cd test; $(JULIA) --sysimage ../build/sysimage.so runtests.jl
@$(JULIA) src/sysimage.jl
clean:
rm -rf build/*
@ -20,7 +16,8 @@ docs:
format:
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true);'
test: build/test.log
test:
@$(JULIA) --sysimage build/sysimage.so test/runtests.jl
test-watch:
bash -c "while true; do make test --quiet; sleep 1; done"

@ -1,15 +1,30 @@
using PackageCompiler
using TOML
using Logging
using Cbc
using Clp
using Geodesy
using JSON
using JSONSchema
using JuMP
using MathOptInterface
using ProgressBars
Logging.disable_logging(Logging.Info)
pkg = [:Cbc, :Clp, :Geodesy, :JSON, :JSONSchema, :JuMP, :MathOptInterface, :ProgressBars]
mkpath("build")
@info "Building system image..."
create_sysimage(pkg, sysimage_path = "build/sysimage.so")
printstyled("Generating precompilation statements...\n", color=:light_green)
run(`julia --project=. --trace-compile=build/precompile.jl $ARGS`)
printstyled("Finding dependencies...\n", color=:light_green)
project = TOML.parsefile("Project.toml")
manifest = TOML.parsefile("Manifest.toml")
deps = Symbol[]
for dep in keys(project["deps"])
if "path" in keys(manifest[dep][1])
printstyled(" skip $(dep)\n", color=:light_black)
else
println(" add $(dep)")
push!(deps, Symbol(dep))
end
end
printstyled("Building system image...\n", color=:light_green)
create_sysimage(
deps,
precompile_statements_file = "build/precompile.jl",
sysimage_path = "build/sysimage.so",
)

@ -3,9 +3,11 @@
using RELOG
basedir = @__DIR__
@testset "Resolve" begin
# Shoud not crash
filename = "$(pwd())/../instances/s1.json"
filename = "$basedir/../../instances/s1.json"
solution_old, model_old = RELOG.solve(filename, return_model = true)
solution_new = RELOG.resolve(model_old, filename)
end

@ -4,9 +4,11 @@
using RELOG, JSON, GZip
basedir = @__DIR__
@testset "Reports" begin
@testset "from solve" begin
solution = RELOG.solve("$(pwd())/../instances/s1.json")
solution = RELOG.solve("$basedir/../instances/s1.json")
tmp_filename = tempname()
# The following should not crash
RELOG.write_plant_emissions_report(solution, tmp_filename)

Loading…
Cancel
Save