-
Notifications
You must be signed in to change notification settings - Fork 36
/
BeatSaberHTTPStatusPlugin.csproj
181 lines (181 loc) · 9.17 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
<?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.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<Version>1.9.1</Version>
<BeatSaberVersion>1.6.0</BeatSaberVersion>
<GameDirPath>..\libs\beatsaber\</GameDirPath>
<SemVerVersion>$(Version)</SemVerVersion>
</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>
</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="MainAssembly">
<HintPath>$(GameDirPath)\Beat Saber_Data\Managed\MainAssembly.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="BS_Utils, Culture=neutral">
<HintPath>$(GameDirPath)Plugins\BS_Utils.dll</HintPath>
<Private>False</Private>
</Reference>
<ProjectReference Include="..\libs\websocket-sharp\websocket-sharp\websocket-sharp.csproj">
<Project>{B357BAC7-529E-4D81-A0D2-71041B19C8DE}</Project>
<Name>websocket-sharp</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ToCompile 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>
<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"></Copy>
<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>
<!-- Package built DLLs into a zip -->
<Target Name="CreateZip" AfterTargets="AfterBuild" Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<ItemGroup>
<ZipFilesPlugins Include="$(OutDir)\BeatSaberHTTPStatus.dll" />
</ItemGroup>
<ItemGroup>
<ZipFilesLibs Include="$(OutDir)\websocket-sharp.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" />
<Copy SourceFiles="@(ZipFilesLibs)" DestinationFolder="$(IntermediateOutputPath)\zip\Beat Saber_Data\Managed" />
<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>