@@ -10,14 +10,16 @@ if (-not (Test-Path "$solutionDir/global.json"))
1010 throw " Not in solution root"
1111}
1212
13- $itemsToCopy = @ (" $solutionDir \Engine\bin\Debug\netcoreapp1.0\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll" ,
14- " $solutionDir \Rules\bin\Debug\netcoreapp1.0\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll" ,
15- " $solutionDir \Engine\PSScriptAnalyzer.psd1" ,
13+ $itemsToCopyCoreCLR = @ (" $solutionDir \Engine\bin\Debug\netcoreapp1.0\Microsoft.Windows.PowerShell.ScriptAnalyzer.dll" ,
14+ " $solutionDir \Rules\bin\Debug\netcoreapp1.0\Microsoft.Windows.PowerShell.ScriptAnalyzer.BuiltinRules.dll" )
15+
16+ $itemsToCopyCommon = @ (" $solutionDir \Engine\PSScriptAnalyzer.psd1" ,
1617 " $solutionDir \Engine\PSScriptAnalyzer.psm1" ,
1718 " $solutionDir \Engine\ScriptAnalyzer.format.ps1xml" ,
1819 " $solutionDir \Engine\ScriptAnalyzer.types.ps1xml" )
1920
20- $destinationDir = " $solutionDir /out/coreclr/PSScriptAnalyzer"
21+ $destinationDir = " $solutionDir /out/PSScriptAnalyzer"
22+ $destinationDirCoreCLR = " $destinationDir /coreclr"
2123
2224if ($build )
2325{
@@ -31,20 +33,21 @@ if ($build)
3133 dotnet build
3234 Pop-Location
3335
34- if (-not (Test-Path $destinationDir ))
35- {
36- New-Item - ItemType Directory $destinationDir - Force
37- }
38- else
36+ Function CopyToDestinationDir ($itemsToCopy , $destination )
3937 {
40- Remove-Item " $destinationDir \*" - Recurse
41- }
42-
43- foreach ($file in $itemsToCopy )
44- {
45- Copy-Item - Path $file - Destination (Join-Path $destinationDir (Split-Path $file - Leaf)) - Verbose
38+ if (-not (Test-Path $destination ))
39+ {
40+ New-Item - ItemType Directory $destination - Force
41+ }
42+ foreach ($file in $itemsToCopy )
43+ {
44+ Copy-Item - Path $file - Destination (Join-Path $destination (Split-Path $file - Leaf)) - Verbose - Force
45+ }
4646 }
47+ CopyToDestinationDir $itemsToCopyCommon $destinationDir
4748 (Get-Content " $destinationDir \PSScriptAnalyzer.psd1" ) -replace " ModuleVersion = '1.6.0'" , " ModuleVersion = '0.0.1'" | Out-File " $destinationDir \PSScriptAnalyzer.psd1" - Encoding ascii
49+
50+ CopyToDestinationDir $itemsToCopyCoreCLR $destinationDirCoreCLR
4851}
4952
5053$modulePath = " $HOME \Documents\WindowsPowerShell\Modules" ;
0 commit comments