mirror of
https://github.com/sp-tarkov/launcher.git
synced 2025-02-12 16:50:43 -05:00
Feature:
- Remove Cake - Add build script - Mimic the same features as Modules
This commit is contained in:
parent
791ad05e27
commit
2bfdb1eeea
@ -1,12 +0,0 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {
|
||||
"cake.tool": {
|
||||
"version": "2.0.0",
|
||||
"commands": [
|
||||
"dotnet-cake"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,7 @@
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
<RuntimeIdentifier>win10-x64</RuntimeIdentifier>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -11,12 +11,8 @@
|
||||
<ProjectReference Include="..\Aki.Launcher\Aki.Launcher.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingInsideVisualStudio)' == 'true'">
|
||||
<Exec Command="dotnet cake "../build.cake" --config="$(ConfigurationName)" --vsbuilt=true" />
|
||||
</Target>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(BuildingByReSharper)' == 'true'">
|
||||
<Exec Command="dotnet cake "../build.cake" --config="$(ConfigurationName)" --vsbuilt=true" />
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="../build.bat" WorkingDirectory="$(ProjectDir)" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
|
@ -18,7 +18,7 @@
|
||||
{
|
||||
"label": "build",
|
||||
"type": "shell",
|
||||
"command": "dotnet cake",
|
||||
"command": "dotnet build --configuration Release",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
|
@ -13,7 +13,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aki.Launcher", "Aki.Launche
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
|
37
project/build.bat
Normal file
37
project/build.bat
Normal file
@ -0,0 +1,37 @@
|
||||
@echo off
|
||||
:: Set some Vars to use
|
||||
set buildFolder=..\Build
|
||||
set akiDataFolder=..\Build\Aki_Data
|
||||
set projReleaseFolder=.\bin\Release\net6.0\win10-x64
|
||||
set launcherAssetFolder=..\Aki.Launcher\Aki_Data
|
||||
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 %akiDataFolder% mkdir %akiDataFolder%
|
||||
|
||||
echo --------------- Done Creating Output Build Folders ---------------
|
||||
|
||||
echo --------------- Moving DLLs to %buildFolder% ---------------
|
||||
|
||||
:: Move DLLs/exe/json project's bin\Release folder to the build folder
|
||||
xcopy "%projReleaseFolder%\Aki.Launcher.exe" %buildFolder%
|
||||
xcopy "%launcherAssetFolder%" "%buildFolder%\Aki_Data" /s /e
|
||||
|
||||
:: 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-Launcher.txt"
|
||||
|
||||
echo --------------- Done Writing License File ---------------
|
@ -1,82 +0,0 @@
|
||||
string target = Argument<string>("target", "ExecuteBuild");
|
||||
string config = Argument<string>("config", "Release");
|
||||
bool VSBuilt = Argument<bool>("vsbuilt", false);
|
||||
|
||||
// Cake API Reference: https://cakebuild.net/dsl/
|
||||
// setup variables
|
||||
var buildDir = "./Build";
|
||||
var csprojPaths = GetFiles("./**/Aki.*(Launcher).csproj");
|
||||
var delPaths = GetDirectories("./**/*(obj|bin)");
|
||||
var akiData = "./Aki.Launcher/Aki_Data";
|
||||
var licenseFile = "../LICENSE.md";
|
||||
var publishRuntime = "win10-x64";
|
||||
var launcherDebugFolder = "./Aki.Launcher/bin/Debug/net6.0/win10-x64";
|
||||
|
||||
// Clean build directory and remove obj / bin folder from projects
|
||||
Task("Clean")
|
||||
.WithCriteria(!VSBuilt) //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.
|
||||
.Does(() =>
|
||||
{
|
||||
CleanDirectory(buildDir);
|
||||
})
|
||||
.DoesForEach(delPaths, (directoryPath) =>
|
||||
{
|
||||
DeleteDirectory(directoryPath, new DeleteDirectorySettings
|
||||
{
|
||||
Recursive = true,
|
||||
Force = true
|
||||
});
|
||||
});
|
||||
|
||||
// Restore, build, and publish selected csproj files
|
||||
Task("Publish")
|
||||
.IsDependentOn("Clean")
|
||||
.DoesForEach(csprojPaths, (csprojFile) =>
|
||||
{
|
||||
DotNetPublish(csprojFile.FullPath, new DotNetPublishSettings
|
||||
{
|
||||
NoLogo = true,
|
||||
Configuration = config,
|
||||
Runtime = publishRuntime,
|
||||
PublishSingleFile = true,
|
||||
SelfContained = false,
|
||||
OutputDirectory = buildDir
|
||||
});
|
||||
});
|
||||
|
||||
// Copy Aki_Data folder and license to build directory
|
||||
Task("CopyBuildData")
|
||||
.IsDependentOn("Publish")
|
||||
.Does(() =>
|
||||
{
|
||||
CopyDirectory(akiData, $"{buildDir}/Aki_Data");
|
||||
CopyFile(licenseFile, $"{buildDir}/LICENSE-Launcher.txt");
|
||||
});
|
||||
|
||||
// Copy Aki_Data to the launcher's debug directory so you can run the launcher with debugging from VS
|
||||
Task("CopyDebugData")
|
||||
.WithCriteria(config == "Debug")
|
||||
.Does(() =>
|
||||
{
|
||||
EnsureDirectoryDoesNotExist($"{launcherDebugFolder}/Aki_Data");
|
||||
|
||||
CopyDirectory(akiData, $"{launcherDebugFolder}/Aki_Data");
|
||||
});
|
||||
|
||||
// Remove pdb files from build if running in release configuration
|
||||
Task("RemovePDBs")
|
||||
.WithCriteria(config == "Release")
|
||||
.IsDependentOn("CopyBuildData")
|
||||
.Does(() =>
|
||||
{
|
||||
DeleteFiles($"{buildDir}/*.pdb");
|
||||
});
|
||||
|
||||
// Runs all build tasks based on dependency and configuration
|
||||
Task("ExecuteBuild")
|
||||
.IsDependentOn("CopyBuildData")
|
||||
.IsDependentOn("RemovePDBs")
|
||||
.IsDependentOn("CopyDebugData");
|
||||
|
||||
// Runs target task
|
||||
RunTarget(target);
|
Loading…
x
Reference in New Issue
Block a user