From ca2eec3d0d84414b4642fbc201c0ea5741ce9ef1 Mon Sep 17 00:00:00 2001
From: hazre <37149950+hazre@users.noreply.github.com>
Date: Thu, 11 Sep 2025 15:14:42 +0200
Subject: [PATCH 1/5] Add doorstop to thunderstore package
---
.config/dotnet-tools.json | 7 +++
build.cake | 99 +++++++++++++++++++++++++++++++++++++++
thunderstore.toml | 4 ++
3 files changed, 110 insertions(+)
create mode 100644 build.cake
diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json
index 13e684c..1bf573f 100644
--- a/.config/dotnet-tools.json
+++ b/.config/dotnet-tools.json
@@ -8,6 +8,13 @@
"tcli"
],
"rollForward": true
+ },
+ "cake.tool": {
+ "version": "5.0.0",
+ "commands": [
+ "dotnet-cake"
+ ],
+ "rollForward": false
}
}
}
\ No newline at end of file
diff --git a/build.cake b/build.cake
new file mode 100644
index 0000000..3ecff02
--- /dev/null
+++ b/build.cake
@@ -0,0 +1,99 @@
+var doorstopVersion = "4.4.1";
+var projectPath = "./RenderiteHook/RenderiteHook.csproj";
+
+var target = Argument("target", "Default");
+var configuration = Argument("configuration", "Release");
+
+var packageVersion = XmlPeek(projectPath, "/Project/PropertyGroup/Version");
+
+var distDir = Directory("./dist");
+var extractDir = distDir + Directory("Doorstop");
+var downloadUrl = $"https://github.com/NeighTools/UnityDoorstop/releases/download/v{doorstopVersion}/doorstop_win_release_{doorstopVersion}.zip";
+var zipFile = distDir + File($"doorstop_win_release_{doorstopVersion}.zip");
+
+Task("Clean")
+ .Does(() =>
+{
+ if (DirectoryExists(distDir))
+ {
+ CleanDirectory(distDir);
+ }
+ else
+ {
+ CreateDirectory(distDir);
+ }
+});
+
+Task("DownloadDoorstop")
+ .IsDependentOn("Clean")
+ .Does(() =>
+{
+ Information($"Downloading Doorstop v{doorstopVersion}...");
+
+ if (!FileExists(zipFile))
+ {
+ DownloadFile(downloadUrl, zipFile);
+ Information($"Downloaded to: {zipFile}");
+ }
+ else
+ {
+ Information("File already exists, skipping download.");
+ }
+});
+
+Task("ExtractDoorstop")
+ .IsDependentOn("DownloadDoorstop")
+ .Does(() =>
+{
+ Information($"Extracting Doorstop to {extractDir}...");
+
+ if (!DirectoryExists(extractDir))
+ {
+ CreateDirectory(extractDir);
+ }
+
+ Unzip(zipFile, extractDir);
+ Information("Extraction completed.");
+});
+
+Task("BuildRenderiteHook")
+ .IsDependentOn("ExtractDoorstop")
+ .Does(() =>
+{
+ Information($"Building RenderiteHook version {packageVersion}...");
+
+ // Build RenderiteHook project
+ DotNetBuild(projectPath, new DotNetBuildSettings
+ {
+ Configuration = configuration,
+ Verbosity = DotNetVerbosity.Minimal
+ });
+
+ Information("RenderiteHook build completed successfully.");
+});
+
+Task("Build")
+ .IsDependentOn("BuildRenderiteHook")
+ .Does(() =>
+{
+ Information($"Building Thunderstore package with version {packageVersion}...");
+
+ // Run dotnet tcli build command
+ var exitCode = StartProcess("dotnet", new ProcessSettings
+ {
+ Arguments = $"tcli build --package-version {packageVersion}",
+ WorkingDirectory = Directory(".")
+ });
+
+ if (exitCode != 0)
+ {
+ throw new Exception($"dotnet tcli build failed with exit code {exitCode}");
+ }
+
+ Information("Thunderstore package build completed successfully.");
+});
+
+Task("Default")
+ .IsDependentOn("Build");
+
+RunTarget(target);
\ No newline at end of file
diff --git a/thunderstore.toml b/thunderstore.toml
index e32215e..2d7c4a2 100644
--- a/thunderstore.toml
+++ b/thunderstore.toml
@@ -29,6 +29,10 @@ target = "plugins/RenderiteHook/"
source = "./RenderiteHook/bin/Release/RenderiteHook.pdb"
target = "plugins/RenderiteHook/"
+[[build.copy]]
+source = "./dist/Doorstop/x64"
+target = "plugins/RenderiteHook/Doorstop"
+
# [[build.copy]]
# source = "./CHANGELOG.md"
# target = "/"
From b5d2d92616b7ad2f7f7149350d2d070296d6a4be Mon Sep 17 00:00:00 2001
From: hazre <37149950+hazre@users.noreply.github.com>
Date: Thu, 11 Sep 2025 16:01:44 +0200
Subject: [PATCH 2/5] Update doorstop config in cake build script
---
RenderiteHook/RenderiteHook.csproj | 2 +-
build.cake | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/RenderiteHook/RenderiteHook.csproj b/RenderiteHook/RenderiteHook.csproj
index 8375507..ea17800 100644
--- a/RenderiteHook/RenderiteHook.csproj
+++ b/RenderiteHook/RenderiteHook.csproj
@@ -12,7 +12,7 @@
enable
true
false
- true
+ false
$(ResonitePath)/
$(MSBuildProgramFiles32)\Steam\steamapps\common\Resonite\
$(HOME)/.steam/steam/steamapps/common/Resonite/
diff --git a/build.cake b/build.cake
index 3ecff02..2e6f858 100644
--- a/build.cake
+++ b/build.cake
@@ -54,6 +54,21 @@ Task("ExtractDoorstop")
Unzip(zipFile, extractDir);
Information("Extraction completed.");
+
+ // Update doorstop_config.ini to point to BepInEx
+ var configFile = extractDir + File("x64/doorstop_config.ini");
+ if (FileExists(configFile))
+ {
+ Information("Updating doorstop_config.ini...");
+ var content = System.IO.File.ReadAllText(configFile);
+ content = content.Replace("target_assembly=Doorstop.dll", "target_assembly=BepInEx\\core\\BepInEx.Preloader.dll");
+ System.IO.File.WriteAllText(configFile, content);
+ Information("Config file updated successfully.");
+ }
+ else
+ {
+ Warning($"Config file not found at: {configFile}");
+ }
});
Task("BuildRenderiteHook")
From e110f75d22d3c495a559a1f65389688327348345 Mon Sep 17 00:00:00 2001
From: hazre <37149950+hazre@users.noreply.github.com>
Date: Thu, 11 Sep 2025 16:02:22 +0200
Subject: [PATCH 3/5] Add doorstop copying functionality
---
RenderiteHook/Plugin.cs | 56 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/RenderiteHook/Plugin.cs b/RenderiteHook/Plugin.cs
index 2ce03fb..fe87232 100644
--- a/RenderiteHook/Plugin.cs
+++ b/RenderiteHook/Plugin.cs
@@ -46,9 +46,65 @@ public static IEnumerable Transpiler(IEnumerable
Date: Thu, 11 Sep 2025 16:05:47 +0200
Subject: [PATCH 4/5] Update workflows to use the cake build script
---
.github/workflows/build.yml | 16 +++++-----------
.github/workflows/publish.yml | 11 ++++-------
.github/workflows/release.yml | 16 +++++-----------
3 files changed, 14 insertions(+), 29 deletions(-)
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index bed27b9..8e9521b 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -28,20 +28,14 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- - name: Build
- run: |
- dotnet build -c Release
- # Copy the built DLL to dist folder
- mkdir -p ./bin/dist/
- cp ./RenderiteHook/bin/Release/RenderiteHook.dll ./bin/dist/
- - name: Create Thunderstore Package
- run: |
- dotnet tool restore
- dotnet tcli build --package-version ${{ steps.info.outputs.version }}
+ - name: Install Cake Tool
+ run: dotnet tool restore
+ - name: Build with Cake
+ run: dotnet cake --target=Build --verbosity=normal
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: RenderiteHook-${{ steps.info.outputs.version }}-${{ steps.info.outputs.sha_short }}
path: |
- ./bin/dist/*.dll
+ ./RenderiteHook/bin/Release/*.dll
./build/*.zip
\ No newline at end of file
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
index 8f8f46d..4fee356 100644
--- a/.github/workflows/publish.yml
+++ b/.github/workflows/publish.yml
@@ -24,13 +24,10 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- - name: Build
- run: |
- dotnet build -c Release
- - name: Create Thunderstore Package
- run: |
- dotnet tool restore
- dotnet tcli build --package-version $VERSION
+ - name: Install Cake Tool
+ run: dotnet tool restore
+ - name: Build with Cake
+ run: dotnet cake --target=Build --verbosity=normal
- name: Publish to Thunderstore
run: |
ZIP_FILE=$(ls ./build/*.zip | head -1)
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index d2ff07d..e87fc4e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -36,16 +36,10 @@ jobs:
- uses: actions/setup-dotnet@v4
with:
dotnet-version: "9.0.x"
- - name: Build
- run: |
- dotnet build -c Release
- # Copy the built DLL to dist folder for release
- mkdir -p ./bin/dist/
- cp ./RenderiteHook/bin/Release/RenderiteHook.dll ./bin/dist/
- - name: Create Thunderstore Package
- run: |
- dotnet tool restore
- dotnet tcli build
+ - name: Install Cake Tool
+ run: dotnet tool restore
+ - name: Build with Cake
+ run: dotnet cake --target=Build --verbosity=normal
- name: Create Git Tag (if needed)
if: ${{ github.event_name == 'workflow_dispatch' }}
run: |
@@ -71,7 +65,7 @@ jobs:
tag_name: v${{ steps.info.outputs.version }}
target_commitish: ${{ github.sha }}
files: |
- ./bin/dist/*.dll
+ ./RenderiteHook/bin/Release/*.dll
./build/*.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
From 9cb0b0eb8a1f478abf19b5bd5d5b6f6ad86ed5ed Mon Sep 17 00:00:00 2001
From: hazre <37149950+hazre@users.noreply.github.com>
Date: Thu, 11 Sep 2025 18:51:24 +0200
Subject: [PATCH 5/5] Remove redundant CreateDirectory call
---
RenderiteHook/Plugin.cs | 12 +++---------
1 file changed, 3 insertions(+), 9 deletions(-)
diff --git a/RenderiteHook/Plugin.cs b/RenderiteHook/Plugin.cs
index fe87232..30e71c7 100644
--- a/RenderiteHook/Plugin.cs
+++ b/RenderiteHook/Plugin.cs
@@ -13,7 +13,7 @@ namespace RenderiteHook;
[BepInDependency(BepInExResoniteShim.PluginMetadata.GUID, BepInDependency.DependencyFlags.HardDependency)]
public class Plugin : BasePlugin
{
- internal static new ManualLogSource Log;
+ internal static new ManualLogSource Log = null!;
public override void Load()
{
@@ -31,7 +31,7 @@ public static IEnumerable Transpiler(IEnumerable Transpiler(IEnumerable