Update coverity-scan.bat

* new submission URL
* make script work with VC2015
* support both 32-bit and 64-bit builds (configurable)
This commit is contained in:
Tom Reynolds 2015-11-22 21:47:49 +01:00
parent 1a698f0225
commit d9b5f89c7a
1 changed files with 41 additions and 15 deletions

View File

@ -1,6 +1,6 @@
@echo off
rem
rem Upload Coverity s
rem Upload build logs to Coverity Scan for security / code style analysis
rem Requires:
rem - curl.exe, built with SSL support: http://curl.haxx.se/download.html
rem - wget.exe (should get installed automatically during a build)
@ -8,7 +8,7 @@ rem - 7z.exe (should get installed automatically during a build)
rem - Coverity Scan Build Tool installed and its install path configured in .coverity-scan
rem
rem Change into this directory
rem Change into the directory this batch file is located in
cd /d "%~dp0"
rem Project name (case sensitive)
@ -18,32 +18,45 @@ rem read in config settings
if not exist ".coverity-scan" (
echo -----------------------------------------
echo **Missing Config** To use this script please create a config file named [%CD%\.coverity-scan]
echo Containing: TOKEN=x , EMAIL=x , COVERITY_ANALYSIS_ROOT=x , NUMCORES=x
echo Containing: EMAIL=x, TOKEN=x, COVERITY_ANALYSIS_ROOT=x, BITNESS=x, NUMCORES=x
goto END
)
setlocal disabledelayedexpansion
FOR /F "tokens=1* delims==" %%i IN (.coverity-scan) DO set "prop_%%i=%%j"
rem Coverity Scan project token as listed on the Coverity Scan project page
set TOKEN=%prop_TOKEN%
rem E-Mail address of registered Coverity Scan user with project access
rem E-Mail address of registered Coverity Scan user with build submission access to this project
set EMAIL=%prop_EMAIL%
rem Coverity Scan project API token as listed on the Coverity Scan project page
set TOKEN=%prop_TOKEN%
rem Where you extracted coverity build scan tool to
rem e.g. "C:\cov-analysis-win32-6.6.1"
set COVERITY_ANALYSIS_ROOT=%prop_COVERITY_ANALYSIS_ROOT%
echo TOKEN [%TOKEN%] EMAIL [%EMAIL%] COVERITY_ANALYSIS_ROOT [%COVERITY_ANALYSIS_ROOT%]
rem pause
rem Is this a "32" or "64" bit build of MegaGlest?
set BITNESS=%prop_BITNESS%
rem Description of this build (can be any string)
set DESCRIPTION=Windows-32_%COMPUTERNAME%
set DESCRIPTION=Windows-%BITNESS%_%COMPUTERNAME%
rem Where to store the data gathered by the Coverity Scan Build Tool
rem Absolute path or relevant to the directory containing this batch file
set BUILDTOOL=cov-int
rem ------------------------------------------------------------------------------
echo PROJECT [%PROJECT%]
echo EMAIL [%EMAIL%]
echo TOKEN [%TOKEN%]
echo COVERITY_ANALYSIS_ROOT [%COVERITY_ANALYSIS_ROOT%]
echo BITNESS [%BITNESS%]
echo DESCRIPTION [%DESCRIPTION%]
echo BUILDTOOL [%BUILDTOOL%]
rem pause
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
@ -62,18 +75,30 @@ rem set PATH=%PATH%;C:\build\megaglest-source\mk\windoze\cov-analysis-win32-6.6.
if "%MG_COV_PATH_SET%." == "." set PATH=%PATH%;%COVERITY_ANALYSIS_ROOT%\bin\
set MG_COV_PATH_SET=TRUE
cov-build --dir %BUILDTOOL% build-mg-2010.bat nopause rebuild
if ERRORLEVEL 1 GOTO ERROR
if "%BITNESS%." == "32." GOTO BUILD32
if "%BITNESS%." == "64." GOTO BUILD64
GOTO ERROR
:BUILD32
cov-build --dir %BUILDTOOL% build-mg32bit-2015.bat nopause rebuild
if ERRORLEVEL 1 GOTO ERROR
GOTO PACKAGE
:BUILD64
cov-build --dir %BUILDTOOL% build-mg-2015.bat nopause rebuild
if ERRORLEVEL 1 GOTO ERROR
GOTO PACKAGE
:PACKAGE
7z.exe a %FILENAME%.tar %BUILDTOOL%\
7z.exe a %FILENAME%.tar.gz %FILENAME%.tar
del /Q /F %FILENAME%.tar
dir %FILENAME%.tar.gz
echo **About to run: curl.exe --progress-bar --insecure --form "project=%PROJECT%" --form "token=%TOKEN%" --form "email=%EMAIL%" --form "version=%VERSION%" --form "description=%DESCRIPTION%" --form "file=@%FILENAME%.tar.gz" https://scan5.coverity.com/cgi-bin/upload.py
echo **About to run: curl.exe --progress-bar --insecure --form "token=%TOKEN%" --form "email=%EMAIL%" --form "version=%VERSION%" --form "description=%DESCRIPTION%" --form "file=@%FILENAME%.tar.gz" "https://scan.coverity.com/builds?project=%PROJECT%"
rem pause
rem echo Running curl
curl.exe --progress-bar --insecure --form "project=%PROJECT%" --form "token=%TOKEN%" --form "email=%EMAIL%" --form "version=%VERSION%" --form "description=%DESCRIPTION%" --form "file=@%FILENAME%.tar.gz" https://scan5.coverity.com/cgi-bin/upload.py
curl.exe --progress-bar --insecure --form "token=%TOKEN%" --form "email=%EMAIL%" --form "version=%VERSION%" --form "description=%DESCRIPTION%" --form "file=@%FILENAME%.tar.gz" "https://scan.coverity.com/builds?project=%PROJECT%"
if ERRORLEVEL 1 GOTO ERROR
GOTO CLEANUP
@ -83,6 +108,7 @@ rd /Q /S %BUILDTOOL%\
GOTO END
:ERROR
echo An error occurred.
echo An error occurred
GOTO END
:END