3 # this script locates the solution that a project file belongs in and decides whether the
4 # project file contains any bad references to projects that are outside of its solution.
8 if [ -z "$proj_file" ]; then
9 echo This script needs one parameter that is a project file to be verified.
10 echo The file will be located in a solution file, and then checked for all project
11 echo references being in the same solution file.
17 # look for the solution that a project belongs to.
18 function find_solution_membership()
20 local proj="$1"; shift
22 for i in ${SOLUTIONS[*]}; do
23 # secret sauce--don't match on any old reference to the file; we need
24 # it to be coming from the real project definition.
25 grep -i "$proj\"," "$i" &>/dev/null
27 #echo "$proj found in solution $i"
34 function complain_about_project()
38 echo "Project $proj_base is in error (at $proj_file)"
39 echo "it references project $filename which is external to the solution."
46 proj_base="$(basename $proj_file)"
48 CHECKERS="$TMP/checking_refs.txt"
52 #hmmm fix this for big time
53 export SOLUTIONS=("$BUILD_TOP/libraries/solutions/"*.sln "$BUILD_TOP/products/"*/*.sln)
55 find_solution_membership "$proj_base"
57 #echo found sol is $found_solution
59 if [ -z "$found_solution" ]; then
60 echo error: could not find the solution containing $proj_base
64 # get all the project references from the project file being tested.
65 #hmmm: fix this path to extract!
66 bash "$BUILD_TOP/build/tool_source/solution_solvers/extract_projects.sh" "$proj_file" >"$CHECKERS"
68 # iterate over all references in the project file.
70 grep -i "$line" "$found_solution" &>/dev/null
72 complain_about_project "$line"
76 if [ $errors_seen -eq 0 ]; then
77 echo "project $proj_base is clean."
79 echo "ERROR: there were $errors_seen problems in $proj_base; see above logging."