-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuildSdk.ps1
More file actions
76 lines (65 loc) · 1.86 KB
/
Copy pathBuildSdk.ps1
File metadata and controls
76 lines (65 loc) · 1.86 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
#!powershell.exe -ExecutionPolicy Bypass -File
param (
[string] $Configuration
)
$Mods = @('Sdk')
# Source the helper (expects Get-ModFiles and CopyFiles)
. ./BuildInfo.ps1
# 1. Build solution
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
$solutionPath = Join-Path $scriptDir "$solutionName.sln"
if (-not (Test-Path $solutionPath))
{
Write-Error "Solution file not found at $solutionPath"
exit 1
}
Write-Output "Building solution $solutionPath in configuration $Configuration..."
dotnet build $solutionPath -c $Configuration
# 3. Prepare temporary output directory
$outputRoot = Join-Path $scriptDir 'Output'
if (-not (Test-Path $outputRoot))
{
New-Item -ItemType Directory -Path $outputRoot -Force | Out-Null
}
New-Item -ItemType Directory -Path $outputRoot -Force | Out-Null
# 4. Build combined file list across variants
$allFiles = @()
foreach ($p in $Mods)
{
$lists = Get-ModFiles -Mod $p -Configuration $Configuration
$allFiles += $lists.Mod
}
# Append PDB files in Debug configuration
if ($Configuration -eq "Debug")
{
$allFiles += @(
@(@("WukongMp.Api.pdb"), "WukongMp.Sdk/bin/Debug/netstandard2.0", "mods/WukongMp.Sdk"),
@(@("WukongMp.Sdk.pdb"), "WukongMp.Sdk/bin/Debug/netstandard2.0", "mods/WukongMp.Sdk")
)
}
# Create destination directories
foreach ($item in $allFiles)
{
$destDir = Join-Path $outputRoot $item[2]
if (-not (Test-Path $destDir))
{
New-Item -ItemType Directory -Path $destDir -Force | Out-Null
}
}
# 5. Perform copies
foreach ($item in $allFiles)
{
$files = $item[0]
$sourceDir = $item[1]
$destDir = Join-Path $outputRoot $item[2]
CopyFiles $files $sourceDir $destDir
}
# 6. Open explorer to the output directory
if ($PSVersionTable.PSEdition -eq 'Core')
{
Start-Process "explorer.exe" -ArgumentList $outputRoot
}
else
{
Invoke-Item $outputRoot
}