Skip to content

Commit fc01a53

Browse files
committed
more changes to build_all.sh
1 parent 135b935 commit fc01a53

File tree

1 file changed

+88
-69
lines changed

1 file changed

+88
-69
lines changed

misc/wiki-scripts/build_all.sh

Lines changed: 88 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -5,124 +5,143 @@
55

66
out_dir="wiki"
77
matrix_file="$out_dir/Schema-build-matrix.md"
8+
result_dir="."
89
mk="make -j4"
910

11+
#separated by ; for cmake
12+
schemas="../data/example/example.exp;../data/ap227/ap227.exp;../data/ap214e3/AP214E3_2010.exp;../data/select.exp;../data/ap203e2/ap203e2_mim_lf.exp;../data/ap203/203wseds.exp;../data/ifc2x3/IFC2X3_TC1.exp;../data/pdmnet.exp;../data/ifc2x4/IFC2X4_RC2.exp;/opt/step/notingit/part409cdts_wg3n2617mim_lf.exp;/opt/step/notingit/ap242_managed_model_based_3d_engineering_mim_lf.exp;/opt/step/notingit/AP224E3_wg3n1941.exp;/opt/step/notingit/AP238E2_aim_lf_20100903.exp"
13+
1014
#count warnings and errors, append to $matrix_file. creates hypertext links to stderr,stdout txt
11-
# $1 is the name of the row, $2 is the first part of the filename
15+
# $1 is the name of the row, $2 is the path and first part of the filename
1216
function count_we {
1317
e="$2"_stderr.txt
1418
o="$2"_stdout.txt
15-
if [ -s $e ]; then
16-
echo "<tr><td><b>$1</b></td>" >>$matrix_file
17-
echo "<td><font color="red">`grep -ci error $e` errors</font></td>" >>$matrix_file
18-
echo "<td><font color="blue">`grep -ci warning $e` warnings</font></td>" >>$matrix_file
19+
(
1920
if [ -s $e ]; then
20-
echo -n "<td><a href=" >>$matrix_file
21-
echo $e | sed -e "s|$out_dir/||;" -e "s/^\(.*fedex.*\)\.txt\s*$/\1.md/;" >>$matrix_file
22-
echo ">stderr text</a></td>" >>$matrix_file
23-
else
24-
echo "<td> ---- </td>" >>$matrix_file
25-
fi
26-
echo "</td>" >>$matrix_file
27-
else #empty
28-
echo "<tr><td><b>$1</b></td>" >>$matrix_file
29-
echo "<td><font color="red">0 errors</font></td>" >>$matrix_file
30-
echo "<td><font color="blue">0 warnings</font></td>" >>$matrix_file
31-
echo "<td> ---- </td>" >>$matrix_file
32-
if [ -f $e ]; then
33-
rm $e
21+
echo "<tr><td><b>$1</b></td>"
22+
echo "<td><font color="red">`grep -ci error $e` errors</font></td>"
23+
echo "<td><font color="blue">`grep -ci warning $e` warnings</font></td>"
24+
if [ -s $e ]; then
25+
echo -n "<td><a href="
26+
echo $e | sed -e "s|$result_dir/||;" -e "s/^\(.*\)\.txt$/\1/;"
27+
echo ">stderr text</a></td>"
28+
else
29+
echo "<td> ---- </td>"
30+
fi
31+
echo "</td>"
32+
else #empty
33+
echo "<tr><td><b>$1</b></td>"
34+
echo "<td><font color="red">0 errors</font></td>"
35+
echo "<td><font color="blue">0 warnings</font></td>"
36+
echo "<td> ---- </td>"
3437
fi
35-
fi
36-
if [ -s $o ]; then
37-
echo -n "<td><a href=" >>$matrix_file
38-
echo $o | sed -e "s|$out_dir/||;" >>$matrix_file
39-
echo ">stdout text</a></td>" >>$matrix_file
40-
else #empty
41-
echo "<td> ---- </td>" >>$matrix_file
42-
if [ -f $o ]; then
43-
rm $o
38+
if [ -s $o ]; then
39+
echo -n "<td><a href="
40+
echo $o | sed -e "s|$result_dir/||;"
41+
echo ">stdout text</a></td>"
42+
else #empty
43+
echo "<td> ---- </td>"
4444
fi
45-
fi
46-
echo "</td></tr>" >>$matrix_file
45+
echo "</td></tr>"
46+
) >>$matrix_file
4747
}
4848

