mirror of
https://github.com/ANL-CEEESA/RELOG.git
synced 2025-12-06 07:48:50 -06:00
Update sysimage and build scripts
This commit is contained in:
11
Makefile
11
Makefile
@@ -1,15 +1,11 @@
|
|||||||
JULIA := julia --color=yes --project=@.
|
JULIA := julia --project=.
|
||||||
SRC_FILES := $(wildcard src/*.jl test/*.jl)
|
SRC_FILES := $(wildcard src/*.jl test/*.jl)
|
||||||
VERSION := 0.5
|
VERSION := 0.5
|
||||||
|
|
||||||
all: docs test
|
all: docs test
|
||||||
|
|
||||||
build/sysimage.so: src/sysimage.jl Project.toml Manifest.toml
|
build/sysimage.so: src/sysimage.jl Project.toml Manifest.toml
|
||||||
mkdir -p build
|
@$(JULIA) src/sysimage.jl
|
||||||
$(JULIA) src/sysimage.jl
|
|
||||||
|
|
||||||
build/test.log: $(SRC_FILES) build/sysimage.so
|
|
||||||
cd test; $(JULIA) --sysimage ../build/sysimage.so runtests.jl
|
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf build/*
|
rm -rf build/*
|
||||||
@@ -20,7 +16,8 @@ docs:
|
|||||||
format:
|
format:
|
||||||
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true);'
|
julia -e 'using JuliaFormatter; format(["src", "test"], verbose=true);'
|
||||||
|
|
||||||
test: build/test.log
|
test:
|
||||||
|
@$(JULIA) --sysimage build/sysimage.so test/runtests.jl
|
||||||
|
|
||||||
test-watch:
|
test-watch:
|
||||||
bash -c "while true; do make test --quiet; sleep 1; done"
|
bash -c "while true; do make test --quiet; sleep 1; done"
|
||||||
|
|||||||
@@ -1,15 +1,30 @@
|
|||||||
using PackageCompiler
|
using PackageCompiler
|
||||||
|
using TOML
|
||||||
|
using Logging
|
||||||
|
|
||||||
using Cbc
|
Logging.disable_logging(Logging.Info)
|
||||||
using Clp
|
|
||||||
using Geodesy
|
|
||||||
using JSON
|
|
||||||
using JSONSchema
|
|
||||||
using JuMP
|
|
||||||
using MathOptInterface
|
|
||||||
using ProgressBars
|
|
||||||
|
|
||||||
pkg = [:Cbc, :Clp, :Geodesy, :JSON, :JSONSchema, :JuMP, :MathOptInterface, :ProgressBars]
|
mkpath("build")
|
||||||
|
|
||||||
@info "Building system image..."
|
printstyled("Generating precompilation statements...\n", color=:light_green)
|
||||||
create_sysimage(pkg, sysimage_path = "build/sysimage.so")
|
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
|
using RELOG
|
||||||
|
|
||||||
|
basedir = @__DIR__
|
||||||
|
|
||||||
@testset "Resolve" begin
|
@testset "Resolve" begin
|
||||||
# Shoud not crash
|
# Shoud not crash
|
||||||
filename = "$(pwd())/../instances/s1.json"
|
filename = "$basedir/../../instances/s1.json"
|
||||||
solution_old, model_old = RELOG.solve(filename, return_model = true)
|
solution_old, model_old = RELOG.solve(filename, return_model = true)
|
||||||
solution_new = RELOG.resolve(model_old, filename)
|
solution_new = RELOG.resolve(model_old, filename)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -4,9 +4,11 @@
|
|||||||
|
|
||||||
using RELOG, JSON, GZip
|
using RELOG, JSON, GZip
|
||||||
|
|
||||||
|
basedir = @__DIR__
|
||||||
|
|
||||||
@testset "Reports" begin
|
@testset "Reports" begin
|
||||||
@testset "from solve" begin
|
@testset "from solve" begin
|
||||||
solution = RELOG.solve("$(pwd())/../instances/s1.json")
|
solution = RELOG.solve("$basedir/../instances/s1.json")
|
||||||
tmp_filename = tempname()
|
tmp_filename = tempname()
|
||||||
# The following should not crash
|
# The following should not crash
|
||||||
RELOG.write_plant_emissions_report(solution, tmp_filename)
|
RELOG.write_plant_emissions_report(solution, tmp_filename)
|
||||||
|
|||||||
Reference in New Issue
Block a user