44 lines
1.8 KiB
PowerShell
44 lines
1.8 KiB
PowerShell
[CmdletBinding()]
|
|
param(
|
|
[string]$UnityProjectRoot
|
|
)
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$packageRoot = (Resolve-Path -LiteralPath (Join-Path $PSScriptRoot '../..')).Path
|
|
if (-not $UnityProjectRoot) {
|
|
$UnityProjectRoot = Join-Path $packageRoot 'Development~/UnityProject'
|
|
}
|
|
|
|
$resolvedUnityProjectRoot = (Resolve-Path -LiteralPath $UnityProjectRoot).Path
|
|
$fixtureProject = Join-Path $PSScriptRoot 'ShrinkModFixtureBuilder.csproj'
|
|
$fixtureOutputRoot = Join-Path $resolvedUnityProjectRoot 'Temp/ShrinkModFixtureBuilder'
|
|
$fixtureTargetRoot = Join-Path $packageRoot 'Tests/Fixtures'
|
|
$runtimeAssemblyPath = Join-Path $resolvedUnityProjectRoot 'Temp/Bin/Debug/ShrinkModFramework.Runtime/ShrinkModFramework.Runtime.dll'
|
|
|
|
if (-not (Test-Path -LiteralPath $runtimeAssemblyPath)) {
|
|
throw "ShrinkModFramework.Runtime.dll was not found. Compile the Unity development host first: $resolvedUnityProjectRoot"
|
|
}
|
|
|
|
foreach ($variant in 'V1', 'V2', 'V3') {
|
|
$outputDirectory = Join-Path $fixtureOutputRoot $variant
|
|
$intermediateDirectory = Join-Path $fixtureOutputRoot "obj/$variant/"
|
|
dotnet build $fixtureProject /m:1 --nologo `
|
|
-p:FixtureVariant=$variant `
|
|
-p:RuntimeAssemblyPath=$runtimeAssemblyPath `
|
|
-p:BaseIntermediateOutputPath=$intermediateDirectory `
|
|
-p:OutputPath=$outputDirectory
|
|
if ($LASTEXITCODE -ne 0) {
|
|
throw "External fixture $variant build failed with exit code $LASTEXITCODE."
|
|
}
|
|
|
|
$source = Join-Path $outputDirectory 'ExternalFixture.Mod.dll'
|
|
$targetName = switch ($variant) {
|
|
'V1' { 'ExternalFixture.Mod.V1.dll.bytes' }
|
|
'V2' { 'ExternalFixture.Mod.V2.Failing.dll.bytes' }
|
|
'V3' { 'ExternalFixture.Mod.V3.dll.bytes' }
|
|
}
|
|
Copy-Item -LiteralPath $source -Destination (Join-Path $fixtureTargetRoot $targetName) -Force
|
|
}
|
|
|
|
Write-Host 'ShrinkModFramework external fixture DLLs rebuilt.' |