Files
FCP-Mod-Updater/FCPModUpdater.csproj
T
2026-03-31 08:44:47 +08:00

71 lines
3.1 KiB
XML

<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<GenerateRuntimeConfigurationFiles>true</GenerateRuntimeConfigurationFiles>
<RestorePackagesWithLockFile>true</RestorePackagesWithLockFile>
<IncludeSourceRevisionInInformationalVersion>false</IncludeSourceRevisionInInformationalVersion>
</PropertyGroup>
<ItemGroup>
<InternalsVisibleTo Include="FCPModUpdater.Tests" />
</ItemGroup>
<ItemGroup>
<Compile Remove="FCPModUpdater.Tests/**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="CliWrap" Version="3.10.1" />
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" />
<PackageReference Include="Spectre.Console" Version="0.54.0" />
<PackageReference Include="Spectre.Console.Cli" Version="0.53.1" />
</ItemGroup>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<DebugType>embedded</DebugType>
<DebugSymbols>true</DebugSymbols>
</PropertyGroup>
<!-- Derive version from git tags at build time -->
<Target Name="SetVersionFromGit" BeforeTargets="GetAssemblyVersion;GetAssemblyAttributes;GenerateNuGetPackage">
<Exec Command="git describe --tags --long --always"
ConsoleToMSBuild="true"
StandardOutputImportance="low"
IgnoreExitCode="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitDescribe" />
<Output TaskParameter="ExitCode" PropertyName="GitDescribeExitCode" />
</Exec>
<!-- Parse "v0.1.1-4-g2d7e0c6" into components -->
<PropertyGroup Condition="'$(GitDescribeExitCode)' == '0' and '$(GitDescribe)' != ''">
<GitDescribeClean>$([System.Text.RegularExpressions.Regex]::Replace('$(GitDescribe)', '^v', ''))</GitDescribeClean>
<VersionPrefix>$([System.Text.RegularExpressions.Regex]::Match('$(GitDescribeClean)', '^\d+\.\d+\.\d+').Value)</VersionPrefix>
<GitCommitsSinceTag>$([System.Text.RegularExpressions.Regex]::Match('$(GitDescribeClean)', '(?&lt;=\d-)\d+(?=-)').Value)</GitCommitsSinceTag>
<GitShortHash>$([System.Text.RegularExpressions.Regex]::Match('$(GitDescribeClean)', 'g[0-9a-f]+$').Value)</GitShortHash>
</PropertyGroup>
<!-- On a tag exactly (0 commits since tag) -->
<PropertyGroup Condition="'$(VersionPrefix)' != '' and '$(GitCommitsSinceTag)' == '0'">
<Version>$(VersionPrefix)</Version>
<InformationalVersion>$(VersionPrefix)</InformationalVersion>
</PropertyGroup>
<!-- Commits ahead of tag = dev build -->
<PropertyGroup Condition="'$(VersionPrefix)' != '' and '$(GitCommitsSinceTag)' != '' and '$(GitCommitsSinceTag)' != '0'">
<Version>$(VersionPrefix)</Version>
<InformationalVersion>$(VersionPrefix)-dev.$(GitCommitsSinceTag)+$(GitShortHash)</InformationalVersion>
</PropertyGroup>
<!-- Fallback if git describe failed or no tags -->
<PropertyGroup Condition="'$(VersionPrefix)' == ''">
<Version>0.0.0</Version>
<InformationalVersion>0.0.0-unknown</InformationalVersion>
</PropertyGroup>
</Target>
</Project>