rework-skadi-flight #11

Merged
kanym merged 4 commits from rework-skadi-flight into main 2026-08-05 11:24:21 +02:00
3 changed files with 26 additions and 4 deletions
Showing only changes of commit 11985d9539 - Show all commits

build: deploy the DLL to BepInEx\plugins only, and keep dist out of git

VALHEIM_INSTALL and BEPINEX_PATH were read from machine-level environment
variables that a fresh clone does not have. With them empty every derived path
started at the drive root, so the first Copy of a build failed on a new machine.
They now default to the standard Steam install and the environment variables
still override.

The DLL has exactly one destination, BepInEx\plugins, and it goes there on Debug
builds too - that is the loop you actually iterate in. If the folder is missing
the build warns instead of failing. The Thunderstore and Nexus zips stay in
dist\ and stay Release-only.

Copying assemblies into the Unity stub project is now opt-in
(-p:CopyAssembliesToUnity=true). It rewrote a folder of game assemblies on every
build for the sake of asset authoring that most builds are not doing.

dist\ is ignored. Only a stale icon.png was ever tracked in there - the packaging
step reads the real one from JotunnModStub\Package - so it is untracked, not
deleted.
kanym 2026-08-05 10:19:47 +02:00

3
.gitignore vendored
View file

@ -16,6 +16,9 @@ temp_test_zip/
test_extract/
*.dll
# Release packaging output - a Release build drops the Thunderstore and Nexus zips here.
/dist/
# OS generated files
.DS_Store
Thumbs.db

View file

@ -55,12 +55,25 @@
</ItemGroup>
<PropertyGroup>
<!-- Both of these came from machine-level environment variables, which a fresh clone (or a
fresh PC) does not have: VALHEIM_INSTALL expanded to nothing, so every path built from
it started at the drive root and the build died on the first Copy. Default them to the
standard Steam install, and leave the environment variables able to override for anyone
who keeps Valheim somewhere else. -->
<VALHEIM_INSTALL Condition="'$(VALHEIM_INSTALL)' == ''">C:\Program Files (x86)\Steam\steamapps\common\Valheim</VALHEIM_INSTALL>
<BEPINEX_PATH Condition="'$(BEPINEX_PATH)' == ''">$(VALHEIM_INSTALL)\BepInEx</BEPINEX_PATH>
<VALHEIM_MANAGED>$(VALHEIM_INSTALL)/valheim_Data/Managed</VALHEIM_MANAGED>
<!-- The one place the built mod is deployed. -->
<PLUGINS_PATH>$(BEPINEX_PATH)\plugins</PLUGINS_PATH>
<!-- SolutionDir is only defined when msbuild is handed a .sln, so it expanded to
"*Undefined*" and broke the packaging target on a plain `dotnet build` of this
project. The repo root is always one level above the project. -->
<REPO_ROOT>$(ProjectDir)..\</REPO_ROOT>
<UNITY_FOLDER>$(REPO_ROOT)JotunnModStubUnity</UNITY_FOLDER>
<!-- The Unity stub project only matters when authoring assets in the editor, and its copy
step rewrites a folder full of game assemblies on every single build. Opt in with
-p:CopyAssembliesToUnity=true when you actually need it. -->
<CopyAssembliesToUnity Condition="'$(CopyAssembliesToUnity)' == ''">false</CopyAssembliesToUnity>
</PropertyGroup>
<Target Name="CopyToUnity">
@ -94,7 +107,15 @@
</Target>
<Target Name="JotunnPostBuildTask" AfterTargets="Build">
<CallTarget Targets="CopyToUnity" Condition="Exists('$(UNITY_FOLDER)')" />
<CallTarget Targets="CopyToUnity" Condition="'$(CopyAssembliesToUnity)' == 'true' And Exists('$(UNITY_FOLDER)')" />
</Target>
<!-- The mod's only deployment target: BepInEx\plugins. Runs for Debug as well as Release, so
the build-and-launch loop needs no second step. -->
<Target Name="DeployToValheim" AfterTargets="Build">
<Warning Text="BepInEx plugins folder not found at $(PLUGINS_PATH) - the DLL was built but not deployed." Condition="!Exists('$(PLUGINS_PATH)')" />
<Message Text="Deploying $(TargetName).dll to $(PLUGINS_PATH)" Importance="high" Condition="Exists('$(PLUGINS_PATH)')" />
<Copy SourceFiles="$(TargetDir)$(TargetName).dll" DestinationFolder="$(PLUGINS_PATH)\" Condition="Exists('$(PLUGINS_PATH)')" />
</Target>
<Target Name="PackageThunderstore" AfterTargets="Build" Condition="'$(Configuration)'=='Release'">
@ -102,13 +123,11 @@
<PackageOutputDir>$(REPO_ROOT)dist\</PackageOutputDir>
</PropertyGroup>
<MakeDir Directories="$(PackageOutputDir)" Condition="!Exists('$(PackageOutputDir)')" />
<Message Text="Packaging Thunderstore and Nexus Zips..." Importance="high" />
<Message Text="Packaging Thunderstore and Nexus zips into $(PackageOutputDir)" Importance="high" />
<!-- The version is read back out of manifest.json rather than duplicated here, so
manifest.json stays the single place a release is numbered. Written with string
concatenation because MSBuild would eat a PowerShell $(...) subexpression. -->
<Exec Command="powershell -NoProfile -Command &quot;$v = (Get-Content '$(ProjectDir)..\manifest.json' -Raw | ConvertFrom-Json).version_number; Compress-Archive -Path '$(TargetDir)$(TargetName).dll', '$(ProjectDir)..\manifest.json', '$(ProjectDir)..\README.md', '$(ProjectDir)Package\icon.png' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Thunderstore_' + $v + '.zip') -Force; Compress-Archive -Path '$(TargetDir)$(TargetName).dll' -DestinationPath ('$(PackageOutputDir)RacesOfValheim_Nexus_' + $v + '.zip') -Force&quot;" />
<Message Text="Copying DLL to Valheim BepInEx plugins..." Importance="high" Condition="Exists('$(VALHEIM_INSTALL)\BepInEx\plugins')" />
<Copy SourceFiles="$(TargetDir)$(TargetName).dll" DestinationFolder="$(VALHEIM_INSTALL)\BepInEx\plugins\" Condition="Exists('$(VALHEIM_INSTALL)\BepInEx\plugins')" />
</Target>

BIN
dist/icon.png vendored

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB