-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
71 lines (65 loc) · 3.73 KB
/
Copy pathDirectory.Build.targets
File metadata and controls
71 lines (65 loc) · 3.73 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
<?xml version="1.0" encoding="utf-8"?>
<Project>
<!-- Checking not IsLib because the example mod merges the shared lib -->
<Target Name="Merge" AfterTargets="Build" Condition="'$(IsLib)' != 'true'">
<ItemGroup>
<_LocalRefs Include="$(TargetDir)/*.dll" Exclude="$(TargetPath)" />
</ItemGroup>
<Exec
Command="wine $(NuGetPackageRoot)/ilrepack/$(ILRepackVersion)/tools/ILRepack.exe /out:$(TargetPath) /lib:$(SolutionDir)/lib $(TargetPath) @(_LocalRefs -> '%(Identity)', ' ') > /dev/null 2>&1" />
<Delete Files="@(_LocalRefs)" />
</Target>
<PropertyGroup>
<OutputModPath>../obj/$(AssemblyName)</OutputModPath>
<ModsPath>$(GameSavePath)/mods/Dev/$(AssemblyName)/</ModsPath>
</PropertyGroup>
<!-- Checking not IsLib because the example mod should be copied too -->
<ItemGroup Condition="'$(IsLib)' != 'true'">
<_Anim Include="$(ProjectDir)anim/**" />
<_Assets Include="$(ProjectDir)assets/**" />
<_Templates Include="$(ProjectDir)templates/**" />
<_Translations Include="$(ProjectDir)translations/**" />
<_Elements Include="$(ProjectDir)elements/**" />
<_ModInfo Include="$(ProjectDir)/mod_info.yaml;$(ProjectDir)/mod.yaml" />
<_ModDLL Include="$(TargetPath)" />
<_Readme Include="$(ProjectDir)/README.txt;$(ProjectDir)/CREDITS.txt" />
</ItemGroup>
<!-- Copy the mod to the staging dir, and then the final mods folder -->
<Target Name="CopyMod" AfterTargets="Merge" Condition="'$(IsLib)' != 'true'"
Inputs="@(_ModInfo);@(_ModDLL)"
Outputs="@(_ModInfo -> $(OutputModPath)%(Filename)%(Extension));@(_ModDLL -> $(OutputModPath)%(Filename)%(Extension))">
<!-- Copy the mod into a staging folder -->
<!-- DLL and mod info must always exist -->
<Copy SourceFiles="@(_ModDLL)" DestinationFolder="$(OutputModPath)" />
<Copy SourceFiles="@(_ModInfo)" DestinationFolder="$(OutputModPath)" />
<!-- The other files and folders should only be copied if they exist -->
<Copy SourceFiles="@(_Anim)" DestinationFolder="$(OutputModPath)/anim/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(_Assets)" DestinationFolder="$(OutputModPath)/assets/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(_Templates)"
DestinationFolder="$(OutputModPath)/templates/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(_Translations)"
DestinationFolder="$(OutputModPath)/translations/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(_Elements)"
DestinationFolder="$(OutputModPath)/elements/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(_Readme)" DestinationFolder="$(OutputModPath)/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<Copy SourceFiles="@(CopyFolder)"
DestinationFolder="$(OutputModPath)/%(CopyFolder.DestName)/%(RecursiveDir)"
Condition="Exists(%(FullPath))" />
<!-- Copy the final mod to the mods folder -->
<ItemGroup>
<ModData Include="$(OutputModPath)/**" />
</ItemGroup>
<Copy SourceFiles="@(ModData)" DestinationFolder="$(ModsPath)/%(RecursiveDir)" />
</Target>
<!-- The lib should also be output to the staging dir but it has different files -->
<Target Name="CopyLib" AfterTargets="Build" Condition="'$(IsLib)' == 'true'">
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(OutputModPath)" />
<Copy SourceFiles="$(TargetDir)/$(TargetName).xml" DestinationFolder="$(OutputModPath)" />
</Target>
</Project>