Skip to content

Commit 553091c

Browse files
committed
wiki links finally work... I think
1 parent fc01a53 commit 553091c

File tree

1 file changed

+73
-48
lines changed

1 file changed

+73
-48
lines changed

misc/wiki-scripts/build_all.sh

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ mk="make -j4"
1212
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"
1313

1414
#count warnings and errors, append to $matrix_file. creates hypertext links to stderr,stdout txt
15-
# $1 is the name of the row, $2 is the path and first part of the filename
15+
# $1 is the name of the row, $2 is the path and first part of the filename, $3 is the schema
1616
function count_we {
1717
e="$2"_stderr.txt
1818
o="$2"_stdout.txt
@@ -22,9 +22,7 @@ function count_we {
2222
echo "<td><font color="red">`grep -ci error $e` errors</font></td>"
2323
echo "<td><font color="blue">`grep -ci warning $e` warnings</font></td>"
2424
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>"
25+
echo -n "<td><a href=schema_$3#wiki-$1_e>stderr text</a></td>"
2826
else
2927
echo "<td> ---- </td>"
3028
fi
@@ -36,9 +34,7 @@ function count_we {
3634
echo "<td> ---- </td>"
3735
fi
3836
if [ -s $o ]; then
39-
echo -n "<td><a href="
40-
echo $o | sed -e "s|$result_dir/||;"
41-
echo ">stdout text</a></td>"
37+
echo -n "<td><a href=schema_$3wiki-#$1_o>stdout text</a></td>"
4238
else #empty
4339
echo "<td> ---- </td>"
4440
fi
@@ -48,36 +44,36 @@ function count_we {
4844

4945
#make fedex warnings and errors pretty
5046
function fedex_details {
51-
(
52-
i="$result_dir/fedex_$1_stderr.txt"
53-
w=`sed -ne 's|^.*:\([0-9]\+\): WARNING: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
54-
e=`sed -ne 's|^.*:\([0-9]\+\): --ERROR: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
55-
if [ "x$w" != "x" ]; then
56-
echo "## fedex_plus warnings"
57-
echo "<table width=100%><tr><th>Line</th><th>Message</th>$w</table>"
58-
echo
59-
fi
60-
if [ "x$e" != "x" ]; then
61-
echo "## fedex_plus errors"
62-
echo "<table width=100%><tr><th>Line</th><th>Message</th>$e</tr></table>"
63-
echo
64-
fi
65-
o=`grep -ve ": WARNING:" -e ": --ERROR:" -e ^$ $i`
66-
if [ "x$o" != "x" ]; then
67-
echo "## Other text from Standard Error"
68-
echo "<pre>"
69-
sed -e 's|^.*:[0-9]\+: WARNING: .*$||g;' -e 's|^.*:[0-9]\+: --ERROR: .*$||g;' -e 's|$|\n|;' -e 's/\t/ /;' $i|grep -v ^$
70-
echo "</pre>"
71-
echo
72-
fi
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
47+
i="$result_dir/fedex_$1_stderr.txt"
48+
w=`sed -ne 's|^.*:\([0-9]\+\): WARNING: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
49+
e=`sed -ne 's|^.*:\([0-9]\+\): --ERROR: \(.*\)$|<tr><td>\1</td><td>\2</td></tr>|p;' $i`
50+
if [ "x$w" != "x" ]; then
51+
echo "<a name=\"fedex_plus_w\">" #enable jumping to this location in the file
52+
echo "### fedex_plus warnings"
53+
echo "</a><table width=100%><tr><th>Line</th><th>Message</th>$w</table>"
54+
echo
55+
fi
56+
if [ "x$e" != "x" ]; then
57+
echo "<a name=\"fedex_plus_e\">"
58+
echo "### fedex_plus errors"
59+
echo "</a><table width=100%><tr><th>Line</th><th>Message</th>$e</tr></table>"
60+
echo
61+
fi
62+
o=`grep -ve ": WARNING:" -e ": --ERROR:" -e ^$ $i`
63+
if [ "x$o" != "x" ]; then
64+
echo "### Other text from Standard Error"
65+
echo "<pre>"
66+
sed -e 's|^.*:[0-9]\+: WARNING: .*$||g;' -e 's|^.*:[0-9]\+: --ERROR: .*$||g;' -e 's|$|\n|;' -e 's/\t/ /;' $i|grep -v ^$
67+
echo "</pre>"
68+
echo
69+
fi
70+
if [ -s $result_dir/fedex_$1_stdout.txt ]; then
71+
echo "<a name=\"fedex_plus_o\">"
72+
echo "### Standard Output"
73+
echo "</a><pre>"
74+
cat $result_dir/fedex_$1_stdout.txt
75+
echo "</pre>"
76+
fi
8177
}
8278

8379
function build_one_schema {
@@ -108,40 +104,69 @@ function build {
108104
done
109105
}
110106

107+
function make_schema_page {
108+
# $1 is schema name, i.e. AUTOMOTIVE_DESIGN, $2 is schema *file* name, i.e. ap214e3_mim_lf.exp
109+
echo "## File $2"
110+
echo "### Schema $1"
111+
fedex_details $1
112+
echo "<a name=\"lib_e\"></a><a name=\"lib_w\"></a>"
113+
echo "### stderr from compiling lib"
114+
if [ -s $result_dir/compile_libsdai_${1}_stderr.txt ]; then
115+
echo "<pre>"
116+
cat $result_dir/compile_libsdai_${1}_stderr.txt
117+
echo "</pre>"
118+
fi
119+
echo "<a name=\"p21read_e\"></a><a name=\"p21read_w\"></a>"
120+
echo "### stderr from compiling p21read"
121+
if [ -s $result_dir/compile_p21read_sdai_${1}_stderr.txt ]; then
122+
echo "<pre>"
123+
cat $result_dir/compile_p21read_sdai_${1}_stderr.txt
124+
echo "</pre>"
125+
fi
126+
echo "### end"
127+
}
128+
111129
function gen_wiki {
112130
echo "## `date`" >$matrix_file
113131
git log --decorate=short -n1 |\
114132
head -n1 |\
115133
sed -e 's|^.*commit \([a-z0-9]\+\) .*$|### Current as of commit [\1](http://github.com/mpictor/StepClassLibrary/commit/\1)|;' >>$matrix_file
116134
echo "<table border=1>" >>$matrix_file
135+
echo "<tr><th>Key</th></tr><tr><td><table width=100%>" >>$matrix_file
136+
echo "<tr><th>Item</th><th>Description</th></tr>" >>$matrix_file
137+
echo "<tr><td>fedex_plus</td><td>Generate c++ from an EXPRESS schema</td></tr>" >>$matrix_file
138+
echo "<tr><td>lib</td><td>Compile the generated c++ into a library</td></tr>" >>$matrix_file
139+
echo "<tr><td>p21read</td><td>Compile a p21read app, linked against the above library</td></tr>" >>$matrix_file
140+
echo "</table></td></tr>" >>$matrix_file
117141
for h in `echo $schemas | sed -e 's/;/\n/g;'`
118142
do
119143
i=`sed -ne '0,/^\s*SCHEMA/s/^.*SCHEMA\s\+\(.*\);.*$/\1/p;' $h | tr a-z A-Z`
120144

121145
#create a table for this schema
122146
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
147+
j=${h##*/} #schema file name, without dirs
124148
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
149+
count_we "fedex_plus" $result_dir/fedex_$i $i
150+
count_we "lib" $result_dir/compile_libsdai_$i $i
151+
count_we "p21read" $result_dir/compile_p21read_sdai_$i $i
128152
echo "</table></td></tr>" >>$matrix_file
129153
echo "</table></td></tr>" >>$matrix_file
130-
if [ -s $result_dir/fedex_"$i"_stderr.txt ]; then
131-
fedex_details $i
132-
fi
154+
# if [ -s $result_dir/fedex_"$i"_stderr.txt ]; then
155+
# fedex_details $i
156+
# fi
157+
make_schema_page $i $j >$out_dir/schema_$i.md
133158
done
134159
echo "</table>" >>$matrix_file
135-
echo "Done!"
136-
echo "Copy everything in build_all/$out_dir to the wiki"
137160
}
138161

139-
162+
# if pwd is build_all, assume everything is up to date and just create wiki pages
140163
if [ ! ${PWD##*/} == "build_all" ]; then
141164
mkdir -p build_all && cd build_all && rm -rf * && mkdir -p $out_dir && mkdir -p $result_dir
142165
build
143166
echo -n "Done building. "
144167
fi
145168

146-
echo "Now creating wiki pages"
169+
echo "Creating wiki pages..."
147170
gen_wiki
171+
echo "Done!"
172+
echo "Copy everything in build_all/$out_dir to the wiki"

0 commit comments

Comments
 (0)