[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[xencons PATCH 1/3] Refactor msbuild.ps1



Moves all repo specific data to a 'Globals' section, and simplifies the
structure so that it can be common across all drivers.

Also seperates DVL log generation from SDV build, so that DVL logs
can be created for CodeQL builds without SDV.

Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>
---
 msbuild.ps1 | 63 ++++++++++++++++++++++++++++++++++++-----------------
 1 file changed, 43 insertions(+), 20 deletions(-)

diff --git a/msbuild.ps1 b/msbuild.ps1
index 6f55a5f..f258781 100644
--- a/msbuild.ps1
+++ b/msbuild.ps1
@@ -12,6 +12,16 @@ param(
        [switch]$CodeAnalysis
 )
 
+#
+# Globals
+#
+$SolutionName = "xencons.sln"
+$ArchivePath = "xencons"
+$ProjectList = @( "xencons" )
+
+#
+# Functions
+#
 Function Run-MSBuild {
        param(
                [string]$SolutionPath,
@@ -63,6 +73,23 @@ Function Run-MSBuildSDV {
        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"
+
+       Set-Location $basepath
+}
+
+Function Run-MSBuildDVL {
+       param(
+               [string]$SolutionPath,
+               [string]$Name,
+               [string]$Configuration,
+               [string]$Platform
+       )
+
+       $basepath = Get-Location
+       $projpath = Join-Path -Path $SolutionPath -ChildPath $Name
+       Set-Location $projpath
+
+       $project = [string]::Format("{0}.vcxproj", $Name)
        Run-MSBuild $projpath $project $Configuration $Platform "Build" 
-CodeAnalysis
        Run-MSBuild $projpath $project $Configuration $Platform "dvl"
 
@@ -149,22 +176,17 @@ $configuration = @{ "free" = "$ConfigurationBase 
Release"; "checked" = "$Configu
 $platform = @{ "x86" = "Win32"; "x64" = "x64" }
 $solutionpath = Resolve-Path $SolutionDir
 
-$archivepath = "xencons"
-$projectlist = @( "xencons" )
-
 Set-ExecutionPolicy -Scope CurrentUser -Force Bypass
 
-if ($Type -eq "free") {
-       Run-MSBuild $solutionpath "xencons.sln" $configuration["free"] 
$platform[$Arch] -CodeAnalysis:$CodeAnalysis
+if (-Not (Test-Path -Path $archivepath)) {
+       New-Item -Name $archivepath -ItemType Directory | Out-Null
 }
-elseif ($Type -eq "checked") {
-       Run-MSBuild $solutionpath "xencons.sln" $configuration["checked"] 
$platform[$Arch] -CodeAnalysis:$CodeAnalysis
+
+if (($Type -eq "free") -or ($Type -eq "checked")) {
+       Run-MSBuild $solutionpath $SolutionName $configuration[$Type] 
$platform[$Arch] -CodeAnalysis:$CodeAnalysis
 }
-elseif ($Type -eq "codeql") {
-       if (-Not (Test-Path -Path $archivepath)) {
-               New-Item -Name $archivepath -ItemType Directory | Out-Null
-       }
 
+if ($Type -eq "codeql") {
        if ([string]::IsNullOrEmpty($Env:CODEQL_QUERY_SUITE)) {
                $searchpath = Resolve-Path ".."
        } else {
@@ -176,20 +198,21 @@ elseif ($Type -eq "codeql") {
        }
        New-Item -ItemType Directory "database" | Out-Null
 
-       $projectlist | ForEach {
-               Run-CodeQL $solutionpath $_ $configuration["codeql"] 
$platform[$Arch] $searchpath
+       ForEach ($project in $ProjectList) {
+               Run-CodeQL $solutionpath $project $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)) {
-               New-Item -Name $archivepath -ItemType Directory | Out-Null
-       }
 
-       $projectlist | ForEach {
-               Run-MSBuildSDV $solutionpath $_ $configuration["sdv"] 
$platform[$Arch]
+if ($Type -eq "sdv") {
+       ForEach ($project in $ProjectList) {
+               Run-MSBuildSDV $solutionpath $project $configuration["sdv"] 
$platform[$Arch]
        }
+}
 
+if (($Type -eq "codeql") -or ($Type -eq "sdv")) {
+       ForEach ($project in $ProjectList) {
+               Run-MSBuildDVL $solutionpath $project $configuration["sdv"] 
$platform[$Arch]
+       }
        Copy-Item -Path (Join-Path -Path $SolutionPath -ChildPath "*DVL*") 
-Destination $archivepath
 }
-- 
2.51.2.windows.1




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.