mirror of
https://github.com/sp-tarkov/modules.git
synced 2025-02-12 16:50:43 -05:00
Rework build process (!83)
Co-authored-by: CWXDEV <CWXDEV@outlook.com> Reviewed-on: SPT-AKI/Modules#83
This commit is contained in:
parent
df840e5b2a
commit
c7bc0b0514
@ -37,11 +37,8 @@ Copy-paste Live EFT's `EscapeFromTarkov_Data/Managed/` folder to into this proje
|
||||
## Build (VS 2022)
|
||||
1. Open solution
|
||||
2. Restore nuget packages
|
||||
3. Run `dotnet new tool-manifest`
|
||||
4. Sometimes you need to run `dotnet tool restore`
|
||||
5. Run `dotnet tool install Cake.Tool`
|
||||
6. Build solution
|
||||
7. Copy contents of `/Build` into SPT game folder and overwrite
|
||||
3. Build solution
|
||||
4. Copy contents of `/Build` into SPT game folder and overwrite
|
||||
|
||||
## Game Setup
|
||||
1. Copy Live EFT files into a separate directory (from now on this will be referred to as the "SPT directory")
|
||||
|
@ -1,12 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "4.0.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -2,11 +2,12 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>SPT Aki</Company>
|
||||
<Copyright>Copyright @ SPT Aki 2023</Copyright>
|
||||
<Copyright>Copyright @ SPT Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -19,11 +20,13 @@
|
||||
<ProjectReference Include="..\Aki.Common\Aki.Common.csproj" />
|
||||
<ProjectReference Include="..\Aki.Core\Aki.Core.csproj" />
|
||||
<ProjectReference Include="..\Aki.Reflection\Aki.Reflection.csproj" />
|
||||
<ProjectReference Include="..\Aki.SinglePlayer\Aki.SinglePlayer.csproj" />
|
||||
<ProjectReference Include="..\Aki.PrePatch\Aki.PrePatch.csproj" />
|
||||
<ProjectReference Include="..\Aki.Debugging\Aki.Debugging.csproj" />
|
||||
<ProjectReference Include="..\Aki.Custom\Aki.Custom.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="dotnet cake "../build.cake" --vsbuilt=true" />
|
||||
<Exec Command="../build.bat" WorkingDirectory="$(ProjectDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -3,11 +3,12 @@
|
||||
<PropertyGroup>
|
||||
<Version>1.0.0.0</Version>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>aki-core</AssemblyName>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,13 +1,14 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>aki-custom</AssemblyName>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,20 +1,19 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>aki-debugging</AssemblyName>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp" HintPath="..\Shared\Hollowed\hollowed.dll" Private="False" />
|
||||
<Reference Include="bsg.console.core">
|
||||
<HintPath>..\Shared\Managed\bsg.console.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="bsg.console.core" HintPath="..\Shared\Managed\bsg.console.core.dll" Private="False" />
|
||||
<Reference Include="Sirenix.Serialization" HintPath="..\Shared\Managed\Sirenix.Serialization.dll" Private="False" />
|
||||
<Reference Include="Unity.TextMeshPro" HintPath="..\Shared\Managed\Unity.TextMeshPro.dll" Private="False" />
|
||||
<Reference Include="UnityEngine" HintPath="..\Shared\Managed\UnityEngine.dll" Private="False" />
|
||||
|
@ -4,11 +4,12 @@
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>aki_PrePatch</AssemblyName>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -1,16 +1,17 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2022</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp" HintPath="..\Shared\Hollowed\hollowed.dll" Private="False" />
|
||||
<Reference Include="Assembly-CSharp" HintPath="..\Shared\Hollowed\hollowed.dll" Private="False" />
|
||||
<Reference Include="bsg.componentace.compression.libs.zlib" HintPath="..\Shared\Managed\bsg.componentace.compression.libs.zlib.dll" Private="False" />
|
||||
<Reference Include="Comfort" HintPath="..\Shared\Managed\Comfort.dll" Private="False" />
|
||||
<Reference Include="FilesChecker" HintPath="..\Shared\Managed\FilesChecker.dll" Private="False" />
|
||||
|
@ -1,25 +1,24 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<TargetFramework>net471</TargetFramework>
|
||||
<AssemblyName>aki-singleplayer</AssemblyName>
|
||||
<Configuration>Release</Configuration>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<Company>Aki</Company>
|
||||
<Copyright>Copyright @ Aki 2023</Copyright>
|
||||
<Copyright>Copyright @ Aki 2024</Copyright>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="Assembly-CSharp" HintPath="..\Shared\Hollowed\hollowed.dll" Private="False" />
|
||||
<Reference Include="Comfort.Unity" HintPath="..\Shared\Managed\Comfort.Unity.dll" Private="False" />
|
||||
<Reference Include="DissonanceVoip" HintPath="..\Shared\Managed\DissonanceVoip.dll" Private="False" />
|
||||
<Reference Include="Comfort.Unity" HintPath="..\Shared\Managed\Comfort.Unity.dll" Private="False" />
|
||||
<Reference Include="DissonanceVoip" HintPath="..\Shared\Managed\DissonanceVoip.dll" Private="False" />
|
||||
<Reference Include="ItemComponent.Types" HintPath="..\Shared\Managed\ItemComponent.Types.dll" Private="False" />
|
||||
<Reference Include="Comfort" HintPath="..\Shared\Managed\Comfort.dll" Private="False" />
|
||||
<Reference Include="UnityEngine" HintPath="..\Shared\Managed\UnityEngine.dll" Private="False" />
|
||||
<Reference Include="UnityEngine.AudioModule">
|
||||
<HintPath>..\Shared\Managed\UnityEngine.AudioModule.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="UnityEngine.AudioModule" HintPath="..\Shared\Managed\UnityEngine.AudioModule.dll" Private="False" />
|
||||
<Reference Include="UnityEngine.CoreModule" HintPath="..\Shared\Managed\UnityEngine.CoreModule.dll" Private="False" />
|
||||
</ItemGroup>
|
||||
|
||||
|
@ -18,7 +18,7 @@
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "dotnet cake",
|
||||
"command": "dotnet build --configuration Release",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
|
52
project/build.bat
Normal file
52
project/build.bat
Normal file
@ -0,0 +1,52 @@
|
||||
@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 ---------------
|
@ -1,107 +0,0 @@
|
||||
string target = Argument<string>("target", "ExecuteBuild");
|
||||
bool VSBuilt = Argument<bool>("vsbuilt", false);
|
||||
|
||||
#addin nuget:?package=Cake.FileHelpers&version=5.0.0
|
||||
|
||||
// Cake API Reference: https://cakebuild.net/dsl/
|
||||
// setup variables
|
||||
var buildDir = "./Build";
|
||||
var delPaths = GetDirectories("./**/*(obj|bin)");
|
||||
var licenseFile = "../LICENSE.md";
|
||||
var managedFolder = string.Format("{0}/{1}/{2}", buildDir, "EscapeFromTarkov_Data", "Managed");
|
||||
var bepInExPluginsFolder = string.Format("{0}/{1}/{2}", buildDir, "BepInEx", "plugins");
|
||||
var bepInExPluginsSptFolder = string.Format("{0}/{1}", bepInExPluginsFolder, "spt");
|
||||
var bepInExPatchersFolder = string.Format("{0}/{1}/{2}", buildDir, "BepInEx", "patchers");
|
||||
var solutionPath = "./Modules.sln";
|
||||
|
||||
Setup(context =>
|
||||
{
|
||||
//building from VS will lock the files and fail to clean the project directories. Post-Build event on Aki.Build sets this switch to true to avoid this.
|
||||
FileWriteText("./vslock", "lock");
|
||||
});
|
||||
|
||||
Teardown(context =>
|
||||
{
|
||||
if(FileExists("./vslock"))
|
||||
{
|
||||
DeleteFile("./vslock"); //remove vslock file
|
||||
}
|
||||
});
|
||||
|
||||
// Clean build directory and remove obj / bin folder from projects
|
||||
Task("Clean")
|
||||
.WithCriteria(!VSBuilt)
|
||||
.Does(() =>
|
||||
{
|
||||
CleanDirectory(buildDir);
|
||||
})
|
||||
.DoesForEach(delPaths, (directoryPath) =>
|
||||
{
|
||||
DeleteDirectory(directoryPath, new DeleteDirectorySettings
|
||||
{
|
||||
Recursive = true,
|
||||
Force = true
|
||||
});
|
||||
});
|
||||
|
||||
// Build solution
|
||||
Task("Build")
|
||||
.IsDependentOn("Clean")
|
||||
.WithCriteria(!FileExists("./vslock")) // check for lock file if running from VS
|
||||
.Does(() =>
|
||||
{
|
||||
DotNetBuild(solutionPath, new DotNetBuildSettings
|
||||
{
|
||||
Configuration = "Release"
|
||||
});
|
||||
});
|
||||
|
||||
// Copy modules, managed dlls, and license to the build folder
|
||||
Task("CopyBuildData")
|
||||
.IsDependentOn("Build")
|
||||
.Does(() =>
|
||||
{
|
||||
CleanDirectory(buildDir);
|
||||
CreateDirectory(managedFolder);
|
||||
CreateDirectory(bepInExPluginsFolder);
|
||||
CreateDirectory(bepInExPluginsSptFolder);
|
||||
CreateDirectory(bepInExPatchersFolder);
|
||||
CopyFile(licenseFile, string.Format("{0}/LICENSE-Modules.txt", buildDir));
|
||||
})
|
||||
.DoesForEach(GetFiles("./Aki.*/bin/Release/net471/*.dll"), (dllPath) => //copy modules
|
||||
{
|
||||
if(dllPath.GetFilename().ToString().StartsWith("aki_"))
|
||||
{
|
||||
//Incase you want to see what is being copied for debuging
|
||||
//Spectre.Console.AnsiConsole.WriteLine(string.Format("Adding Module: {0}", dllPath.GetFilename()));
|
||||
|
||||
string patcherTransferPath = string.Format("{0}/{1}", bepInExPatchersFolder, dllPath.GetFilename());
|
||||
|
||||
CopyFile(dllPath, patcherTransferPath);
|
||||
}
|
||||
if(dllPath.GetFilename().ToString().StartsWith("aki-"))
|
||||
{
|
||||
//Incase you want to see what is being copied for debuging
|
||||
//Spectre.Console.AnsiConsole.WriteLine(string.Format("Adding Module: {0}", dllPath.GetFilename()));
|
||||
|
||||
string moduleTransferPath = string.Format("{0}/{1}", bepInExPluginsSptFolder, dllPath.GetFilename());
|
||||
|
||||
CopyFile(dllPath, moduleTransferPath);
|
||||
}
|
||||
else if (dllPath.GetFilename().ToString().StartsWith("Aki.")) // Only copy the custom-built dll's to Managed
|
||||
{
|
||||
//Incase you want to see what is being copied for debuging
|
||||
//Spectre.Console.AnsiConsole.WriteLine(string.Format("Adding managed dll: {0}", dllPath.GetFilename()));
|
||||
|
||||
string fileTransferPath = string.Format("{0}/{1}", managedFolder, dllPath.GetFilename());
|
||||
|
||||
CopyFile(dllPath, fileTransferPath);
|
||||
}
|
||||
});
|
||||
|
||||
// Runs all build tasks based on dependency and configuration
|
||||
Task("ExecuteBuild")
|
||||
.IsDependentOn("CopyBuildData");
|
||||
|
||||
// Runs target task
|
||||
RunTarget(target);
|
Loading…
x
Reference in New Issue
Block a user