本文介紹瞭如何在Jenkins上整合Cloc外掛,展示Cloc執行結果
工具/原料
Cloc
Jenkins
方法/步驟
首先下載cloc.exe
安裝SLOCCount plugin,因為SLOCCount和Cloc兩個工具生成的報告均由這個外掛解析。具體方法參考:/shuma/1687219pun.html
編輯執行cloc.bat,"D:\download\cloc-1.62.exe" --by-file --xml --out=cloc.xml "..\workspace\API"
在專案工程的構建裡增加Excute Windows batch command,執行cloc.bat
在專案工程的構建後操作裡增加Publish SLOCCount analysis report,解析cloc.bat執行時生成的cloc.xml報告。
點選高階後,可指定檔案編碼型別。Try to peocess report……選項,如果勾選則不管構建執行是否失敗都解析報告,不選,則失敗時不解析報告。
工程構建結束後,可以看到執行結果的彙總報告。點選左側SLOCCount Results或者頁面中間的SLOCCount Results,均可以檢視詳細報告。
進入詳細報告後能看到具體檔案和目錄的統計結果