Skip to content

Commit b2bb3f2

Browse files
authored
Merge branch 'master' into SpawnLocker
2 parents ff09d68 + 4bafb25 commit b2bb3f2

File tree

217 files changed

+1541
-5205
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

217 files changed

+1541
-5205
lines changed

Directory.Build.props

Lines changed: 86 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,91 @@
11
<Project>
2-
<PropertyGroup>
3-
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
4-
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
5-
<Deterministic>true</Deterministic>
6-
<DebugType>embedded</DebugType>
7-
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
8-
<GameType>$([System.Text.RegularExpressions.Regex]::Match($(MSBuildProjectName), '^[^\.]*'))</GameType>
9-
<!--<OutputPath>$(SolutionDir)\bin\$(Configuration)\$(GameType)</OutputPath>-->
10-
<OutputPath>$(SolutionDir)\bin</OutputPath>
11-
</PropertyGroup>
12-
<Target Name="SkipAllRefs" AfterTargets="ResolveReferences">
13-
<ItemGroup>
14-
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" />
15-
</ItemGroup>
16-
</Target>
17-
<PropertyGroup>
18-
<PostBuildEvent Condition="$([MSBuild]::IsOSPlatform('Windows'))">
2+
<PropertyGroup>
3+
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
4+
5+
<RootNamespace>KK_Plugins</RootNamespace>
6+
7+
<OutputPath>..\..\bin\build\$(MSBuildProjectName)\</OutputPath>
8+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
9+
10+
<OutputType>Library</OutputType>
11+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
12+
13+
<Deterministic>true</Deterministic>
14+
<DebugSymbols>true</DebugSymbols>
15+
<DebugType>embedded</DebugType>
16+
<FileAlignment>512</FileAlignment>
17+
</PropertyGroup>
18+
19+
<ItemGroup Condition="'$(Configuration)' == 'Debug'" >
20+
<PackageReference Include="BepInEx.Analyzers" Version="1.*" />
21+
<PackageReference Include="Microsoft.Unity.Analyzers" Version="1.*" />
22+
</ItemGroup>
23+
24+
<PropertyGroup Condition="'$(MSBuildProjectName.IndexOf(.))' != '-1'">
25+
<!--Add constants based on the project name e.g. KK-KKS.Fix_DynamicBones -> KK;KKS;Fix;DynamicBones-->
26+
<DefineConstants>$(MSBuildProjectName.Replace('.',';').Replace('-',';').Replace('_',';'))</DefineConstants>
27+
</PropertyGroup>
28+
29+
<!--Delete unnecessary .deps.json file in build output since it's not used in plugins-->
30+
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
31+
<Delete Files="$(OutputPath)\$(MSBuildProjectName).deps.json" />
32+
</Target>
33+
34+
<!--Do not copy any dlls other than the assembly itself to the build output-->
35+
<Target Name="SkipAllRefs" AfterTargets="ResolveReferences">
36+
<ItemGroup>
37+
<ReferenceCopyLocalPaths Remove="@(ReferenceCopyLocalPaths)" />
38+
</ItemGroup>
39+
</Target>
40+
41+
42+
<PropertyGroup>
43+
<PostBuildEvent Condition="$([MSBuild]::IsOSPlatform('Windows'))">
1944
IF EXIST "$(TargetDir)$(TargetName).pdb" IF EXIST "$(SolutionDir)pdb2mdb.exe" CALL "$(SolutionDir)pdb2mdb.exe" "$(TargetPath)"
2045
IF EXIST "$(SolutionDir)PostBuild.bat" CALL "$(SolutionDir)PostBuild.bat" "$(TargetPath)" $(GameType)
2146
</PostBuildEvent>
22-
</PropertyGroup>
47+
</PropertyGroup>
48+
49+
50+
<!-- Inline task to get file version from assembly -->
51+
<UsingTask TaskName="GetFileVersion" TaskFactory="RoslynCodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll">
52+
<ParameterGroup>
53+
<AssemblyPath ParameterType="System.String" Required="true" />
54+
<FileVersion Output="true" ParameterType="System.String" />
55+
</ParameterGroup>
56+
<Task>
57+
<Code Type="Fragment" Language="cs">
58+
FileVersion = System.Diagnostics.FileVersionInfo.GetVersionInfo(AssemblyPath).FileVersion;
59+
</Code>
60+
</Task>
61+
</UsingTask>
62+
63+
<!-- Create a release zip file (after successful Release build) -->
64+
<Target Name="CreateReleaseZip" AfterTargets="Build" Condition="'$(Configuration)' == 'Release'">
65+
<GetFileVersion AssemblyPath="$(OutputPath)$(AssemblyName).dll">
66+
<Output TaskParameter="FileVersion" PropertyName="FileVersionFromAssembly" />
67+
</GetFileVersion>
68+
69+
<PropertyGroup>
70+
<CopyDir>$(OutputPath)\..\TEMP_COPY_$(AssemblyName)</CopyDir>
71+
<GameType>$([System.Text.RegularExpressions.Regex]::Match($(MSBuildProjectName), '^[^\.]*'))</GameType>
72+
<ZipDir>$(OutputPath)\..\..\out</ZipDir>
73+
<ZipPath>$(ZipDir)\$(AssemblyName)_v$(FileVersionFromAssembly).zip</ZipPath>
74+
</PropertyGroup>
75+
76+
<ItemGroup>
77+
<BuildFiles Include="$(OutputPath)\*"/>
78+
</ItemGroup>
79+
80+
<RemoveDir Directories="$(CopyDir)" />
81+
<Copy DestinationFolder="$(CopyDir)\BepInEx\plugins\$(GameType)_Plugins\" SourceFiles="@(BuildFiles)" />
82+
83+
<Message Importance="high" Text="Writing release zip to: $(ZipPath)" />
84+
85+
<MakeDir Directories="$(ZipDir)" />
86+
87+
<!-- https://learn.microsoft.com/en-us/visualstudio/msbuild/zipdirectory-task?view=vs-2022 -->
88+
<ZipDirectory SourceDirectory="$(CopyDir)" DestinationFile="$(ZipPath)" Overwrite="true" />
89+
<RemoveDir Directories="$(CopyDir)" />
90+
</Target>
2391
</Project>

0 commit comments

Comments
 (0)