-
Notifications
You must be signed in to change notification settings - Fork 0
/
Common.targets
74 lines (63 loc) · 3.26 KB
/
Common.targets
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
<Project>
<PropertyGroup>
<UseMinVer>true</UseMinVer>
<UnityVersion>2021.3.28</UnityVersion>
</PropertyGroup>
<PropertyGroup>
<Product>$(MSBuildProjectName)</Product>
<!-- Set NuGet Sources -->
<RestoreAdditionalProjectSources>
https://api.nuget.org/v3/index.json;
https://nuget.bepinex.dev/v3/index.json
</RestoreAdditionalProjectSources>
<!-- Set MinVer Tag & Prerelease Properties -->
<MinVerDefaultPreReleaseIdentifiers>dev</MinVerDefaultPreReleaseIdentifiers>
<MinVerTagPrefix>v</MinVerTagPrefix>
<!-- Embed Debug Symbols for Easier Debugging -->
<DebugSymbols>true</DebugSymbols>
<DebugType>embedded</DebugType>
<PathMap>$([System.IO.Path]::GetFullPath('$(MSBuildProjectDirectory)'))=./</PathMap>
</PropertyGroup>
<ItemGroup>
<PackageReference Condition="'$(UseMinVer)' == 'true'" Include="MinVer" Version="5.0.0" PrivateAssets="all"/>
<PackageReference Include="BepInEx.Core" Version="5.*" PrivateAssets="all"/>
<PackageReference Include="BepInEx.AutoPlugin" Version="1.1.0" PrivateAssets="all"/>
<PackageReference Include="BepInEx.Analyzers" Version="1.*" PrivateAssets="all"/>
<PackageReference Include="BepInEx.PluginInfoProps" Version="2.0.0" PrivateAssets="all"/>
<PackageReference Include="BepInEx.AssemblyPublicizer.MSBuild" Version="0.4.2" PrivateAssets="all"/>
<PackageReference Include="UnityEngine.Modules" Version="$(UnityVersion)" PrivateAssets="all" IncludeAssets="compile"/>
</ItemGroup>
<Target Name="SetAssemblyVersion" AfterTargets="MinVer" >
<PropertyGroup>
<AssemblyVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch).0</AssemblyVersion>
</PropertyGroup>
</Target>
<!-- Set Mod Version with MinVer -->
<Target Name="SetModVersion" BeforeTargets="AddGeneratedFile" DependsOnTargets="MinVer">
<PropertyGroup>
<PlainVersion>$(MinVerMajor).$(MinVerMinor).$(MinVerPatch)</PlainVersion>
<BepInExPluginVersion>$(PlainVersion)</BepInExPluginVersion>
</PropertyGroup>
</Target>
<!-- Pack for Thunderstore -->
<Target
Name="ThunderstorePack"
AfterTargets="PostBuildEvent"
Condition="$(Configuration) == 'Release' and '$(CI)' == 'true'"
DependsOnTargets="SetModVersion"
>
<Exec Command="dotnet tcli build --config-path $(MSBuildProjectDirectory)\..\ts-assets\thunderstore.toml --package-version $(PlainVersion)" />
<ItemGroup>
<FilesToRename Include="$(MSBuildProjectDirectory)\..\*-$(PlainVersion).zip" />
</ItemGroup>
<Move SourceFiles="@(FilesToRename)" DestinationFiles="@(FilesToRename -> Replace($(PlainVersion), $(MinVerVersion)))" />
</Target>
<!-- Publish to Thunderstore -->
<Target
Name="ThunderstorePublish"
AfterTargets="PostBuildEvent;ThunderstorePack"
Condition="$(Configuration) == 'Release' and '$(CI)' == 'true' and $(IS_RELEASE) == 'true'"
>
<Exec Command="dotnet tcli publish --config-path $(MSBuildProjectDirectory)\..\ts-assets\thunderstore.toml --file $(MSBuildProjectDirectory)\..\*.zip" />
</Target>
</Project>