1 cmake_minimum_required(VERSION 2.8)
3 if(COMMAND CMAKE_POLICY)
5 cmake_policy(SET CMP0009 NEW)
7 endif(COMMAND CMAKE_POLICY)
8 set(rs "$ENV{ROOTSYS}")
9 set(ar "$ENV{ALICE_ROOT}")
11 set(exceptions "always evaluates both arguments" "std::" "TGeoMatrix::operator\\*" "struct AliRawDataHeader" "/usr/local/dim" " from " "JETAN/fastjet/fastjet/" "G__" "base class .struct AliHLTCaloChannelDataStruct. has a non-virtual destructor")
13 #Function to count no of lines in a file equivalent to wc -l
14 function (wcl _nLinesVar fileName)
15 file(READ ${fileName} fileData)
18 string(REGEX MATCHALL "\r\n" nLines ${fileData})
20 string(REGEX MATCHALL "[\r\n]" nLines ${fileData})
22 list(LENGTH nLines nLines)
23 set(${_nLinesVar} ${nLines} PARENT_SCOPE)
25 set(${_nLinesVar} -1 PARENT_SCOPE)
29 find_program(svn_command svn)
32 #Read build log from (default - make.log)
33 set(buildLog "$ENV{ALICE_INSTALL}/make.log")
34 file(READ ${buildLog} lineList)
35 string(REGEX REPLACE "\n" ";" "lineList" "${lineList}")
36 foreach (line ${lineList})
38 string(REGEX MATCH ".+warning:.+" "warning" "${line}")
40 # message("${warning}")
41 list(APPEND warnList "${line}")
42 string(REGEX MATCH "(.+):[0-9]+" "file" "${line}")
43 string(REGEX REPLACE ":[0-9]+" "" "file" "${file}")
44 list(APPEND fileList "${file}")
47 list(REMOVE_DUPLICATES fileList)
48 set(rootOut "+--| ROOT\n")
49 set(aliOut "+--| ALIROOT\n")
51 foreach(file ${fileList})
54 string(REGEX MATCH "${rs}" "root" "${file}")
55 string(REGEX MATCH "${ar}" "aliroot" "${aliroot}")
57 string(REGEX REPLACE "${root}[/]*" "" "file" "${file}")
58 set(rootOut "${rootOut} |\n")
59 set(rootOut "${rootOut} +--| ${file}\n")
62 string(REGEX REPLACE "${aliroot}[/]*" "" "file" "${file}")
63 set(aliOut "${aliOut} |\n")
64 set(aliOut "${aliOut} +--| ${file}\n")
66 list(REMOVE_DUPLICATES warnList)
67 foreach(line ${warnList})
69 string(REGEX MATCH "${file}[:]*" "match" "${line}")
71 string(REGEX REPLACE "${match}" "" "line" "${line}")
73 string(REGEX REPLACE "${aliroot}" "" "line" "${line}")
74 set(aliOut "${aliOut} +--| ${line}\n")
76 string(REGEX REPLACE "${root}" "" "line" "${line}")
77 set(rootOut "${rootOut} +--| ${line}\n")
84 set (anlys "${anlys}\n\n==============================Detailed Analysis==============================\n")
86 set (anlys "${anlys}+--| AliRoot\n")
87 foreach( blameFile ${fileList} )
88 string(REPLACE "$ENV{ALICE_ROOT}/" "" mainFile ${blameFile})
89 set(anlys "${anlys} |\n")
90 execute_process(COMMAND "${svn_command}" "blame" "${blameFile}"
91 WORKING_DIRECTORY "$ENV{ALICE_ROOT}"
93 OUTPUT_VARIABLE tmpVio)
94 wcl(fileLen "$ENV{ALICE_ROOT}/tmpViols")
95 set(anlys "${anlys} |--| ${mainFile} |-- ${fileLen} lines\n")
97 file(STRINGS "$ENV{ALICE_ROOT}/tmpViols" violData)
98 # file(READ "tmpViols" violData)
99 # string(REGEX REPLACE "\n" ";" "violData" "${violData}")
100 foreach(violLine ${violData})
101 string(REGEX MATCH "[0-9]+[ ]+[a-zA-Z0-9]+" "name" "${violLine}")
102 string(REGEX REPLACE "^[0-9]+[ ]+" "" "name" "${name}")
103 list(APPEND nameList ${name})
104 list(APPEND fullViolList ${name})
106 list(LENGTH violData tot)
107 set (userList ${nameList})
110 list(REMOVE_DUPLICATES userList)
112 foreach(name ${userList})
113 string(REGEX MATCHALL "${name}" "nameCount" "${nameList}")
114 list(LENGTH nameCount nameCount)
115 math(EXPR num "(${nameCount}*100)/${tot}")
116 math(EXPR dec "((10000*${nameCount}/${tot}-100*${num}+5))")
117 if( ${dec} GREATER 99 )
119 math(EXPR num "${num}+1")
120 endif(${dec} GREATER 99)
121 math(EXPR dec "${dec}/10")
122 math(EXPR pcnt "99999 - ${num}${dec}")
123 string(LENGTH ${num} digit)
126 elseif(digit EQUAL 2)
129 list(APPEND finale "${pcnt}-${space}${num}.${dec}% | ${name} |-- ${nameCount} lines")
132 foreach(record ${finale})
133 string(LENGTH ${record} recLen)
134 math(EXPR recLen "${recLen}-6")
135 string(SUBSTRING ${record} 6 ${recLen} record)
136 set(anlys "${anlys} +--|${record}\n")
138 endforeach( blameFile)
143 message("==============================ROOT FILE WARNINGS==============================\n")
144 message("${rootOut}")
145 message("\n\n==============================ALIROOT FILE WARNINGS==============================\n")
148 message(WARNING "Environment Variable ALICE_ROOT and ROOTSYS must be set")