From 2bfdb1eeea691dab8d14e70ca52ae918b870e655 Mon Sep 17 00:00:00 2001 From: CWXDEV Date: Fri, 16 Feb 2024 12:08:15 +0000 Subject: [PATCH] Feature: - Remove Cake - Add build script - Mimic the same features as Modules --- project/.config/dotnet-tools.json | 12 ----- project/Aki.Build/Aki.Build.csproj | 10 ++-- project/Launcher.code-workspace | 2 +- project/Launcher.sln | 1 - project/build.bat | 37 ++++++++++++++ project/build.cake | 82 ------------------------------ 6 files changed, 41 insertions(+), 103 deletions(-) delete mode 100644 project/.config/dotnet-tools.json create mode 100644 project/build.bat delete mode 100644 project/build.cake diff --git a/project/.config/dotnet-tools.json b/project/.config/dotnet-tools.json deleted file mode 100644 index 31e896e..0000000 --- a/project/.config/dotnet-tools.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "version": 1, - "isRoot": true, - "tools": { - "cake.tool": { - "version": "2.0.0", - "commands": [ - "dotnet-cake" - ] - } - } -} \ No newline at end of file diff --git a/project/Aki.Build/Aki.Build.csproj b/project/Aki.Build/Aki.Build.csproj index 29c7892..8d19cda 100644 --- a/project/Aki.Build/Aki.Build.csproj +++ b/project/Aki.Build/Aki.Build.csproj @@ -2,7 +2,7 @@ net6.0 - win10-x64 + win10-x64 @@ -11,12 +11,8 @@ - - - - - - + + diff --git a/project/Launcher.code-workspace b/project/Launcher.code-workspace index a6ead35..a041b0c 100644 --- a/project/Launcher.code-workspace +++ b/project/Launcher.code-workspace @@ -18,7 +18,7 @@ { "label": "build", "type": "shell", - "command": "dotnet cake", + "command": "dotnet build --configuration Release", "group": { "kind": "build", "isDefault": true diff --git a/project/Launcher.sln b/project/Launcher.sln index 930a5d0..e0aca11 100644 --- a/project/Launcher.sln +++ b/project/Launcher.sln @@ -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 diff --git a/project/build.bat b/project/build.bat new file mode 100644 index 0000000..f6005eb --- /dev/null +++ b/project/build.bat @@ -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 --------------- \ No newline at end of file diff --git a/project/build.cake b/project/build.cake deleted file mode 100644 index 5961304..0000000 --- a/project/build.cake +++ /dev/null @@ -1,82 +0,0 @@ -string target = Argument("target", "ExecuteBuild"); -string config = Argument("config", "Release"); -bool VSBuilt = Argument("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); \ No newline at end of file