mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-12 16:50:43 -05:00
Converts Build Script to PowerShell (!87)
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>
This commit is contained in:
parent
1c2d88ad3a
commit
2b3bf8864a
@ -25,6 +25,7 @@ git config --local user.email "USERNAME@SOMETHING.com"
|
||||
- Escape From Tarkov 28476
|
||||
- Visual Studio Code -OR- Visual Studio 2022
|
||||
- .NET 6 SDK
|
||||
- [PowerShell v7](https://learn.microsoft.com/en-us/powershell/scripting/install/installing-powershell-on-windows)
|
||||
|
||||
## Project Setup
|
||||
Copy-paste Live EFT's `EscapeFromTarkov_Data/Managed/` folder to into this project's `Project/Shared/Managed/` folder
|
||||
|
@ -1,8 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<Configuration>Release</Configuration>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
@ -22,12 +22,12 @@
|
||||
<ProjectReference Include="..\Aki.Reflection\Aki.Reflection.csproj" />
|
||||
<ProjectReference Include="..\Aki.PrePatch\Aki.PrePatch.csproj" />
|
||||
<ProjectReference Include="..\Aki.Debugging\Aki.Debugging.csproj" />
|
||||
<ProjectReference Include="..\Aki.SinglePlayer\Aki.SinglePlayer.csproj" />
|
||||
<ProjectReference Include="..\Aki.Custom\Aki.Custom.csproj" />
|
||||
<ProjectReference Include="..\Aki.SinglePlayer\Aki.SinglePlayer.csproj" />
|
||||
<ProjectReference Include="..\Aki.Custom\Aki.Custom.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="../build.bat" WorkingDirectory="$(ProjectDir)" />
|
||||
<Exec Command="pwsh -NoProfile -ExecutionPolicy Bypass ../build.ps1" WorkingDirectory="$(ProjectDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -1,52 +0,0 @@
|
||||
@echo off
|
||||
:: Set some Vars to use
|
||||
set buildFolder=..\Build
|
||||
set bepinexFolder=..\Build\BepInEx
|
||||
set bepinexPatchFolder=..\Build\BepInEx\Patchers
|
||||
set bepinexPluginFolder=..\Build\BepInEx\Plugins
|
||||
set bepinexSptFolder=..\Build\BepInEx\Plugins\spt
|
||||
set eftDataFolder=..\Build\EscapeFromTarkov_Data
|
||||
set managedFolder=..\Build\EscapeFromTarkov_Data\Managed
|
||||
set projReleaseFolder=.\bin\Release\net471
|
||||
set licenseFile=..\..\LICENSE.md
|
||||
|
||||
echo --------------- Cleaning Output Build Folder ---------------
|
||||
|
||||
:: Delete build folder and contents to make sure its clean
|
||||
if exist %buildFolder% rmdir /s /q %buildFolder%
|
||||
|
||||
echo --------------- Done Cleaning Output Build Folder ---------------
|
||||
echo --------------- Creating Output Build Folders ---------------
|
||||
|
||||
:: Create build folder if it doesn't exist
|
||||
if not exist %buildFolder% mkdir %buildFolder%
|
||||
if not exist %bepinexFolder% mkdir %bepinexFolder%
|
||||
if not exist %bepinexPatchFolder% mkdir %bepinexPatchFolder%
|
||||
if not exist %bepinexPluginFolder% mkdir %bepinexPluginFolder%
|
||||
if not exist %bepinexSptFolder% mkdir %bepinexSptFolder%
|
||||
if not exist %eftDataFolder% mkdir %eftDataFolder%
|
||||
if not exist %managedFolder% mkdir %managedFolder%
|
||||
|
||||
echo --------------- Done Creating Output Build Folders ---------------
|
||||
|
||||
echo --------------- Moving DLLs to %buildFolder% ---------------
|
||||
|
||||
:: Move DLLs from each project's bin\Release folder to the build folder
|
||||
xcopy "%projReleaseFolder%\Aki.Common.dll" %managedFolder%
|
||||
xcopy "%projReleaseFolder%\Aki.Reflection.dll" %managedFolder%
|
||||
|
||||
xcopy "%projReleaseFolder%\aki_PrePatch.dll" %bepinexPatchFolder%
|
||||
|
||||
xcopy "%projReleaseFolder%\aki-core.dll" %bepinexSptFolder%
|
||||
xcopy "%projReleaseFolder%\aki-custom.dll" %bepinexSptFolder%
|
||||
xcopy "%projReleaseFolder%\aki-debugging.dll" %bepinexSptFolder%
|
||||
xcopy "%projReleaseFolder%\aki-singleplayer.dll" %bepinexSptFolder%
|
||||
:: If any new Dll's need to be copied, add here
|
||||
|
||||
echo --------------- Done Moving DLLs to %buildFolder% ---------------
|
||||
echo --------------- Writing License File ---------------
|
||||
|
||||
:: write the contents of the license file to a txt
|
||||
type %licenseFile% > "%buildFolder%\LICENSE-Modules.txt"
|
||||
|
||||
echo --------------- Done Writing License File ---------------
|
44
project/build.ps1
Normal file
44
project/build.ps1
Normal file
@ -0,0 +1,44 @@
|
||||
$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 ---------------"
|
Loading…
x
Reference in New Issue
Block a user