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.
This commit is contained in:
parent
5cfd8cfab8
commit
11985d9539
3 changed files with 26 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -16,6 +16,9 @@ temp_test_zip/
|
||||||
test_extract/
|
test_extract/
|
||||||
*.dll
|
*.dll
|
||||||
|
|
||||||
|
# Release packaging output - a Release build drops the Thunderstore and Nexus zips here.
|
||||||
|
/dist/
|
||||||
|
|
||||||
# OS generated files
|
# OS generated files
|
||||||
.DS_Store
|
.DS_Store
|
||||||
Thumbs.db
|
Thumbs.db
|
||||||
|
|
|
||||||
|
|
@ -55,12 +55,25 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<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>
|
<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
|
<!-- 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
|
"*Undefined*" and broke the packaging target on a plain `dotnet build` of this
|
||||||
project. The repo root is always one level above the project. -->
|
project. The repo root is always one level above the project. -->
|
||||||
<REPO_ROOT>$(ProjectDir)..\</REPO_ROOT>
|
<REPO_ROOT>$(ProjectDir)..\</REPO_ROOT>
|
||||||
<UNITY_FOLDER>$(REPO_ROOT)JotunnModStubUnity</UNITY_FOLDER>
|
<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>
|
</PropertyGroup>
|
||||||
|
|
||||||
<Target Name="CopyToUnity">
|
<Target Name="CopyToUnity">
|
||||||
|
|
@ -94,7 +107,15 @@
|
||||||
</Target>
|
</Target>
|
||||||
|
|
||||||
<Target Name="JotunnPostBuildTask" AfterTargets="Build">
|
<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>
|
||||||
|
|
||||||
<Target Name="PackageThunderstore" AfterTargets="Build" Condition="'$(Configuration)'=='Release'">
|
<Target Name="PackageThunderstore" AfterTargets="Build" Condition="'$(Configuration)'=='Release'">
|
||||||
|
|
@ -102,13 +123,11 @@
|
||||||
<PackageOutputDir>$(REPO_ROOT)dist\</PackageOutputDir>
|
<PackageOutputDir>$(REPO_ROOT)dist\</PackageOutputDir>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<MakeDir Directories="$(PackageOutputDir)" Condition="!Exists('$(PackageOutputDir)')" />
|
<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
|
<!-- 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
|
manifest.json stays the single place a release is numbered. Written with string
|
||||||
concatenation because MSBuild would eat a PowerShell $(...) subexpression. -->
|
concatenation because MSBuild would eat a PowerShell $(...) subexpression. -->
|
||||||
<Exec Command="powershell -NoProfile -Command "$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"" />
|
<Exec Command="powershell -NoProfile -Command "$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"" />
|
||||||
<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>
|
</Target>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
BIN
dist/icon.png
vendored
BIN
dist/icon.png
vendored
Binary file not shown.
|
Before Width: | Height: | Size: 72 KiB |
Loading…
Add table
Add a link
Reference in a new issue