mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-13 02:10:45 -05:00
In a push to automate project builds, this changes the build script from a BAT script to a PowerShell script. This is a cross-platform solution that should allow us to build the project within the `mcr.microsoft.com/dotnet/sdk:6.0` docker image (Debian). Also updates the README to list PowerShell 7 as a dependency as the `pwsh` tool is not available in Windows PowerShell (v5). Co-authored-by: Refringe <brownelltyler@gmail.com> Reviewed-on: SPT-AKI/Modules#87 Co-authored-by: Refringe <refringe@noreply.dev.sp-tarkov.com> Co-committed-by: Refringe <refringe@noreply.dev.sp-tarkov.com>
45 lines
2.2 KiB
PowerShell
45 lines
2.2 KiB
PowerShell
$buildFolder = "..\Build"
|
|
$bepinexFolder = "..\Build\BepInEx"
|
|
$bepinexPatchFolder = "..\Build\BepInEx\Patchers"
|
|
$bepinexPluginFolder = "..\Build\BepInEx\Plugins"
|
|
$bepinexSptFolder = "..\Build\BepInEx\Plugins\spt"
|
|
$eftDataFolder = "..\Build\EscapeFromTarkov_Data"
|
|
$managedFolder = "..\Build\EscapeFromTarkov_Data\Managed"
|
|
$projReleaseFolder = ".\bin\Release\net471"
|
|
$licenseFile = "..\..\LICENSE.md"
|
|
|
|
Write-Host "--------------- Cleaning Output Build Folder ---------------"
|
|
|
|
# Delete build folder and contents to make sure it's clean
|
|
if (Test-Path $buildFolder) { Remove-Item -Path $buildFolder -Recurse -Force }
|
|
|
|
Write-Host "--------------- Done Cleaning Output Build Folder ---------------"
|
|
Write-Host "--------------- Creating Output Build Folders ---------------"
|
|
|
|
# Create build folder and subfolders if they don't exist
|
|
$foldersToCreate = @($buildFolder, $bepinexFolder, $bepinexPatchFolder, $bepinexPluginFolder, $bepinexSptFolder, $eftDataFolder, $managedFolder)
|
|
foreach ($folder in $foldersToCreate) {
|
|
if (-not (Test-Path $folder)) { New-Item -Path $folder -ItemType Directory }
|
|
}
|
|
|
|
Write-Host "--------------- Done Creating Output Build Folders ---------------"
|
|
Write-Host "--------------- Moving DLLs to $buildFolder ---------------"
|
|
|
|
# Move DLLs from project's bin\Release folder to the build folder
|
|
Copy-Item "$projReleaseFolder\Aki.Common.dll" -Destination $managedFolder
|
|
Copy-Item "$projReleaseFolder\Aki.Reflection.dll" -Destination $managedFolder
|
|
Copy-Item "$projReleaseFolder\aki_PrePatch.dll" -Destination $bepinexPatchFolder
|
|
Copy-Item "$projReleaseFolder\aki-core.dll" -Destination $bepinexSptFolder
|
|
Copy-Item "$projReleaseFolder\aki-custom.dll" -Destination $bepinexSptFolder
|
|
Copy-Item "$projReleaseFolder\aki-debugging.dll" -Destination $bepinexSptFolder
|
|
Copy-Item "$projReleaseFolder\aki-singleplayer.dll" -Destination $bepinexSptFolder
|
|
# If any new DLLs need to be copied, add here
|
|
|
|
Write-Host "--------------- Done Moving DLLs to $buildFolder ---------------"
|
|
Write-Host "--------------- Writing License File ---------------"
|
|
|
|
# Write the contents of the license file to a txt
|
|
Get-Content $licenseFile | Out-File "$buildFolder\LICENSE-Modules.txt"
|
|
|
|
Write-Host "--------------- Done Writing License File ---------------"
|