4949
#make fedex warnings and errors pretty
5050
function fedex_details {
5151
(
52-
i="$out_dir/status/fedex_$1_stderr.txt"
52+
i="$result_dir/fedex_$1_stderr.txt"
5353
w=`sed -ne 's|^.*:\([0-9]\+\): WARNING: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
5454
e=`sed -ne 's|^.*:\([0-9]\+\): --ERROR: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
5555
if [ "x$w" != "x" ]; then
56-
echo "<table width=100%><tr><td><font color="blue">fedex_plus warnings</font></td></tr><tr><td><table width=100%>"
57-
echo "<tr><th>Line</th><th>Message</th>$w</table></td></tr></table>"
56+
echo "## fedex_plus warnings"
57+
echo "<table width=100%><tr><th>Line</th><th>Message</th>$w</table>"
58+
echo
5859
fi
5960
if [ "x$e" != "x" ]; then
60-
echo "<table width=100%><tr><td><font color="red">fedex_plus errors</font></td></tr><tr><td><table width=100%>"
61-
echo "<tr><th>Line</th><th>Message</th>$e</tr></table></td></tr></table>"
61+
echo "## fedex_plus errors"
62+
echo "<table width=100%><tr><th>Line</th><th>Message</th>$e</tr></table>"
63+
echo
6264
fi
6365
o=`grep -ve ": WARNING:" -e ": --ERROR:" -e ^$ $i`
6466
if [ "x$o" != "x" ]; then
65-
echo "<br><h3>Other text in file</h3>"
67+
echo "## Other text from Standard Error"
6668
echo "<pre>"
6769
sed -e 's|^.*:[0-9]\+: WARNING: .*$||g;' -e 's|^.*:[0-9]\+: --ERROR: .*$||g;' -e 's|$|\n|;' -e 's/\t/ /;' $i|grep -v ^$
6870
echo "</pre>"
71+
echo
6972
fi
70-
) >$out_dir/status/fedex_$1_stderr.md
71-
rm $out_dir/status/fedex_$1_stderr.txt
73+
if [ -s $result_dir/fedex_$1_stdout.txt ]
74+
echo "## Standard Output"
75+
cat $result_dir/fedex_$1_stdout.txt
76+
echo
77+
fi
78+
79+
# TODO rename file, put everything for one schema in one file
80+
) >$out_dir/fedex_$1_stderr.md
7281
}
7382

