goldendict-ng/MSBuild/custom.targets
Igor Kushnir b7da546dd5 Fix string case in all files: Goldendict => GoldenDict
Run the following string-replacement command in my GNU/Linux system:
    git grep -l Goldendict | xargs sed -i 's/Goldendict/GoldenDict/g'
2020-11-19 18:36:35 +02:00

44 lines
1.6 KiB
XML

<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<VersionFile>$(ProjectDir)version.txt</VersionFile>
<NewVersionFile>$(IntDir)version.txt</NewVersionFile>
</PropertyGroup>
<!-- Update the version.txt file, but only if needed, when the version really changes -->
<Target Name="GenerateGitVersionFile" AfterTargets="InitializeBuildStatus">
<WriteLinesToFile
File="$(VersionFile)"
Lines="1.5+git"
Overwrite="true"
Encoding="ASCII"
Condition="!Exists($(VersionFile))" />
<Exec Command="git describe --tags --always --dirty > $(NewVersionFile)"
IgnoreExitCode="True" />
<PropertyGroup>
<GoldenDictVersion>$([System.IO.File]::ReadAllText($(VersionFile)).Trim())</GoldenDictVersion>
<NewGoldenDictVersion>$([System.IO.File]::ReadAllText($(NewVersionFile)).Trim())</NewGoldenDictVersion>
</PropertyGroup>
<Message Text="Version change: $(GoldenDictVersion) ~> $(NewGoldenDictVersion)"
Importance="high"
Condition="('$(NewGoldenDictVersion)' != '') And
('$(NewGoldenDictVersion)' != '$(GoldenDictVersion)')" />
<Copy
SourceFiles="$(NewVersionFile)"
DestinationFiles="$(VersionFile)"
Condition="('$(NewGoldenDictVersion)' != '') And
('$(NewGoldenDictVersion)' != '$(GoldenDictVersion)')"
/>
</Target>
<Target Name="CleanVersionFiles" AfterTargets="Clean">
<Delete Files="$(VersionFile);$(NewVersionFile)" />
</Target>
</Project>