|
| 1 | +#!/bin/sh |
| 2 | + |
| 3 | +out_dir="wiki-dir" |
| 4 | +matrix_file="$out_dir/Schema-build-matrix.md" |
| 5 | +mk="make -j4" |
| 6 | + |
| 7 | +#count warnings and errors, append to $matrix_file |
| 8 | +function count_we { |
| 9 | + echo "<tr><td><b>$1</b></td>" >>$matrix_file |
| 10 | + echo "<td><font color="blue">0 warnings</font></td>" >>$matrix_file |
| 11 | + echo "<td><font color="red">0 errors</font></td><td>" >>$matrix_file |
| 12 | + if [ -s $2 ]; then |
| 13 | + echo "<td><font color="blue">`grep -ci warning $2` warnings</font></td>" >>$matrix_file |
| 14 | + echo "<td><font color="red">`grep -ci error $2` errors</font></td><td>" >>$matrix_file |
| 15 | + echo -n "<a href=" >>$matrix_file |
| 16 | + echo $2 | sed -e "s/^\(fedex.*\)\.txt\s*$/\1.md/;" >>$matrix_file |
| 17 | + echo ">full text</a>" >>$matrix_file |
| 18 | + else |
| 19 | + if [ -f $2 ]; then |
| 20 | + rm $2 |
| 21 | + fi |
| 22 | + fi |
| 23 | + echo "</td></tr>" >>$matrix_file |
| 24 | +} |
| 25 | + |
| 26 | +#make fedex warnings and errors pretty |
| 27 | +function fedex_details { |
| 28 | + ( |
| 29 | + i="$out_dir/fedex_$1_stderr.txt" |
| 30 | + w=`sed -ne 's|^.*:\([0-9]\+\): WARNING: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i` |
| 31 | + e=`sed -ne 's|^.*:\([0-9]\+\): --ERROR: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i` |
| 32 | + if [ "x$w" != "x" ]; then |
| 33 | + echo "<table width=100%><tr><td><font color="blue">fedex_plus warnings</font></td></tr><tr><td><table width=100%>" |
| 34 | + echo "<tr><th>Line</th><th>Message</th>$w</table></td></tr></table>" |
| 35 | + fi |
| 36 | + if [ "x$e" != "x" ]; then |
| 37 | + echo "<table width=100%><tr><td><font color="red">fedex_plus errors</font></td></tr><tr><td><table width=100%>" |
| 38 | + echo "<tr><th>Line</th><th>Message</th>$e</table></td></tr></table>" |
| 39 | + fi |
| 40 | + o=`sed -e 's|^.*:[0-9]\+: WARNING: .*$||g;' -e 's|^.*:[0-9]\+: --ERROR: .*$||g;' $i` |
| 41 | + if [ "x$e" != "x" ]; then |
| 42 | + echo "<br><h3>Other text in file</h3>" |
| 43 | + echo "<pre>" |
| 44 | + echo $o |
| 45 | + echo "</pre>" |
| 46 | + fi |
| 47 | + ) >$out_dir/fedex_$1_stderr.md |
| 48 | +} |
| 49 | + |
| 50 | +function build_one { |
| 51 | + #set $i to the schema name, all caps (to match fedex_plus output) |
| 52 | + i=`sed -ne '0,/^\s*SCHEMA/s/^.*SCHEMA\s\+\(.*\);.*$/\1/p;' $1|tr a-z A-Z` |
| 53 | + |
| 54 | + echo "Running fedex_plus for $i..." |
| 55 | + make -f data/CMakeFiles/sdai_$i.dir/build.make $i/compstructs.cc >/dev/null 2>"$out_dir/fedex_"$i"_stderr.txt" >"$out_dir/fedex_"$i"_stdout.txt" && \ |
| 56 | + $mk sdai_$i >/dev/null 2>"$out_dir/compile_libsdai_"$i"_stderr.txt" && \ |
| 57 | + $mk p21read_sdai_$i >/dev/null 2>"$out_dir/compile_p21read_sdai_"$i"_stderr.txt" |
| 58 | + |
| 59 | + #todo: test p21read_sdai_$i |
| 60 | + |
| 61 | + #create a table for this schema in the markdown file |
| 62 | + echo "<tr><td><table width=100%><tr><th>Schema $i</th></tr><tr><td>" >>$matrix_file |
| 63 | + j=`echo $1|sed -e "s|^.*/\(.*\.exp\)$|\1|;"` #j is the name of the express file |
| 64 | + echo "$j</td></tr><tr><td><table border=1>" >>$matrix_file |
| 65 | + count_we "fedex_plus (generate c++)" $out_dir/fedex_"$i"_stderr.txt |
| 66 | + count_we "gcc (compile lib)" $out_dir/compile_libsdai_"$i"_stderr.txt |
| 67 | + count_we "gcc (compile p21read)" $out_dir/compile_p21read_sdai_"$i"_stderr.txt |
| 68 | + echo "</table></td></tr>" >>$matrix_file |
| 69 | + echo "</table></td></tr>" >>$matrix_file |
| 70 | + |
| 71 | + if [ -s $out_dir/fedex_"$i"_stderr.txt ]; then |
| 72 | + fedex_details $i |
| 73 | + fi |
| 74 | +} |
| 75 | + |
| 76 | +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" |
| 77 | + |
| 78 | +#schemas="../data/example/example.exp;../data/ap203/203wseds.exp;../data/ap203e2/ap203e2_mim_lf.exp" |
| 79 | + |
| 80 | +function build { |
| 81 | + cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_STATIC_LIBS=OFF -DBUILD_SCHEMAS=$schemas |
| 82 | + |
| 83 | + # build all parts of scl that are necessary for schema libs to build |
| 84 | + echo Building SCL... |
| 85 | + $mk stepeditor | grep "^Linking" |
| 86 | + $mk fedex_plus stepdai | grep "^Linking" |
| 87 | + |
| 88 | + for h in `echo $schemas | sed -e 's/;/\n/g;'` |
| 89 | + do |
| 90 | + build_one $h |
| 91 | + done |
| 92 | +} |
| 93 | + |
| 94 | +mkdir -p build_all && cd build_all && rm -rf * && mkdir $out_dir |
| 95 | +echo "## `date`" >$matrix_file |
| 96 | +git log --decorate=short -n1 |\ |
| 97 | + head -n1 |\ |
| 98 | + sed -e 's|^.*commit \([a-z0-9]\+\) .*$|### commit [\1](http://github.com/mpictor/StepClassLibrary/commit/\1)|;' >>$matrix_file |
| 99 | +echo "<table border=1>" >>$matrix_file |
| 100 | + |
| 101 | +build |
| 102 | + |
| 103 | +echo "</table>" >>$matrix_file |
0 commit comments