forked from lballabio/QuantLib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
check_filelists.sh
executable file
·82 lines (59 loc) · 2.61 KB
/
check_filelists.sh
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
77
78
79
80
81
82
#!/bin/bash
# get reference lists of existing files (done with find)
find ql -name '*.[hc]pp' -or -name '*.[hc]' \
| grep -v 'ql/config\.hpp' | sort > ql.ref.files
find test-suite -name '*.[hc]pp' \
| grep -v 'quantlibbenchmark' | grep -v '/main\.cpp' \
| sort > test-suite.ref.files
# get list of distributed files from packaged tarball
make dist
mkdir dist-check
mv QuantLib-*.tar.gz dist-check
cd dist-check
tar xfz QuantLib-*.tar.gz
rm QuantLib-*.tar.gz
cd QuantLib-*
find ql -name '*.[hc]pp' \
| grep -v 'ql/config\.hpp' | sort > ../../ql.dist.files
find test-suite -name '*.[hc]pp' \
| grep -v 'quantlibbenchmark' | grep -v '/main\.cpp' \
| sort > ../../test-suite.dist.files
cd ../..
rm -rf dist-check
# extract file names from VC++ projects and clean up so that they
# have the same format as the reference lists.
grep -o -E 'Include=".*\.[hc]pp"' QuantLib.vcxproj \
| awk -F'"' '{ print $2 }' | sed -e 's|\\|/|g' | sed -e 's|^./||' \
| sort > ql.vcx.files
grep -o -E 'Include=".*\.[hc]pp"' test-suite/testsuite.vcxproj \
| awk -F'"' '{ print $2 }' | sed -e 's|\\|/|g' | sed -e 's|^./||' \
| sed -e 's|^|test-suite/|' | sort > test-suite.vcx.files
grep -o -E 'Include=".*\.[hc]pp"' QuantLib.vcxproj.filters \
| awk -F'"' '{ print $2 }' | sed -e 's|\\|/|g' | sed -e 's|^./||' \
| sort > ql.vcx.filters.files
grep -o -E 'Include=".*\.[hc]pp"' test-suite/testsuite.vcxproj.filters \
| awk -F'"' '{ print $2 }' | sed -e 's|\\|/|g' | sed -e 's|^./||' \
| sed -e 's|^|test-suite/|' | sort > test-suite.vcx.filters.files
# same with CMakelists
# reference files above align only to autotools build system
grep -o -E '[a-zA-Z0-9_/\.]*\.[hc]pp' ql/CMakeLists.txt \
| grep -v 'ql/config\.hpp' | sed -e 's|/ql/||' | sed -e 's|^|ql/|' | sort > ql.cmake.files
grep -o -E '[a-zA-Z0-9_/\.]*\.[hc]pp' test-suite/CMakeLists.txt \
| grep -v 'quantlibbenchmark' | grep -v 'main\.cpp' \
| sed -e 's|^|test-suite/|' | sort -u > test-suite.cmake.files
# write out differences...
diff -b ql.dist.files ql.ref.files > ql.dist.diff
diff -b test-suite.dist.files test-suite.ref.files > test-suite.dist.diff
diff -b ql.cmake.files ql.ref.files > ql.cmake.diff
diff -b test-suite.cmake.files test-suite.ref.files > test-suite.cmake.diff
diff -b ql.vcx.files ql.ref.files > ql.vcx.diff
diff -b test-suite.vcx.files test-suite.ref.files > test-suite.vcx.diff
diff -b ql.vcx.filters.files ql.ref.files > ql.vcx.filters.diff
diff -b test-suite.vcx.filters.files test-suite.ref.files > test-suite.vcx.filters.diff
# ...process...
./tools/check_filelists_diffs.py
result=$?
# ...and cleanup
rm -f ql.*.files test-suite.*.files
rm -f ql.*.diff test-suite.*.diff
exit $result