first check-in of feisty meow codebase. many things broken still due to recent
[feisty_meow.git] / core / tools / solution_solvers / find_multilisted_projects_in_solutions.sh
1 #!/bin/bash
2
3 # this script checks all the known solution files to ensure that no project file is
4 # listed more than once in the whole set.
5
6 export errors_seen=0
7
8 # where we'll send our generated files.
9 export OUT_DIR="$TMP"
10
11 export CORE_PROJ="$OUT_DIR/core_projects.txt"
12 export SHARED_PROJ="$OUT_DIR/shared_projects.txt"
13 export MIDDLEWARE_PROJ="$OUT_DIR/middleware_projects.txt"
14
15 #hmmm: fix references!
16 # extract all the project names from the solution files.
17 bash $BUILD_TOP/build/tool_source/solution_solvers/extract_projects.sh "$BUILD_TOP/libraries/solutions/lightlink_core.sln" >"$CORE_PROJ"
18 bash $BUILD_TOP/build/tool_source/solution_solvers/extract_projects.sh "$BUILD_TOP/libraries/solutions/lightlink_shared.sln" >"$SHARED_PROJ"
19 bash $BUILD_TOP/build/tool_source/solution_solvers/extract_projects.sh "$BUILD_TOP/products/Middleware/middleware.sln" >"$MIDDLEWARE_PROJ"
20
21 export TEMP_COMPARE_FILE="$OUT_DIR/commonlines.txt"
22
23 # outer loop is all but the most dependent project.
24 for i in "$CORE_PROJ" "$SHARED_PROJ"; do
25   # inner loop is all but the most depended on project.
26   for j in "$SHARED_PROJ" "$MIDDLEWARE_PROJ"; do
27     if [ "$i" == "$j" ]; then continue; fi
28 #echo comparing $i and $j
29     comm -1 -2 "$i" "$j" >"$TEMP_COMPARE_FILE"
30     if [ -s "$TEMP_COMPARE_FILE" ]; then
31       echo "ERROR: the two files $(basename $i) and $(basename $j) share common projects."
32       ((errors_seen++))
33     fi
34   done
35 done
36
37 if [ $errors_seen -gt 0 ]; then
38   echo "ERROR: There were errors detected during the checks!"
39   exit 3
40 else
41   echo "No problems were seen in any checks."
42 fi
43