|
22 | 22 | # can exlcude directories (hard-copies of external libraries)
|
23 | 23 |
|
24 | 24 | SORTING=false
|
25 |
| -FILE1=.sort_include_1.tmp |
26 |
| -FILE2=.sort_include_2.tmp |
27 |
| -FILE3=.sort_include_3.tmp |
| 25 | +FILE1="sort_include_1.tmp" |
| 26 | +FILE2="sort_include_2.tmp" |
| 27 | +FILE3="sort_include_3.tmp" |
28 | 28 |
|
29 | 29 | # files not to be sorted (leads to compile errors otherwise)
|
30 | 30 | DoNotSort="(sqlite3.h)|(spatialite.h)"
|
31 | 31 |
|
32 | 32 | for file in $(find . \
|
33 |
| - ! -path "src/app/gps/qwtpolar-*" \ |
34 |
| - ! -path "src/core/gps/qextserialport/*" \ |
35 |
| - ! -path "src/plugins/grass/qtermwidget/*" \ |
36 |
| - ! -path "src/astyle/*" \ |
37 |
| - ! -path "python/ext-libs/*" \ |
38 |
| - ! -path "src/providers/spatialite/qspatialite/*" \ |
39 |
| - ! -path "src/plugins/dxf2shp_converter/dxflib/src/*" \ |
40 |
| - ! -path "src/plugins/globe/osgEarthQt/*" \ |
41 |
| - ! -path "src/plugins/globe/osgEarthUtil/*" \ |
42 |
| - -type f -regex "(src)|(tests)/(.+/)*.*\.\(h\|cpp\)") |
| 33 | + ! -path "./src/app/gps/qwtpolar-*" \ |
| 34 | + ! -path "./src/core/gps/qextserialport/*" \ |
| 35 | + ! -path "./src/plugins/grass/qtermwidget/*" \ |
| 36 | + ! -path "./src/astyle/*" \ |
| 37 | + ! -path "./python/ext-libs/*" \ |
| 38 | + ! -path "./src/providers/spatialite/qspatialite/*" \ |
| 39 | + ! -path "./src/plugins/dxf2shp_converter/dxflib/src/*" \ |
| 40 | + ! -path "./src/plugins/globe/osgEarthQt/*" \ |
| 41 | + ! -path "./src/plugins/globe/osgEarthUtil/*" \ |
| 42 | + -regex "./src/\(.+/\)*.*\.\(h\|cpp\)" -type f \ |
| 43 | + -or -regex "./tests/\(.+/\)*.*\.\(h\|cpp\)" -type f ) |
43 | 44 | do
|
44 | 45 | echo "$file"
|
45 | 46 | touch $FILE1
|
|
54 | 55 | if [[ "$line" =~ ^"#"include[[:space:]]*\"ui_ ]]; then
|
55 | 56 | echo "$line" >> $FILE1 # keep ui_ on top of list
|
56 | 57 | elif [[ "$line" =~ ^"#"include[[:space:]]*\<[^[:space:]]+\> ]]; then
|
57 |
| - echo "$line" >> $FILE2 |
| 58 | + echo "$line" >> $FILE2 # include <...> |
58 | 59 | else
|
59 |
| - echo "$line" >> $FILE3 |
| 60 | + echo "$line" >> $FILE3 # include "..." |
60 | 61 | fi
|
61 | 62 | else
|
62 | 63 | if $SORTING; then
|
|
68 | 69 | echo "$line" >> $FILE1
|
69 | 70 | fi
|
70 | 71 | done < "$file"
|
71 |
| - rm -f $FILE2 $FILE3 |
| 72 | + if $SORTING; then |
| 73 | + sort -u $FILE2 >> $FILE1 |
| 74 | + sort -u $FILE3 >> $FILE1 |
| 75 | + SORTING=false |
| 76 | + fi |
72 | 77 | mv $FILE1 $file
|
73 |
| - rm -f $FILE1 |
| 78 | + rm -f $FILE1 $FILE2 $FILE3 |
74 | 79 | done
|
75 | 80 |
|
0 commit comments