-
Notifications
You must be signed in to change notification settings - Fork 139
/
Makefile
76 lines (60 loc) · 3.32 KB
/
Makefile
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# This Makefile exists to ease common maven commands
# like running test suites
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
DATE := $(shell date +'%y%m%d_%H:%M')
CURRENT_VERSION := $(shell mvn help:evaluate -Dexpression=project.version | grep -v "\[INFO\]" | grep -v "\[WARNING\]")
.PHONY: all clean compile tests 1s 10s ibex checker mzn xcsp mps dimacs expl update_date compet msc delmsc help
.DEFAULT_GOAL := package
help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " all to clean, compile and package the project"
@echo " package to clean and package the project"
@echo " install to clean and install the project"
@echo " clean to clean the project"
@echo " compile to compile the project"
@echo " tests to run all tests"
@echo " 1s to run all tests in 1s"
@echo " 10s to run all tests in 10s"
@echo " ibex to run all tests with ibex"
@echo " checker to run all tests with checker"
@echo " mzn to run all tests with mzn"
@echo " xcsp to run all tests with xcsp"
@echo " mps to run all tests with mps"
@echo " dimacs to run all tests with dimacs"
@echo " expl to run all tests with expl"
@echo " update_date to update the date in the parsers"
@echo " compet to update the date, clean and package the project"
@echo " msc for MiniZincIDE, to install the msc file in ~/.minizinc/solvers"
@echo " delmsc VERSION=xxx for MiniZincIDE, to delete the msc file in ~/.minizinc/solvers"
@echo " antlr to compile the antlr grammar"
all: clean package
package: clean
mvn -q package -DskipTests
install: clean
mvn -q install -DskipTests
clean:
mvn -q clean
compile:
mvn -q compile -DskipTests
tests : 1s 10s ibex checker mzn xcsp mps dimacs expl
1s 10s ibex checker mzn xcsp mps dimacs : compile
mvn -q test -DtestFailureIgnore=true -Dgroups="$@"
update_date:
@sed -i '' 's| System.out.println("c Choco .*| System.out.println("c Choco $(DATE)");|' parsers/src/main/java/org/chocosolver/parser/xcsp/XCSP.java
@sed -i '' 's| System.out.println("%% Choco .*| System.out.println("%% Choco $(DATE)");|' parsers/src/main/java/org/chocosolver/parser/flatzinc/Flatzinc.java
compet: update_date clean package
msc: compet
@sed -i '' 's| "version": .*| "version" : "$(CURRENT_VERSION)",|' parsers/src/main/minizinc/choco.msc
@sed -i '' 's|SNAPSHOT|$(DATE)|g' parsers/src/main/minizinc/choco.msc
@sed -i '' 's| "mznlib": .*| "mznlib" : "$(ROOT_DIR)/parsers/src/main/minizinc/mzn_lib/",|' parsers/src/main/minizinc/choco.msc
@sed -i '' 's| "executable": .*| "executable" : "$(ROOT_DIR)/parsers/src/main/minizinc/fzn-choco",|' parsers/src/main/minizinc/choco.msc
@sed -i '' 's|^[^ ]*CHOCO_JAR=.*|CHOCO_JAR=$(ROOT_DIR)/parsers/target/choco-parsers-$(CURRENT_VERSION)-light.jar|' parsers/src/main/minizinc/fzn-choco
@cp $(ROOT_DIR)/parsers/src/main/minizinc/choco.msc ~/.minizinc/solvers/choco-$(CURRENT_VERSION)-$(DATE).msc
delmsc:
@rm ~/.minizinc/solvers/choco-$(VERSION).msc
docker: compet
@docker build -f $(ROOT_DIR)/parsers/src/main/minizinc/docker/Dockerfile.dms -t chocoteam/choco-solver-mzn:$(CURRENT_VERSION) $(ROOT_DIR)
antlr:
cd parsers/
mvn org.antlr:antlr4-maven-plugin:antlr4
cd ..