-
Notifications
You must be signed in to change notification settings - Fork 3
/
Shabby.csproj
73 lines (66 loc) · 3.21 KB
/
Shabby.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
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<!-- Static Properties -->
<PropertyGroup>
<TargetFramework>net48</TargetFramework>
<LangVersion>7.3</LangVersion>
<IsPackable>false</IsPackable>
<PlatformTarget>x64</PlatformTarget>
<NoWarn>1701;1702;CS0649;CS1591</NoWarn>
<AssemblyCopyright>2024 KSPModdingLibs Contributors</AssemblyCopyright>
<AssemblyName>Shabby</AssemblyName>
<GenerateAssemblyVersionAttribute> False </GenerateAssemblyVersionAttribute>
<RepoRootPath>$(ProjectDir)../</RepoRootPath>
</PropertyGroup>
<!-- DLL Dependencies-->
<ItemGroup>
<Reference Include="0Harmony, Culture=neutral, PublicKeyToken=null">
<HintPath>$(KSPRoot)/GameData/000_Harmony/0Harmony.dll</HintPath>
<CKANIdentifier>Harmony2</CKANIdentifier>
</Reference>
</ItemGroup>
<!-- Target to get information about the git repo -->
<Target Name="GetVersionInfo" BeforeTargets="BeforeBuild">
<Exec Command="git describe --tags --abbrev=0" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="RepoLatestTag"/>
</Exec>
<Exec Command="git rev-list $(RepoLatestTag)..HEAD --count" ConsoleToMsBuild="true">
<Output TaskParameter="ConsoleOutput" PropertyName="RepoTagDistance"/>
</Exec>
<ItemGroup>
<VersionSegments Include="$(RepoLatestTag.Split('.'))"/>
</ItemGroup>
<!-- Infer the current version from this information -->
<PropertyGroup>
<VersionMajor>$(RepoLatestTag.Split('.')[0])</VersionMajor>
<VersionMinor>$(RepoLatestTag.Split('.')[1])</VersionMinor>
<VersionPatch>$(RepoLatestTag.Split('.')[2])</VersionPatch>
<VersionPatch Condition="$(RepoTagDistance) != '0'">$([MSBuild]::Add($(VersionPatch), 1))</VersionPatch>
<VersionBuild>$(RepoTagDistance)</VersionBuild>
<Version>$(VersionMajor).$(VersionMinor).$(VersionPatch)</Version>
</PropertyGroup>
<!-- Write this information to the AssemblyInfo.cs file -->
<!-- This cant go under <Project> because then it would become static and not reflect the information above -->
<ItemGroup>
<AssemblyAttribute Include="KSPAssembly">
<_Parameter1>$(AssemblyName)</_Parameter1>
<_Parameter2_IsLiteral>true</_Parameter2_IsLiteral>
<_Parameter2>$(VersionMajor)</_Parameter2>
<_Parameter3_IsLiteral>true</_Parameter3_IsLiteral>
<_Parameter3>$(VersionMinor)</_Parameter3>
<_Parameter4_IsLiteral>true</_Parameter4_IsLiteral>
<_Parameter4>$(VersionPatch)</_Parameter4>
</AssemblyAttribute>
<AssemblyAttribute Include="System.Reflection.AssemblyVersionAttribute">
<_Parameter1>$(Version)</_Parameter1>
</AssemblyAttribute>
</ItemGroup>
</Target>
<!-- Target to generate the .version file -->
<!-- Depends on the Jinja2-CLI python package -->
<Target Name="MakeVersionFile" AfterTargets="AfterBuild">
<Exec Command="jinja2 '$(ProjectDir)Shabby.version.template' -D 'Version=$(Version)' -D 'Build=$(RepoTagDistance)' -o '$(ProjectDir)../GameData/Shabby/Shabby.version' ''"/>
<Message Text="version is $(Version) in $(RepoVersionMajor)"/>
</Target>
<Import Project="$(ProjectDir)../KSPBuildTools/KSPCommon.targets" />
</Project>