-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathFlyByWireSASMode.csproj
More file actions
285 lines (279 loc) · 14.1 KB
/
FlyByWireSASMode.csproj
File metadata and controls
285 lines (279 loc) · 14.1 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
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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.props" Condition="Exists('packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.props')" />
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{FCE5C5F0-F2E3-41BA-A33F-0A9888E486F8}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>FlyByWireSASMode</RootNamespace>
<AssemblyName>FlyByWireSASMode</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<PlatformTarget>x64</PlatformTarget>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugSymbols>false</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<!--Import targets now, which will import KSPCommunityFixes.csproj.user where the path to the KSP install root must be defined in ReferencePath-->
<!--This must be done after the main project poperties are defined because it needs the target framework property to be defined -->
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!--Parse KSP platform-specific paths and set the start action-->
<PropertyGroup>
<KSPExecutable Condition="$([MSBuild]::IsOsPlatform('Windows'))">KSP_x64.exe</KSPExecutable>
<KSPExecutable Condition="$([MSBuild]::IsOsPlatform('OSX'))">KSP.app</KSPExecutable>
<KSPExecutable Condition="$([MSBuild]::IsOsPlatform('Linux'))">KSP.x86_64</KSPExecutable>
<ManagedRelativePath Condition="$([MSBuild]::IsOsPlatform('Windows'))">KSP_x64_Data\Managed</ManagedRelativePath>
<ManagedRelativePath Condition="$([MSBuild]::IsOsPlatform('OSX'))">KSP.app\Contents\Resources\Data\Managed</ManagedRelativePath>
<ManagedRelativePath Condition="$([MSBuild]::IsOsPlatform('Linux'))">KSP_Data\Managed</ManagedRelativePath>
<ManagedPath>$(ReferencePath)\$(ManagedRelativePath)</ManagedPath>
<StartAction>Program</StartAction>
<StartProgram>$(ReferencePath)\$(KSPExecutable)</StartProgram>
<StartWorkingDirectory>$(ReferencePath)</StartWorkingDirectory>
</PropertyGroup>
<!--Publicizer-->
<ItemGroup>
<Publicize Include="Assembly-CSharp:Vessel.autopilot" />
<Publicize Include="Assembly-CSharp:VesselAutopilot.mode" />
</ItemGroup>
<!--Import references-->
<ItemGroup>
<Reference Include="$(ManagedPath)\System.dll">
<Name>System (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\mscorlib.dll">
<Name>System.Core (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\System.Xml.dll">
<Name>System.Xml (KSP/Mono)</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\UnityEngine*.dll">
<Name>UnityEngine</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\Assembly-CSharp.dll">
<Name>Assembly-CSharp</Name>
<Private>False</Private>
</Reference>
<Reference Include="$(ManagedPath)\Assembly-CSharp-firstpass.dll">
<Name>Assembly-CSharp-firstpass</Name>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="FlyByWireSASMode.cs" />
<Compile Include="Lib.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="VesselState.cs" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<!--Project-specfic configuration-->
<PropertyGroup>
<RepoRootPath>$(ProjectDir)</RepoRootPath>
<GameDataFolderName>FlyByWireSASMode</GameDataFolderName>
<UsePluginsFolder>false</UsePluginsFolder>
<CopyReleaseBinariesToRepo>false</CopyReleaseBinariesToRepo>
<AVCFilename>FlyByWireSASMode.version</AVCFilename>
</PropertyGroup>
<!--MSBuild targets-->
<Target Name="BeforeBuild" Condition="'$(Configuration)' == 'Release'">
<GetAVCVersion Path="$(RepoRootPath)\GameData\$(GameDataFolderName)\$(AVCFilename)">
<Output PropertyName="AVCFullVersion" TaskParameter="FullVersion" />
</GetAVCVersion>
<UpdateAssemblyVersion Path="$(MSBuildProjectDirectory)\Properties\AssemblyInfo.cs" Version="$(AVCFullVersion)" />
</Target>
<Target Name="AfterBuild">
<Error Condition="'$(ReferencePath)' == '' OR !Exists('$(ReferencePath)')" Text="ReferencePath=$(ReferencePath) os empty or isn't a valid path" />
<CallTarget Targets="CopyToKSP" />
<CallTarget Targets="CopyBinariesToRepo" Condition="'$(Configuration)' == 'Release' AND '$(CopyReleaseBinariesToRepo)' == 'true'" />
<CallTarget Targets="MakeReleaseZip" Condition="'$(Configuration)' == 'Release'" />
</Target>
<!--Custom targets-->
<Target Name="CopyToKSP">
<RemoveDir Condition="Exists('$(ReferencePath)\GameData\$(GameDataFolderName)')" Directories="$(ReferencePath)\GameData\$(GameDataFolderName)" />
<ItemGroup>
<GameDataFiles Include="$(RepoRootPath)\GameData\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(GameDataFiles)" DestinationFolder="$(ReferencePath)\GameData\%(RecursiveDir)" />
<PropertyGroup>
<BinariesKSPGameDataPath Condition="'$(UsePluginsFolder)' == 'true'">$(ReferencePath)\GameData\$(GameDataFolderName)\Plugins</BinariesKSPGameDataPath>
<BinariesKSPGameDataPath Condition="'$(UsePluginsFolder)' == 'false'">$(ReferencePath)\GameData\$(GameDataFolderName)</BinariesKSPGameDataPath>
</PropertyGroup>
<ItemGroup>
<BinariesToCopy Include="$(TargetDir)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BinariesToCopy)" DestinationFolder="$(BinariesKSPGameDataPath)" />
</Target>
<Target Name="CopyBinariesToRepo">
<PropertyGroup>
<BinariesRepoRootPath Condition="'$(UsePluginsFolder)' == 'true'">$(RepoRootPath)\GameData\$(GameDataFolderName)\Plugins</BinariesRepoRootPath>
<BinariesRepoRootPath Condition="'$(UsePluginsFolder)' == 'false'">$(RepoRootPath)\GameData\$(GameDataFolderName)</BinariesRepoRootPath>
</PropertyGroup>
<ItemGroup>
<BinariesToCopy Include="$(TargetDir)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BinariesToCopy)" DestinationFolder="$(BinariesRepoRootPath)" />
</Target>
<Target Name="MakeReleaseZip">
<PropertyGroup>
<PublishFolder>$(RepoRootPath)\Releases</PublishFolder>
<PublishTempFolderPath>$(PublishFolder)\Temp</PublishTempFolderPath>
<PublishPluginRootPath>$(PublishTempFolderPath)\GameData\$(GameDataFolderName)</PublishPluginRootPath>
<PublishBinariesPath Condition="'$(UsePluginsFolder)' == 'true'">$(PublishPluginRootPath)\Plugins</PublishBinariesPath>
<PublishBinariesPath Condition="'$(UsePluginsFolder)' == 'false'">$(PublishPluginRootPath)</PublishBinariesPath>
</PropertyGroup>
<RemoveDir Condition="'$(PublishTempFolderPath)' != '' AND Exists('$(PublishTempFolderPath)')" Directories="$(PublishTempFolderPath)" />
<ItemGroup>
<GameDataFiles Include="$(RepoRootPath)\GameData\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(GameDataFiles)" DestinationFolder="$(PublishTempFolderPath)\GameData\%(RecursiveDir)" />
<ItemGroup>
<BinariesToCopy Include="$(TargetDir)\*.*" />
</ItemGroup>
<Copy SourceFiles="@(BinariesToCopy)" DestinationFolder="$(PublishBinariesPath)" />
<Copy SourceFiles="$(RepoRootPath)\README.md" DestinationFolder="$(PublishPluginRootPath)" />
<GetAVCVersion Path="$(RepoRootPath)\GameData\$(GameDataFolderName)\$(AVCFilename)">
<Output PropertyName="AVCVersionMajor" TaskParameter="Major" />
<Output PropertyName="AVCVersionMinor" TaskParameter="Minor" />
<Output PropertyName="AVCVersionPatch" TaskParameter="Patch" />
</GetAVCVersion>
<ZipDirectory SourceDirectory="$(PublishTempFolderPath)" DestinationFile="$(PublishFolder)\$(AssemblyName)_$(AVCVersionMajor).$(AVCVersionMinor).$(AVCVersionPatch).zip" Overwrite="true" />
</Target>
<UsingTask TaskName="GetAVCVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Path ParameterType="System.String" Required="true" />
<Major ParameterType="System.String" Output="true" />
<Minor ParameterType="System.String" Output="true" />
<Patch ParameterType="System.String" Output="true" />
<Build ParameterType="System.String" Output="true" />
<FullVersion ParameterType="System.String" Output="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Code Type="Fragment" Language="cs"><![CDATA[
string content = File.ReadAllText(Path);
content = content.Replace(" ", "").Replace("\r", "").Replace("\n", "").Replace("\t", "");
string startString = "\"VERSION\"";
int start = content.IndexOf(startString, StringComparison.OrdinalIgnoreCase) + startString.Length;
start = content.IndexOf('{', start) + 1;
int end = content.IndexOf('}', start);
content = content.Substring(start, end - start);
string itemName = "\"MAJOR\":";
int current = content.IndexOf(itemName, StringComparison.OrdinalIgnoreCase);
if (current >= 0)
{
current += itemName.Length;
while (current < content.Length && char.IsNumber(content[current]))
{
Major += content[current];
current++;
}
}
else
{
Major = "0";
}
itemName = "\"MINOR\":";
current = content.IndexOf(itemName, StringComparison.OrdinalIgnoreCase);
if (current >= 0)
{
current += itemName.Length;
while (current < content.Length && char.IsNumber(content[current]))
{
Minor += content[current];
current++;
}
}
else
{
Minor = "0";
}
itemName = "\"PATCH\":";
current = content.IndexOf(itemName, StringComparison.OrdinalIgnoreCase);
if (current >= 0)
{
current += itemName.Length;
while (current < content.Length && char.IsNumber(content[current]))
{
Patch += content[current];
current++;
}
}
else
{
Patch = "0";
}
itemName = "\"BUILD\":";
current = content.IndexOf(itemName, StringComparison.OrdinalIgnoreCase);
if (current >= 0)
{
current += itemName.Length;
while (current < content.Length && char.IsNumber(content[current]))
{
Build += content[current];
current++;
}
}
else
{
Build = "0";
}
FullVersion = Major + "." + Minor + "." + Patch + "." + Build;
]]></Code>
</Task>
</UsingTask>
<UsingTask TaskName="UpdateAssemblyVersion" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<Path ParameterType="System.String" Required="true" />
<Version ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs"><![CDATA[
string content = File.ReadAllText(Path);
string newContent = Regex.Replace(content, "AssemblyFileVersion\\(\\\"(.*)\\\"\\)", "AssemblyFileVersion(\"" + Version + "\")");
string v2 = Version.Replace(".", ", ");
v2 = ", " + v2.Remove(v2.LastIndexOf(','));
newContent = Regex.Replace(newContent, "KSPAssembly\\(\\\"KSPProfiler\\\"(.*)\\)", "KSPAssembly(\"KSPProfiler\"" + v2 + ")");
if (content != newContent)
File.WriteAllText(Path, newContent);
]]></Code>
</Task>
</UsingTask>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.props')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.props'))" />
<Error Condition="!Exists('packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.targets')" Text="$([System.String]::Format('$(ErrorText)', 'packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.targets'))" />
</Target>
<Import Project="packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.targets" Condition="Exists('packages\Krafs.Publicizer.2.2.1\build\Krafs.Publicizer.targets')" />
</Project>