forked from CnCNet/xna-cncnet-client
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Build.targets
More file actions
144 lines (126 loc) · 10.6 KB
/
Directory.Build.targets
File metadata and controls
144 lines (126 loc) · 10.6 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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<Project>
<Target Name="ShowBuildInfo" BeforeTargets="CoreCompile" Condition="'$(MSBuildProjectName)' == 'DXMainClient'">
<Message Importance="high" Text="Engine: $(Engine); Platform: $(Platform); TargetFramework: $(TargetFramework); Configuration: $(Configuration)" />
</Target>
<!-- "GetVersion" target is defined in GitVersion package -->
<Target Name="NonReleaseBuildWarning" AfterTargets="GetVersion" BeforeTargets="CoreCompile" Condition="'$(MSBuildProjectName)' == 'DXMainClient' AND ($(GitVersion_CommitsSinceVersionSource) != 0)">
<PropertyGroup>
<DefineConstants>$(DefineConstants);DEVELOPMENT_BUILD</DefineConstants>
</PropertyGroup>
<Warning Text="This is a development build of the client. Stability and reliability may not be fully guaranteed." Condition="'$(BuildingInsideVisualStudio)' != 'true'"></Warning>
</Target>
<Target Name="RestoreUpdater" AfterTargets="Restore" Condition="'$(PublishDir)' != '' AND '$(MSBuildProjectName)' == 'DXMainClient'">
<MSBuild
Projects="$(MSBuildThisFileDirectory)SecondStageUpdater\SecondStageUpdater.csproj"
Properties="TargetFramework=$(TargetFramework.Split('-')[0]);Platform=AnyCPU;RuntimeIdentifier="
Targets="Restore" />
</Target>
<Target Name="BuildUpdater" AfterTargets="Build" Condition="'$(PublishDir)' != '' AND '$(MSBuildProjectName)' == 'DXMainClient'">
<MSBuild
Projects="$(MSBuildThisFileDirectory)SecondStageUpdater\SecondStageUpdater.csproj"
Properties="TargetFramework=$(TargetFramework.Split('-')[0]);Platform=AnyCPU;RuntimeIdentifier=" />
</Target>
<Target Name="MakeDirectoryStructure" AfterTargets="Publish" Condition="'$(MSBuildProjectName)' == 'DXMainClient'">
<CallTarget Targets="PublishNetFrameworkWindowsGLNative;RemoveNetFrameworkWindowsGLNative;RemoveWindowsDXNonWindowsBinaries;RemoveWindowsGLNonWindowsBinaries;RemoveGLMobileBinaries" />
<CallTarget Targets="MoveCommonBinaries;MoveClientExes;MoveUpdater" Condition="'$(NoMove)' != 'true'" />
</Target>
<Target Name="PublishNetFrameworkWindowsGLNative" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework' And '$(Engine)' == 'WindowsGL'">
<Message Importance="high" Text="Copying NetFramework WindowsGLNative files" />
<ItemGroup>
<_lib_x64 Include="$(OutputPath)\x64\*.*" />
<_lib_x86 Include="$(OutputPath)\x86\*.*" />
</ItemGroup>
<Copy SourceFiles="@(_lib_x64)" DestinationFolder="$(PublishDir)\x64" />
<Copy SourceFiles="@(_lib_x86)" DestinationFolder="$(PublishDir)\x86" />
</Target>
<Target Name="RemoveNetFrameworkWindowsGLNative" AfterTargets="PublishNetFrameworkWindowsGLNative">
<Message Importance="high" Text="Removing unnecessary NetFramework WindowsGLNative files" />
<Delete Files="$(PublishDir)SDL2.dll" />
<Delete Files="$(PublishDir)soft_oal.dll" />
</Target>
<Target Name="RemoveWindowsDXNonWindowsBinaries" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' And '$(Engine)' == 'WindowsDX'">
<Message Importance="high" Text="Removing unnecessary WindowsDX files" />
<RemoveDir Directories="$(PublishDir)runtimes/debian-x64" />
<RemoveDir Directories="$(PublishDir)runtimes/fedora-x64" />
<RemoveDir Directories="$(PublishDir)runtimes/opensuse-x64" />
<RemoveDir Directories="$(PublishDir)runtimes/osx" />
<RemoveDir Directories="$(PublishDir)runtimes/rhel-x64" />
</Target>
<Target Name="RemoveWindowsGLNonWindowsBinaries" Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows' And '$(Engine)' == 'WindowsGL'">
<Message Importance="high" Text="Removing unnecessary WindowsGL files" />
<RemoveDir Directories="$(PublishDir)runtimes/linux-x64" />
<RemoveDir Directories="$(PublishDir)runtimes/osx" />
</Target>
<Target Name="RemoveGLMobileBinaries" Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework' And ('$(Engine)' == 'UniversalGL' Or '$(Engine)' == 'WindowsGL')">
<Message Importance="high" Text="Removing unnecessary GL files" />
<!-- Note: You might need to update folders here if the dependency `MonoGame.Framework.DesktopGL` (specifically, its dependency `MonoGame.Library.OpenAL`) gets updated. -->
<ItemGroup>
<!-- https://stackoverflow.com/a/71699878 -->
<_GLAndroidDirectories Include="$([System.IO.Directory]::GetDirectories($(PublishDir)runtimes/, 'android*', System.IO.SearchOption.TopDirectoryOnly))" />
<_GLIosDirectories Include="$([System.IO.Directory]::GetDirectories($(PublishDir)runtimes/, 'ios*', System.IO.SearchOption.TopDirectoryOnly))" />
</ItemGroup>
<RemoveDir Directories="@(_GLAndroidDirectories)" Condition="'@(_GLAndroidDirectories)' != ''" />
<RemoveDir Directories="@(_GLIosDirectories)" Condition="'@(_GLIosDirectories)' != ''" />
</Target>
<!-- IMPORTANT: You SHOULD NOT modify the logic here if you don't have to. -->
<!-- The list of common assemblies has been moved to the `CommonAssemblies.txt` and `CommonAssembliesNetFx.txt` files. -->
<!-- And you SHOULD modify these two files following Scripts/README.md file! -->
<Target Name="MoveCommonBinaries">
<PropertyGroup>
<_CommonAssembliesFilePath Condition="'$(TargetFrameworkIdentifier)' != '.NETFramework'">$(MSBuildThisFileDirectory)CommonAssemblies.txt</_CommonAssembliesFilePath>
<_CommonAssembliesFilePath Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">$(MSBuildThisFileDirectory)CommonAssembliesNetFx.txt</_CommonAssembliesFilePath>
</PropertyGroup>
<Message Importance="high" Text="Moving common binaries" />
<ReadLinesFromFile File="$(_CommonAssembliesFilePath)">
<Output TaskParameter="Lines" ItemName="_CommonFiles" />
</ReadLinesFromFile>
<Move SourceFiles="$(PublishDir)%(_CommonFiles.Identity)" DestinationFolder="$(PublishDir)..\" Condition="!Exists('$(PublishDir)..\%(_CommonFiles.Identity)')" />
<Delete Files="$(PublishDir)%(_CommonFiles.Identity)" Condition="Exists('$(PublishDir)..\%(_CommonFiles.Identity)')" />
</Target>
<!-- Note: the folder structure should be consistent with scripts\build.ps1 file -->
<Target Name="MoveClientExes" Condition="'$(TargetFrameworkIdentifier)' == '.NETFramework'">
<Message Importance="high" Text="Moving client executables" />
<Move SourceFiles="$(PublishDir)clientdx.exe" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientdx.exe')" />
<Move SourceFiles="$(PublishDir)clientdx.exe.config" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientdx.exe.config')" />
<Move SourceFiles="$(PublishDir)clientdx.pdb" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientdx.pdb')" />
<Move SourceFiles="$(PublishDir)clientogl.exe" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientogl.exe')" />
<Move SourceFiles="$(PublishDir)clientogl.exe.config" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientogl.exe.config')" />
<Move SourceFiles="$(PublishDir)clientogl.pdb" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientogl.pdb')" />
<Move SourceFiles="$(PublishDir)clientxna.exe" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientxna.exe')" />
<Move SourceFiles="$(PublishDir)clientxna.exe.config" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientxna.exe.config')" />
<Move SourceFiles="$(PublishDir)clientxna.pdb" DestinationFolder="$(PublishDir)../../" Condition="Exists('$(PublishDir)clientxna.pdb')" />
</Target>
<!-- Note: only the debug build should be started with the debugger, release builds will fail with a 'Could not find Resource directory' error -->
<Target Name="CopyResources" AfterTargets="Build" Condition="$(DefineConstants.Contains('DEBUG'))">
<ItemGroup>
<ExampleClientResources Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\DTA\**\*.*" />
<ExampleClientMaps Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\Maps\**\*.*" />
<ExampleClientIni Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\INI\**\*.*" />
<ExampleClientMix Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\MIX\**\*.*" />
<ExampleClientSettings Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\SUN.ini" />
<ExampleClientDefinitions Include="$(MSBuildThisFileDirectory)\DXMainClient\Resources\ClientDefinitions.ini" />
</ItemGroup>
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientResources)" DestinationFolder="$(OutputPath)\Resources\%(RecursiveDir)" />
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientMaps)" DestinationFolder="$(OutputPath)\Maps\%(RecursiveDir)" />
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientIni)" DestinationFolder="$(OutputPath)\INI\%(RecursiveDir)" />
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientMix)" DestinationFolder="$(OutputPath)\MIX\%(RecursiveDir)" />
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientSettings)" DestinationFolder="$(OutputPath)" />
<Copy Condition="! Exists('$(OutputPath)\Resources\ClientDefinitions.ini') " SourceFiles="@(ExampleClientDefinitions)" DestinationFolder="$(OutputPath)\Resources" />
</Target>
<Target Name="CopyUpdater" AfterTargets="Build" Condition="'$(PublishDir)' != '' AND '$(MSBuildProjectName)' == 'SecondStageUpdater'">
<PropertyGroup>
<CNCNetUpdaterCopyTo>$(PublishDir)\..\Updater\</CNCNetUpdaterCopyTo>
</PropertyGroup>
<ItemGroup>
<CNCNetUpdaterOutputFile Include="$(OutputPath)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(CNCNetUpdaterOutputFile)" DestinationFolder="$(CNCNetUpdaterCopyTo)" />
</Target>
<Target Name="MoveUpdater" Condition="'$(MSBuildProjectName)' == 'SecondStageUpdater'">
<Message Importance="high" Text="Moving updater executables" />
<Move SourceFiles="%(CNCNetUpdaterOutputFile.Identity)" DestinationFolder="$(CNCNetUpdaterCopyTo)" Condition="!Exists('$(CNCNetUpdaterCopyTo)%(CNCNetUpdaterOutputFile.Identity)')" />
<Delete Files="%(CNCNetUpdaterOutputFile.Identity)" Condition="Exists('$(CNCNetUpdaterCopyTo)%(CNCNetUpdaterOutputFile.Identity)')" />
</Target>
<!-- Allow a game specific build prop file to be imported, if available -->
<Import Project="$(MSBuildThisFileDirectory)Directory.targets" Condition="Exists('$(MSBuildThisFileDirectory)Directory.targets')" />
</Project>