forked from lbl-srg/modelica-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
76 lines (60 loc) · 2.46 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
##########################################
# Makefile to build and test the project
#########################################
ifeq ($(wildcard ./apache_maven/bin/mvn),)
MVN = mvn # Use maven from system installation
else
MVN = ../apache_maven/bin/mvn
endif
.PHONY: install-maven install-node-packages install compile test run compile-java generate-reference-output clean-node-packages clean-maven clean-installation
# download maven source file to current directory and change its name
install-maven:
@echo "Installing maven"
curl http://apache.mirrors.lucidnetworks.net/maven/maven-3/3.6.3/binaries/apache-maven-3.6.3-bin.tar.gz > apache-maven.tar.gz
mkdir -p apache_maven
tar xzf apache-maven.tar.gz -C apache_maven --strip-components 1
rm -rf apache-maven.tar.gz
install-node-packages:
npm install --save
install: install-maven install-node-packages
compile:
@echo "Compiling java to produce jar"
cd java && $(MVN) package
mv java/parser/target/parser-1.0-SNAPSHOT-jar-with-dependencies.jar java/moParser.jar
cd java && $(MVN) clean
test:
npm test
test-moParser:
java -jar java/moParser.jar --mo test/FromModelica/Block1.mo
# Target to generate reference output files
# This only needs to be run when the output format changes,
# or when new tests are added.
generate-reference-output:
(cd test/FromModelica && \
for ff in `find . -name '*.mo'`; do \
node ../../app.js -l warn -f $${ff} -o raw-json -d ./cdl -m cdl; \
node ../../app.js -l warn -f $${ff} -o json -d ./cdl -m cdl; \
node ../../app.js -l warn -f $${ff} -o svg -d ./cdl -m cdl; \
node ../../app.js -l warn -f $${ff} -o html -d ./cdl -m cdl; \
node ../../app.js -l warn -f $${ff} -o docx -d ./cdl -m cdl; \
done)
(cd test && \
node ../app.js -l warn -f FromModelica -o raw-json -d ./FromModelica/modelica -m modelica; \
node ../app.js -l warn -f FromModelica -o json -d ./FromModelica/modelica -m modelica; \
node ../app.js -l warn -f FromModelica -o html -d ./FromModelica/modelica -m modelica; \
node ../app.js -l warn -f FromModelica -o docx -d ./FromModelica/modelica -m modelica)
rm -f test/modelica-json.log test/FromModelica/modelica-json.log
clean-node-packages:
rm -rf node-modules
clean-maven:
rm -rf apache_maven
clean-installation: clean-node-packages clean-maven
run:
node app.js \
--log warn \
-f Buildings/Controls/OBC/ASHRAE/G36_PR1/AHUs/MultiZone/VAV/Economizers/Controller.mo \
-o html
ibpsa-library:
node app.js \
-o json \
-f IBPSA/Fluid/FixedResistances/HydraulicDiameter.mo