Skip to content

Commit e15bd26

Browse files
authored
Move to a postbuild.ps1 script and set the working dir at runtime as output dir (#113)
* Move to a postbuild.ps1 script and Set the working dir at runtime as output dir * Update for 2f711d4 * Only copy newer files and remove needed files from gitignore
1 parent 09e0c04 commit e15bd26

File tree

4 files changed

+61
-28
lines changed

4 files changed

+61
-28
lines changed

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,4 +423,10 @@ Minecraft.World/x64_Debug/
423423
Minecraft.World/Release/
424424
Minecraft.World/x64_Release/
425425

426-
build/*
426+
build/*
427+
428+
# Existing build output files
429+
!x64/**/Effects.msscmp
430+
!x64/**/iggy_w64.dll
431+
!x64/**/mss64.dll
432+
!x64/**/redist64/

Minecraft.Client/Minecraft.Client.vcxproj

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1302,14 +1302,8 @@ if not exist "$(TargetDir)\savedata" mkdir "$(TargetDir)\savedata"</Command>
13021302
<ForceFileOutput>MultiplyDefinedSymbolOnly</ForceFileOutput>
13031303
</Link>
13041304
<PostBuildEvent>
1305-
<Message>Copying sound assets to output directory</Message>
1306-
<Command>xcopy /q /y /i /s /e "$(ProjectDir)Durango\Sound" "$(OutDir)Durango\Sound"
1307-
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music"
1308-
xcopy /q /y /i /s /e "$(ProjectDir)Windows64\GameHDD" "$(OutDir)Windows64\GameHDD"
1309-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Media" "$(OutDir)Common\Media"
1310-
xcopy /q /y /i /s /e "$(ProjectDir)Common\res" "$(OutDir)Common\res"
1311-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Trial" "$(OutDir)Common\Trial"
1312-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Tutorial" "$(OutDir)Common\Tutorial"</Command>
1305+
<Message>Run postbuild script</Message>
1306+
<Command>powershell -ExecutionPolicy Bypass -File "$(ProjectDir)postbuild.ps1" -OutDir "$(OutDir)/" -ProjectDir "$(ProjectDir)/"</Command>
13131307
</PostBuildEvent>
13141308
<ImageXex>
13151309
<ConfigurationFile>$(ProjectDir)xbox\xex-dev.xml</ConfigurationFile>
@@ -1440,25 +1434,8 @@ xcopy /q /y /i /s /e $(ProjectDir)Durango\CU $(LayoutDir)Image\Loose\CU</Comman
14401434
<SuppressStartupBanner>false</SuppressStartupBanner>
14411435
</Link>
14421436
<PostBuildEvent>
1443-
<Message>Copying game assets to output directory</Message>
1444-
<Command>mkdir "$(OutDir)music" 2&gt;nul
1445-
mkdir "$(OutDir)Windows64\GameHDD" 2&gt;nul
1446-
mkdir "$(OutDir)Common\Media" 2&gt;nul
1447-
mkdir "$(OutDir)Common\res" 2&gt;nul
1448-
mkdir "$(OutDir)Common\Trial" 2&gt;nul
1449-
mkdir "$(OutDir)Common\Tutorial" 2&gt;nul
1450-
mkdir "$(OutDir)Windows64Media" 2&gt;nul
1451-
1452-
xcopy /q /y /i /s /e "$(ProjectDir)music" "$(OutDir)music" || exit /b 0
1453-
xcopy /q /y /i /s /e "$(ProjectDir)Windows64\GameHDD" "$(OutDir)Windows64\GameHDD" || exit /b 0
1454-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Media" "$(OutDir)Common\Media" || exit /b 0
1455-
xcopy /q /y /i /s /e "$(ProjectDir)Common\res" "$(OutDir)Common\res" || exit /b 0
1456-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Trial" "$(OutDir)Common\Trial" || exit /b 0
1457-
xcopy /q /y /i /s /e "$(ProjectDir)Common\Tutorial" "$(OutDir)Common\Tutorial" || exit /b 0
1458-
xcopy /q /y /i /s /e "$(ProjectDir)DurangoMedia" "$(OutDir)Windows64Media" || exit /b 0
1459-
xcopy /q /y /i /s /e "$(ProjectDir)Windows64Media" "$(OutDir)Windows64Media" || exit /b 0
1460-
1461-
exit /b 0</Command>
1437+
<Message>Run postbuild script</Message>
1438+
<Command>powershell -ExecutionPolicy Bypass -File "$(ProjectDir)postbuild.ps1" -OutDir "$(OutDir)/" -ProjectDir "$(ProjectDir)/"</Command>
14621439
</PostBuildEvent>
14631440
<ImageXex>
14641441
<ConfigurationFile>$(ProjectDir)xbox\xex-dev.xml</ConfigurationFile>

Minecraft.Client/Minecraft.Client.vcxproj.user

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,12 @@
33
<PropertyGroup>
44
<LastConfigDeployed>Debug</LastConfigDeployed>
55
</PropertyGroup>
6+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
7+
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
8+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
9+
</PropertyGroup>
10+
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
11+
<LocalDebuggerWorkingDirectory>$(SolutionDir)$(Platform)\$(Configuration)\</LocalDebuggerWorkingDirectory>
12+
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
13+
</PropertyGroup>
614
</Project>

Minecraft.Client/postbuild.ps1

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
param(
2+
[string]$OutDir,
3+
[string]$ProjectDir
4+
)
5+
6+
Write-Host "Post-build script started. Output Directory: $OutDir, Project Directory: $ProjectDir"
7+
8+
$directories = @(
9+
"music",
10+
"Windows64\GameHDD",
11+
"Common\Media",
12+
"Common\res",
13+
"Common\Trial",
14+
"Common\Tutorial",
15+
"Windows64Media"
16+
)
17+
18+
foreach ($dir in $directories) {
19+
New-Item -ItemType Directory -Path (Join-Path $OutDir $dir) -Force | Out-Null
20+
}
21+
22+
$copies = @(
23+
@{ Source = "music"; Dest = "music" },
24+
@{ Source = "Common\Media"; Dest = "Common\Media" },
25+
@{ Source = "Common\res"; Dest = "Common\res" },
26+
@{ Source = "Common\Trial"; Dest = "Common\Trial" },
27+
@{ Source = "Common\Tutorial"; Dest = "Common\Tutorial" },
28+
@{ Source = "Windows64\GameHDD"; Dest = "Windows64\GameHDD" },
29+
@{ Source = "Windows64\Sound"; Dest = "Windows64\Sound" },
30+
@{ Source = "DurangoMedia"; Dest = "Windows64Media" },
31+
@{ Source = "Windows64Media"; Dest = "Windows64Media" }
32+
)
33+
34+
foreach ($copy in $copies) {
35+
$src = Join-Path $ProjectDir $copy.Source
36+
$dst = Join-Path $OutDir $copy.Dest
37+
38+
if (Test-Path $src) {
39+
# Copy the files using xcopy, forcing overwrite and suppressing errors, and only copying if the source is newer than the destination
40+
xcopy /q /y /i /s /e /d "$src" "$dst" 2>$null
41+
}
42+
}

0 commit comments

Comments
 (0)