-
Notifications
You must be signed in to change notification settings - Fork 67
Expand file tree
/
Copy pathDeploy.targets
More file actions
80 lines (63 loc) · 3.36 KB
/
Copy pathDeploy.targets
File metadata and controls
80 lines (63 loc) · 3.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?xml version="1.0" encoding="utf-8"?>
<!--
Deploy.targets
Deploys a built module into the Bannerlord install via the `mb2` junction
(see memory: build-environment / deploy-wipes-module). Replaces the old
deploy.ps1 + config_*.json + PostBuildEvent pipeline.
A consuming .csproj must set these properties before importing this file:
<ModName> Coop Module folder name + DLL/class name root
<MainClass> CoopMod SubModule class type (ModName.MainClass)
<ModVersion> v0.0.1 Module version
<GameVersion> v1.3.12 Depended-module game version
Behavior vs. the old deploy.ps1:
- Runs on every build (no Inputs/Outputs skip). Copy uses SkipUnchangedFiles
so unchanged files still aren't re-copied. No more wipe-and-recreate of the
module folder, so an empty build output can no longer delete the live module.
- No-ops cleanly when the mb2 junction is absent (CI / fresh checkout)
instead of throwing.
-->
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!-- This file lives at the repo root; locate everything relative to it. -->
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
<ModsRoot>$(RepoRoot)mb2\Modules</ModsRoot>
<DeploySourceDir>$(RepoRoot)deploy</DeploySourceDir>
<UIMoviesDir>$(RepoRoot)UIMovies</UIMoviesDir>
<SubModuleTemplate>$(DeploySourceDir)\SubModule.xml</SubModuleTemplate>
<ModDir>$(ModsRoot)\$(ModName)</ModDir>
<ModBinDir>$(ModDir)\bin\Win64_Shipping_Client</ModBinDir>
<ModPrefabDir>$(ModDir)\GUI\Prefabs</ModPrefabDir>
</PropertyGroup>
<ItemGroup>
<!-- All build outputs (DLLs) for this project. -->
<DeployDllFiles Include="$(TargetDir)**\*.dll" />
<!-- Static module files (start-*.bat, instructions); SubModule.xml is templated separately. -->
<DeployStaticFiles Include="$(DeploySourceDir)\**\*"
Exclude="$(SubModuleTemplate)" />
<!-- UI movie prefabs (copied into GUI\Prefabs). -->
<UIMovieFiles Include="$(UIMoviesDir)\**\*" Condition="Exists('$(UIMoviesDir)')" />
</ItemGroup>
<Target Name="DeployToGame"
AfterTargets="Build"
Condition="'$(ModName)' != '' and Exists('$(ModsRoot)')">
<Message Importance="high" Text="Deploying $(ModName) -> $(ModDir)" />
<MakeDir Directories="$(ModBinDir);$(ModPrefabDir)" />
<!-- DLLs -->
<Copy SourceFiles="@(DeployDllFiles)"
DestinationFolder="$(ModBinDir)"
SkipUnchangedFiles="true" />
<!-- Static deploy files, preserving any subfolder structure -->
<Copy SourceFiles="@(DeployStaticFiles)"
DestinationFiles="@(DeployStaticFiles->'$(ModDir)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
<!-- UI movie prefabs -->
<Copy SourceFiles="@(UIMovieFiles)"
DestinationFiles="@(UIMovieFiles->'$(ModPrefabDir)\%(RecursiveDir)%(Filename)%(Extension)')"
SkipUnchangedFiles="true" />
<!-- SubModule.xml: substitute tokens from the template into the module folder -->
<WriteLinesToFile
File="$(ModDir)\SubModule.xml"
Lines="$([System.IO.File]::ReadAllText('$(SubModuleTemplate)').Replace('${name}','$(ModName)').Replace('${main_class}','$(MainClass)').Replace('${version}','$(ModVersion)').Replace('${game_version}','$(GameVersion)'))"
Overwrite="true" />
</Target>
</Project>