74-
function build_one {
83+
function build_one_schema {
7584
#set $i to the schema name, all caps (to match fedex_plus output)
7685
i=`sed -ne '0,/^\s*SCHEMA/s/^.*SCHEMA\s\+\(.*\);.*$/\1/p;' $1|tr a-z A-Z`
7786

7887
echo "Running fedex_plus and gcc for $i..."
79-
make -f data/CMakeFiles/sdai_$i.dir/build.make $i/compstructs.cc 2>"$out_dir/status/fedex_"$i"_stderr.txt" >"$out_dir/status/fedex_"$i"_stdout.txt" && \
80-
$mk sdai_$i >/dev/null 2>"$out_dir/status/compile_libsdai_"$i"_stderr.txt" && \
81-
$mk p21read_sdai_$i >/dev/null 2>"$out_dir/status/compile_p21read_sdai_"$i"_stderr.txt"
88+
make -f data/CMakeFiles/sdai_$i.dir/build.make $i/compstructs.cc 2>"$result_dir/fedex_"$i"_stderr.txt" >"$result_dir/fedex_"$i"_stdout.txt" && \
89+
$mk sdai_$i >/dev/null 2>"$result_dir/compile_libsdai_"$i"_stderr.txt" && \
90+
$mk p21read_sdai_$i >/dev/null 2>"$result_dir/compile_p21read_sdai_"$i"_stderr.txt"
8291

8392
#todo: test p21read_sdai_$i
84-
85-
#create a table for this schema in the markdown file
86-
echo "<tr><td><table width=100%><tr><th>Schema $i</th></tr><tr><td>" >>$matrix_file
87-
j=`echo $1|sed -e "s|^.*/\(.*\.exp\)$|\1|;"` # strip path from .exp file name
88-
echo "$j</td></tr><tr><td><table border=1>" >>$matrix_file
89-
count_we "fedex_plus (generate c++)" $out_dir/status/fedex_$i
90-
count_we "gcc (compile lib)" $out_dir/status/compile_libsdai_$i
91-
count_we "gcc (compile p21read)" $out_dir/status/compile_p21read_sdai_$i
92-
echo "</table></td></tr>" >>$matrix_file
93-
echo "</table></td></tr>" >>$matrix_file
94-
95-
if [ -s $out_dir/status/fedex_"$i"_stderr.txt ]; then
96-
fedex_details $i
97-
fi
9893
}
9994

100-
schemas="../data/example/example.exp;../data/ap227/ap227.exp;../data/ap214e3/AP214E3_2010.exp;../data/select.exp;../data/ap203e2/ap203e2_mim_lf.exp;../data/ap203/203wseds.exp;../data/ifc2x3/IFC2X3_TC1.exp;../data/pdmnet.exp;../data/ifc2x4/IFC2X4_RC2.exp;/opt/step/notingit/part409cdts_wg3n2617mim_lf.exp;/opt/step/notingit/ap242_managed_model_based_3d_engineering_mim_lf.exp;/opt/step/notingit/AP224E3_wg3n1941.exp;/opt/step/notingit/AP238E2_aim_lf_20100903.exp"
101-
10295
function build {
10396
echo "Running cmake..."
10497
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=OFF -DBUILD_SCHEMAS=$schemas >/dev/null
10598

10699
# build all parts of scl that are necessary for schema libs to build
100+
# when given multiple targets, cmake's makefiles don't always work well with 'make -j4' - some things get built twice, simultaneously
107101
echo "Building SCL:"
108102
$mk stepeditor | grep "^Linking"
109103
$mk fedex_plus stepdai | grep "^Linking"
110104

111105
for h in `echo $schemas | sed -e 's/;/\n/g;'`
112106
do
113-
build_one $h
107+
build_one_schema $h
108+
done
109+
}
110+
111+
function gen_wiki {
112+
echo "## `date`" >$matrix_file
113+
git log --decorate=short -n1 |\
114+
head -n1 |\
115+
sed -e 's|^.*commit \([a-z0-9]\+\) .*$|### Current as of commit [\1](http://github.com/mpictor/StepClassLibrary/commit/\1)|;' >>$matrix_file
116+
echo "<table border=1>" >>$matrix_file
117+
for h in `echo $schemas | sed -e 's/;/\n/g;'`
118+
do
119+
i=`sed -ne '0,/^\s*SCHEMA/s/^.*SCHEMA\s\+\(.*\);.*$/\1/p;' $h | tr a-z A-Z`
120+
121+
#create a table for this schema
122+
echo "<tr><td><table width=100%><tr><th>Schema $i</th></tr><tr><td>" >>$matrix_file
123+
j=`echo $1|sed -e "s|^.*/\(.*\.exp\)$|\1|;"` # strip path from .exp file name
124+
echo "$j</td></tr><tr><td><table border=1>" >>$matrix_file
125+
count_we "fedex_plus (generate c++)" $result_dir/fedex_$i
126+
count_we "gcc (compile lib)" $result_dir/compile_libsdai_$i
127+
count_we "gcc (compile p21read)" $result_dir/compile_p21read_sdai_$i
128+
echo "</table></td></tr>" >>$matrix_file
129+
echo "</table></td></tr>" >>$matrix_file
130+
if [ -s $result_dir/fedex_"$i"_stderr.txt ]; then
131+
fedex_details $i
132+
fi
114133
done
134+
echo "</table>" >>$matrix_file
135+
echo "Done!"
136+
echo "Copy everything in build_all/$out_dir to the wiki"
115137
}
116138

117-
mkdir -p build_all && cd build_all && rm -rf * && mkdir -p $out_dir/status
118-
echo "## `date`" >$matrix_file
119-
git log --decorate=short -n1 |\
120-
head -n1 |\
121-
sed -e 's|^.*commit \([a-z0-9]\+\) .*$|### Current as of commit [\1](http://github.com/mpictor/StepClassLibrary/commit/\1)|;' >>$matrix_file
122-
echo "<table border=1>" >>$matrix_file
123139

124-
build
140+
if [ ! ${PWD##*/} == "build_all" ]; then
141+
mkdir -p build_all && cd build_all && rm -rf * && mkdir -p $out_dir && mkdir -p $result_dir
142+
build
143+
echo -n "Done building. "
144+
fi
125145

126-
echo "</table>" >>$matrix_file
127-
echo "Done!"
128-
echo "Copy everything in build_all/$out_dir/ to the wiki"
146+
echo "Now creating wiki pages"
147+
gen_wiki

0 commit comments

Comments
 (0)