[string]$Configuration,
[string]$Platform,
[string]$Target = "Build",
- [string]$Inputs = ""
+ [string]$Inputs = "",
+ [switch]$CodeAnalysis
)
$c = "msbuild.exe"
if ($Inputs) {
$c += [string]::Format(" /p:Inputs=""{0}"" ", $Inputs)
}
+ if ($CodeAnalysis) {
+ $c += "/p:RunCodeAnalysis=true "
+ $c += "/p:EnablePREFast=true "
+ }
+
$c += Join-Path -Path $SolutionPath -ChildPath $Name
Invoke-Expression $c
Run-MSBuild $projpath $project $Configuration $Platform "Build"
Run-MSBuild $projpath $project $Configuration $Platform "sdv" "/clean"
Run-MSBuild $projpath $project $Configuration $Platform "sdv" "/check:default.sdv /debug"
+ Run-MSBuild $projpath $project $Configuration $Platform "Build" -CodeAnalysis
Run-MSBuild $projpath $project $Configuration $Platform "dvl"
$refine = Join-Path -Path $projpath -ChildPath "refine.sdv"
[string]$Name,
[string]$Configuration,
[string]$Platform,
- [string]$SearchPath,
- [string]$OutputPath
+ [string]$SearchPath
)
$projpath = Resolve-Path (Join-Path $SolutionPath $Name)
$project = [string]::Format("{0}.vcxproj", $Name)
$output = [string]::Format("{0}.sarif", $Name)
$database = Join-Path "database" $Name
+ $sarif = Join-Path $projpath $output
# write a bat file to wrap msbuild parameters
$bat = [string]::Format("{0}.bat", $Name)
$c += " windows_driver_recommended.qls"
$c += " --format=sarifv2.1.0"
$c += " --output="
- $c += (Join-Path $OutputPath $output)
+ $c += $sarif
$c += " --search-path="
$c += $SearchPath
Write-Host -ForegroundColor Red "ERROR: CodeQL failed, code:" $LASTEXITCODE
Exit $LASTEXITCODE
}
+
+ Copy-Item $sarif -Destination $SolutionPath
}
#
New-Item -ItemType Directory "database" | Out-Null
$projectlist | ForEach {
- Run-CodeQL $solutionpath $_ $configuration["codeql"] $platform[$Arch] $searchpath $archivepath
+ Run-CodeQL $solutionpath $_ $configuration["codeql"] $platform[$Arch] $searchpath
}
+
+ Copy-Item -Path (Join-Path -Path $SolutionPath -ChildPath "*.sarif") -Destination $archivepath
}
elseif ($Type -eq "sdv") {
if (-Not (Test-Path -Path $archivepath)) {
<Import Project="..\targets.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<PropertyGroup>
- <RunCodeAnalysis>true</RunCodeAnalysis>
<EnableInf2cat>false</EnableInf2cat>
<IntDir>..\$(ProjectName)\$(ConfigurationName)\$(Platform)\</IntDir>
<OutDir>..\$(ConfigurationName)\$(Platform)\</OutDir>
<WarningLevel>EnableAllWarnings</WarningLevel>
<DisableSpecificWarnings>4061;4062;4464;4711;4770;4548;4820;4668;4255;5045;6001;6054;26451;28160;28196;30030;30029;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
- <EnablePREfast>true</EnablePREfast>
</ClCompile>
<ResourceCompile>
<AdditionalIncludeDirectories>..\..\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>