Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

Commit

Permalink
sdl script revision (#142)
Browse files Browse the repository at this point in the history
* add dependencies
  • Loading branch information
TimothyMothra authored Jan 12, 2018
1 parent 8c2a826 commit 98c0b10
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions SDL/FxCopSetup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,40 @@ Param(
[string]$fxCopDirectory = (Join-Path -Path (Split-Path -parent (Split-Path -parent (Split-Path -parent $PSCommandPath))) -ChildPath "fxCop")
)

function IsFileDependency {
[CmdletBinding()]
param
(
$file
)
$dependencyFiles | ForEach-Object {
if($file.Name -eq $_) {
return $true;
}
}

return $false;
}

# these are dlls that end up in the bin, but do not belong to us and don't need to be scanned.
$excludedFiles = @();
$excludedFiles = @(
"KernelTraceControl.dll",
"msdia140.dll");
$dependencyFiles = @(
"Microsoft.ApplicationInsights.dll",
"log4net.dll",
"NLog.dll",
"Microsoft.Diagnostics.Tracing.TraceEvent.dll",
"System.Diagnostics.DiagnosticSource.dll");

Write-Host "`nPARAMETERS:";
Write-Host "`tbuildDirectory:" $buildDirectory;
Write-Host "`tfxCopDirectory:" $fxCopDirectory;

$fxCopTargetDir = Join-Path -Path $fxCopDirectory -ChildPath "target";
$fxCopDependenciesDir = Join-Path -Path $fxCopDirectory -ChildPath "dependencies";


$frameworks = @("net45", "net451", "netstandard1.3");

# don't need to clean folder on build server, but is needed for local dev
Expand All @@ -31,9 +58,17 @@ Get-ChildItem -Path $buildDirectory -Recurse -File -Include *.dll, *.pdb |
return;
}

#find matching framework
$frameworks | ForEach-Object {
if($file.Directory -match $_) {
Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopDirectory -ChildPath $_) -Type container -Force) -Force;
$framework = $_;

#is this file a dependency
if (IsFileDependency($file)) {
Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopDependenciesDir -ChildPath $framework) -Type container -Force) -Force;
} else {
Copy-Item $file.FullName -Destination (New-Item (Join-Path -Path $fxCopTargetDir -ChildPath $framework) -Type container -Force) -Force;
}
}
}
}
Expand All @@ -60,4 +95,5 @@ Get-ChildItem -Path $fxCopDirectory -Recurse -File |
$count++;
}

Write-Host "`nTOTAL FILES:" $count;
Write-Host "`nTOTAL FILES:" $count;

0 comments on commit 98c0b10

Please sign in to comment.