-
Notifications
You must be signed in to change notification settings - Fork 8
/
Build.ps1
33 lines (27 loc) · 1.15 KB
/
Build.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
param (
[ValidateSet('Debug', 'Release')]
[String]$Configuration = 'Debug'
)
$netVersion = 'net6.0'
$copyExtensions = @('.dll', '.pdb')
$src = "$PSScriptRoot/src"
$coreSrc = "$src/PowerShellRun"
$depSrc = "$src/PowerShellRun.Dependency"
$outDir = "$PSScriptRoot/module/PowerShellRun/bin/$netVersion"
$outDeps = "$outDir/Dependencies"
Push-Location $depSrc
dotnet publish -c $Configuration
Pop-Location
Push-Location $coreSrc
dotnet publish -c $Configuration
Pop-Location
Remove-Item -Path $outDir -Recurse -ErrorAction Ignore
New-Item -Path $outDir -ItemType Directory
New-Item -Path $outDeps -ItemType Directory
$deps = [System.Collections.Generic.List[string]]::new()
Get-ChildItem -Path "$depSrc/bin/$Configuration/$netVersion/publish/" |
Where-Object { $_.Extension -in $copyExtensions } |
ForEach-Object { [void]$deps.Add($_.Name); Copy-Item -Path $_.FullName -Destination $outDeps }
Get-ChildItem -Path "$coreSrc/bin/$Configuration/$netVersion/publish/" |
Where-Object { -not ($deps -contains $_.Name) -and $_.Extension -in $copyExtensions } |
ForEach-Object { Copy-Item -Path $_.FullName -Destination $outDir }