forked from Niwatori401/RimRound
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShared.mod.props.csproj
301 lines (248 loc) · 9.6 KB
/
Shared.mod.props.csproj
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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<Project>
<!-- Define if undefined -->
<PropertyGroup Condition="'$(Configurations)' == ''">
<Configurations>1.3_DEBUG;1.3;1.4_DEBUG;1.4</Configurations>
</PropertyGroup>
<ItemGroup Condition="'@(ConfigurationsList)' == ''">
<ConfigurationsList Include="$(Configurations.Split(';'))" />
</ItemGroup>
<PropertyGroup Condition="$(RootNamespace) == ''">
<RootNamespace>$(MSBuildProjectName.Replace(" ", "."))</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(AllowLocalAssemblies)' == ''">
<AllowLocalAssemblies>true</AllowLocalAssemblies>
<!-- Allow usage of local assemblies -->
</PropertyGroup>
<PropertyGroup Condition="'$(BatchBuild)' == ''">
<BatchBuild>false</BatchBuild>
</PropertyGroup>
<!-- Setup environment -->
<PropertyGroup>
<OS64>$([System.Environment]::Is64BitOperatingSystem)</OS64>
</PropertyGroup>
<Choose>
<When Condition="'$([System.Environment]::OSVersion.Platform)' == 'Unix'">
<PropertyGroup>
<Linux>true</Linux>
</PropertyGroup>
</When>
<When Condition="'$([System.Environment]::OSVersion.Platform)' == 'MacOSX'">
<PropertyGroup>
<MacOS>true</MacOS>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<Linux>false</Linux>
<MacOS>false</MacOS>
</PropertyGroup>
</Otherwise>
</Choose>
<!-- Setup project properties -->
<PropertyGroup Condition="'$(TargetFramework)' == ''">
<TargetFramework>net48</TargetFramework>
</PropertyGroup>
<PropertyGroup Condition="'$(GenerateDocumentationFile)' == ''">
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(LangVersion)' == ''">
<LangVersion>preview</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Nullable)' == ''">
<Nullable>annotations</Nullable>
</PropertyGroup>
<PropertyGroup>
<OutputType>Library</OutputType>
<EnablePreviewFeatures>true</EnablePreviewFeatures>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<PackageOutputPath>$(ProjectDir)</PackageOutputPath>
<NoWarn>$(NoWarn);MSB3052;CS8618;CS8603</NoWarn>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<RunPreBuildEvent>Always</RunPreBuildEvent>
</PropertyGroup>
<!-- Setup versions properties -->
<PropertyGroup>
<v1_3>$(Configuration.StartsWith('1.3'))</v1_3>
<v1_4>$(Configuration.StartsWith('1.4'))</v1_4>
</PropertyGroup>
<!-- Configure for versions -->
<!-- !CHANGE TO YOUR LOCATIONS! -->
<Choose>
<When Condition="'$(RefGameDir)' == ''">
<PropertyGroup>
<RefGameDir>D:\Steam\steamapps\common\RimWorld 1.3\</RefGameDir>
</PropertyGroup>
<PropertyGroup Condition="$(v1_4)">
<RefGameDir>D:\Steam\steamapps\common\RimWorld\</RefGameDir>
</PropertyGroup>
</When>
</Choose>
<PropertyGroup Condition="$(v1_3)">
<DefineConstants>$(DefineConstants);v1_3</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(v1_4)">
<DefineConstants>$(DefineConstants);v1_4</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="$(Configuration.EndsWith('DEBUG'))">
<Debug>true</Debug>
<DebugType>full</DebugType>
<DefineConstants>$(DefineConstants);DEBUG</DefineConstants>
</PropertyGroup>
<!-- Configure for OS -->
<Choose>
<When Condition="'$(GameDataDir)' == ''">
<Choose>
<When Condition="$(Linux)">
<PropertyGroup>
<GameDataDir>$(RefGameDir)RimWorldLinux_Data\</GameDataDir>
</PropertyGroup>
</When>
<When Condition="$(MacOS)">
<PropertyGroup>
<GameDataDir>$(RefGameDir)Contents\Resources\Data\</GameDataDir>
</PropertyGroup>
</When>
<When Condition="$(OS64)">
<PropertyGroup>
<GameDataDir>$(RefGameDir)RimWorldWin64_Data\</GameDataDir>
</PropertyGroup>
</When>
<Otherwise>
<PropertyGroup>
<GameDataDir>$(RefGameDir)RimWorldWin_Data\</GameDataDir>
</PropertyGroup>
</Otherwise>
</Choose>
</When>
</Choose>
<!-- Setup mod properties -->
<!-- !CHANGE TO YOUR LOCATIONS! -->
<PropertyGroup Condition="'$(GameDir)' == ''">
<GameDir>D:\Steam\steamapps\common\RimWorld\</GameDir>
</PropertyGroup>
<PropertyGroup Condition="'$(ModName)' == ''">
<ModName>$(AssemblyName)</ModName>
</PropertyGroup>
<PropertyGroup Condition="'$(ModBuildDir)' == ''">
<ModBuildDir>$(ProjectDir)build\</ModBuildDir>
</PropertyGroup>
<PropertyGroup Condition="'$(AssetsDir)' == ''">
<AssetsDir>$(ProjectDir)Assets\</AssetsDir>
</PropertyGroup>
<PropertyGroup>
<ModOutputPath>$(ModBuildDir)$(ModName)\</ModOutputPath>
<!-- build\ModName\ -->
<GameVersion>$(Configuration.Replace('_DEBUG', ''))</GameVersion>
<!-- Mod version (1.3..1.4) -->
<ModOutputVersionPath>$(ModOutputPath)$(GameVersion)\</ModOutputVersionPath>
<!-- build\ModName\(1.3..1.4)\ -->
<ModAssembliesPath>$(GameVersion)\Assemblies\</ModAssembliesPath>
<!-- (1.3..1.4)\Assemblies\ -->
<ModOutputAssembliesPath>$(ModOutputPath)$(ModAssembliesPath)</ModOutputAssembliesPath>
<!-- build\ModName\(1.3..1.4)\Assemblies\ -->
</PropertyGroup>
<!-- Finalize game properties -->
<PropertyGroup>
<GameAssembliesDir>$(GameDataDir)Managed\</GameAssembliesDir>
<!-- Game\Data\Managed\ -->
<GameModsPath>$(GameDir)Mods\</GameModsPath>
<!-- Game\Mods\ -->
<GameModPath>$(GameModsPath)$(ModName)\</GameModPath>
<!-- Game\Mods\ModName\ -->
<GameModVersion>$(GameModPath)$(GameVersion)\</GameModVersion>
<!-- Game\Mods\ModName\(1.3..1.4)\ -->
<GameModAssembliesPath>$(GameModPath)$(ModAssembliesPath)</GameModAssembliesPath>
<!-- Game\Mods\ModName\(1.3..1.4)\Assemblies\ -->
</PropertyGroup>
<!-- Configure publicizer -->
<PropertyGroup Condition="'$(PublicizerClearCacheOnClean)' == ''">
<PublicizerClearCacheOnClean>true</PublicizerClearCacheOnClean>
</PropertyGroup>
<ItemGroup>
<Publicize Include="$(Publicize);Assembly-CSharp" />
</ItemGroup>
<!-- Add Krafs.Publicizer. Makes every member of choosen assemblies to be public, so you could use every member in your projects. -->
<ItemGroup>
<PackageReference Include="Krafs.Publicizer" Version="2.2.0" />
</ItemGroup>
<!-- Add PolySharp. Allows you to use almost every new CSharp feature in your projects. -->
<ItemGroup>
<PackageReference Include="PolySharp" Version="*" />
</ItemGroup>
<!-- Add net references -->
<ItemGroup Condition="$(TargetFramework.ToLower.StartsWith('net4'))">
<PackageReference Include="Microsoft.NETFramework.ReferenceAssemblies.$(TargetFramework)" Version="*" ExcludeAssets="runtime" />
</ItemGroup>
<!-- Add game assemblies as references -->
<Choose>
<When Condition="$(AllowLocalAssemblies) and Exists('$(GameAssembliesDir)')">
<ItemGroup>
<Reference Include="$(GameAssembliesDir)*.dll" Private="false" />
</ItemGroup>
</When>
<Otherwise>
<ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref" Version="1.3.*-*" ExcludeAssets="runtime" />
</ItemGroup>
<ItemGroup Condition="$(v1_4)">
<PackageReference Update="Krafs.Rimworld.Ref" Version="1.4.*-*" />
</ItemGroup>
</Otherwise>
</Choose>
<!-- Check for updated Assets -->
<ItemGroup>
<UpToDateCheckInput Include="$(AssetsDir)**"/>
</ItemGroup>
<!-- Hide build directory -->
<ItemGroup>
<Compile Remove="$(ModBuildDir)**" />
<EmbeddedResource Remove="$(ModBuildDir)**" />
<None Remove="$(ModBuildDir)**" />
</ItemGroup>
<!-- Cleaning -->
<Target Name="cleanup" AfterTargets="BeforeClean">
<Exec Command="rmdir /S /Q "$(BaseIntermediateOutputPath)"" />
<Exec Command="rmdir /S /Q "$(BaseOutputPath)"" />
<Exec Command="rmdir /S /Q "$(ModBuildDir)"" />
<Exec Command="rmdir /S /Q "$(GameModPath)"" />
</Target>
<!-- https://stackoverflow.com/a/5514808 - Batch Build/Restore -->
<Target Name="BatchBuild">
<Exec Command="dotnet build "$(ProjectPath)" -c %(ConfigurationsList.Identity) -p:BatchBuild=true -restore -v n" />
</Target>
<!-- Pre build, message about it -->
<Target Name="prebuild" AfterTargets="PreBuildEvent">
<Message Text="Building $(ModName) with configuration $(Configuration) >" Importance="high" />
</Target>
<!-- Post build, copy all new files and try copy build -->
<Target Condition="!$(BatchBuild)" Name="postbuild" AfterTargets="PostBuildEvent">
<Exec Command="rmdir /S /Q "$(ModOutputAssembliesPath)"" />
<Exec Command="xcopy /Y /R /S /D /I "$(AssetsDir)" "$(ModOutputPath)"" />
<Exec Command="xcopy /Y /R /S /D /I "$(OutputPath)" "$(ModOutputAssembliesPath)"" />
<CallTarget Targets="CopyBuild" Condition="Exists('$(GameModsPath)')"/>
<Message Importance="high" Text="Unable to copy build to the game mods, please change path to the game(<GameDir>$(GameDir)</GameDir>)." Condition="!Exists('$(GameModsPath)')"/>
</Target>
<Target Name="CopyBuild">
<MakeDir Directories="$(ModOutputPath)" />
<Exec Command="rmdir /S /Q "$(GameModAssembliesPath)"" />
<Exec Command="xcopy /Y /R /S /D /I "$(ModOutputAssembliesPath)" "$(GameModAssembliesPath)"" />
<Exec Command="xcopy /Y /R /S /D /I "$(ModOutputPath)" "$(GameModPath)"" />
</Target>
<!-- Global usings -->
<ItemGroup>
<Using Include="System" />
<Using Include="System.Reflection" />
<Using Include="System.Collections" />
<Using Include="System.Collections.Generic" />
<Using Include="System.Linq" />
<Using Include="System.Runtime.CompilerServices" />
<Using Include="UnityEngine" />
<Using Include="RimWorld" />
<Using Include="Verse" />
<Using Include="Verse.AI" />
<Using Static="true"
Include="Verse.TranslatorFormattedStringExtensions"/>
<Using Alias="RimRandom" Include="Verse.Rand" />
</ItemGroup>
</Project>