-
Notifications
You must be signed in to change notification settings - Fork 36
/
BeatSaberHTTPStatusPlugin.csproj
208 lines (208 loc) · 10.3 KB
/
BeatSaberHTTPStatusPlugin.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
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<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>{1C0571AC-F8D6-4F9E-93B2-2F23892AE61E}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>BeatSaberHTTPStatus</RootNamespace>
<AssemblyName>BeatSaberHTTPStatus</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<Version>1.19.0</Version>
<BeatSaberVersion>1.18.0</BeatSaberVersion>
<GameDirPath>..\libs\beatsaber\</GameDirPath>
<SemVerVersion>$(Version)</SemVerVersion>
<CopyToPlugins Condition=" '$(CopyToPlugins)' == '' ">true</CopyToPlugins>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<SemVerVersion>$(Version)-dev</SemVerVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<OutputZip Condition=" '$(OutputZip)' == '' ">true</OutputZip>
</PropertyGroup>
<ItemGroup>
<Reference Include="HMLib">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\HMLib.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="IPA.Loader">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\IPA.Loader.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Main">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\Main.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BeatmapCore">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\BeatmapCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="GameplayCore">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\GameplayCore.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BGNet">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\BGNet.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Colors">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\Colors.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
<Reference Include="UnityEngine, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.CoreModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.AudioModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.AudioModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="UnityEngine.ImageConversionModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null">
<HintPath>$(GameDirPath)Beat Saber_Data\Managed\UnityEngine.ImageConversionModule.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="Zenject">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\Zenject.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="BS_Utils, Culture=neutral">
<HintPath>$(GameDirPath)Plugins\BS_Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="websocket-sharp, Culture=neutral">
<HintPath>$(GameDirPath)Libs\websocket-sharp.dll</HintPath>
<Private>False</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="**\*.cs" Exclude="bin\**\*;obj\**\*" />
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="$(IntermediateOutputPath)src/manifest.json">
<LogicalName>$(RootNamespace).manifest.json</LogicalName>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- Clean output directories before build -->
<Target Name="CleanOutputDirs" BeforeTargets="BeforeBuild">
<RemoveDir Directories="$(OutDir)" />
<RemoveDir Directories="$(IntermediateOutputPath)" />
</Target>
<!-- Replace strings in source files -->
<Target Name="BeforeBuild">
<PropertyGroup>
<IntermediateSourcePath>$(IntermediateOutputPath)src\</IntermediateSourcePath>
</PropertyGroup>
<ItemGroup>
<ToCompile Include="@(Compile)" />
<Compile Remove="@(Compile)" />
</ItemGroup>
<Copy SourceFiles="@(ToCompile)" DestinationFiles="@(ToCompile->'$(IntermediateSourcePath)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true">
<Output TaskParameter="CopiedFiles" ItemName="Compile" />
</Copy>
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Plugin.cs" OutputFilename="$(IntermediateSourcePath)Plugin.cs" MatchExpression="$SEMVER_VERSION$" ReplacementText="$(SemVerVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Plugin.cs" OutputFilename="$(IntermediateSourcePath)Plugin.cs" MatchExpression="$BS_VERSION$" ReplacementText="$(BeatSaberVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)Properties\AssemblyInfo.cs" OutputFilename="$(IntermediateSourcePath)Properties\AssemblyInfo.cs" MatchExpression="$VERSION$" ReplacementText="$(Version)" />
<Copy SourceFiles="manifest.json" DestinationFiles="$(IntermediateSourcePath)manifest.json" SkipUnchangedFiles="true" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)manifest.json" OutputFilename="$(IntermediateSourcePath)manifest.json" MatchExpression="$SEMVER_VERSION$" ReplacementText="$(SemVerVersion)" />
<ReplaceFileText InputFilename="$(IntermediateSourcePath)manifest.json" OutputFilename="$(IntermediateSourcePath)manifest.json" MatchExpression="$BS_VERSION$" ReplacementText="$(BeatSaberVersion)" />
</Target>
<!-- Copy the plugin to the Beat Saber installation -->
<Target Name="CopyToPlugins" AfterTargets="AfterBuild" Condition=" '$(CopyToPlugins)' != '' And $(CopyToPlugins) ">
<Message Text="Copying $(OutDir)BeatSaberHTTPStatus.dll to Plugins folder" Importance="high"/>
<Copy SourceFiles="$(OutDir)BeatSaberHTTPStatus.dll" DestinationFiles="$(GameDirPath)Plugins\BeatSaberHTTPStatus.dll"/>
</Target>
<!-- Package built DLLs into a zip -->
<Target Name="CreateZip" AfterTargets="AfterBuild" Condition=" '$(OutputZip)' != '' And $(OutputZip) ">
<ItemGroup>
<ZipFilesPlugins Include="$(OutDir)\BeatSaberHTTPStatus.dll" />
</ItemGroup>
<Exec Command="git rev-parse HEAD > $(IntermediateOutputPath)head" />
<ReadLinesFromFile File="$(IntermediateOutputPath)head">
<Output TaskParameter="Lines" PropertyName="FullCommitHash" />
</ReadLinesFromFile>
<Delete Files="$(IntermediateOutputPath)head" />
<PropertyGroup>
<CommitHash>$(FullCommitHash.Substring(0, 8))</CommitHash>
</PropertyGroup>
<Copy SourceFiles="@(ZipFilesPlugins)" DestinationFolder="$(IntermediateOutputPath)\zip\Plugins" />
<ZipDir ZipFileName="$(OutDir)\BeatSaberHTTPStatus-$(SemVerVersion)-bs$(BeatSaberVersion)-$(CommitHash).zip" DirectoryName="$(IntermediateOutputPath)\zip" />
</Target>
<!-- Source: https://stackoverflow.com/a/38127938 -->
<UsingTask TaskName="ZipDir" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<ZipFileName ParameterType="System.String" Required="true" />
<DirectoryName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.IO.Compression.FileSystem" />
<Using Namespace="System.IO.Compression" />
<Code Type="Fragment" Language="cs"><![CDATA[
try
{
Log.LogMessage(string.Format("Zipping Directory {0} to {1}", DirectoryName, ZipFileName));
ZipFile.CreateFromDirectory( DirectoryName, ZipFileName );
return true;
}
catch(Exception ex)
{
Log.LogErrorFromException(ex);
return false;
}
]]></Code>
</Task>
</UsingTask>
<!-- Source: https://stackoverflow.com/a/22571621 -->
<UsingTask TaskName="ReplaceFileText" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll">
<ParameterGroup>
<InputFilename ParameterType="System.String" Required="true" />
<OutputFilename ParameterType="System.String" Required="true" />
<MatchExpression ParameterType="System.String" Required="true" />
<ReplacementText ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System.Core" />
<Using Namespace="System" />
<Using Namespace="System.IO" />
<Using Namespace="System.Text.RegularExpressions" />
<Code Type="Fragment" Language="cs">
<![CDATA[
Log.LogMessage(string.Format("Replacing {0} in {1} to {2}", MatchExpression, InputFilename, ReplacementText));
File.WriteAllText(
OutputFilename,
File.ReadAllText(InputFilename).Replace(MatchExpression, ReplacementText)
);
]]>
</Code>
</Task>
</UsingTask>
</Project>