Build updates

Use the version in the .csproj if there is no local git repository.
Always use Windows line endings in codegen output.
Update build dependency versions. We're still using GitVersion 5.1.3 because of https://github.com/nuke-build/nuke/issues/509.
This commit is contained in:
Alex Barney 2020-08-15 23:19:27 -07:00
parent 30273bf3ef
commit a005b40022
6 changed files with 26 additions and 8 deletions

View file

@ -1 +1 @@
3.1.300
3.1.401

View file

@ -104,12 +104,19 @@ namespace LibHacBuild
}
catch (Exception e)
{
Logger.Error(e);
if (!e.Message.Contains("not a git repository", StringComparison.OrdinalIgnoreCase))
{
Logger.Error(e);
}
}
if (gitRepository == null || gitVersion == null)
{
Logger.Normal("Unable to read Git version.");
VersionString = GetCsprojVersion();
Logger.Normal($"Using version from .csproj: {VersionString}");
return;
}
@ -656,5 +663,10 @@ namespace LibHacBuild
return pwd.ToString();
}
public string GetCsprojVersion()
{
return XmlTasks.XmlPeekSingle(LibHacProject.Path, "/Project/PropertyGroup/VersionPrefix", null);
}
}
}

View file

@ -321,6 +321,12 @@ namespace LibHacBuild.CodeGen
hasBom = oldFile.AsSpan(0, 3).SequenceEqual(bom);
}
// Make line endings the same on Windows and Unix
if (Environment.NewLine == "\n")
{
text = text.Replace("\n", "\r\n");
}
byte[] newFile = (hasBom ? bom : new byte[0]).Concat(Encoding.UTF8.GetBytes(text)).ToArray();
if (oldFile?.SequenceEqual(newFile) == true)

View file

@ -11,9 +11,9 @@
<ItemGroup>
<PackageDownload Include="GitVersion.Tool" Version="[5.1.3]" />
<PackageReference Include="CsvHelper" Version="15.0.2" />
<PackageReference Include="NuGet.CommandLine" Version="5.4.0" />
<PackageReference Include="Nuke.Common" Version="0.24.4" />
<PackageReference Include="CsvHelper" Version="15.0.5" />
<PackageReference Include="NuGet.CommandLine" Version="5.6.0" />
<PackageReference Include="Nuke.Common" Version="0.24.11" />
<PackageReference Include="SharpZipLib" Version="1.2.0" />
</ItemGroup>

View file

@ -44,7 +44,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0-preview.6.20305.6" />
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="5.0.0-preview.7.20364.11" />
</ItemGroup>
</Project>

View file

@ -7,11 +7,11 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.7.0" />
<PackageReference Include="xunit.core" Version="2.4.1" />
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
<PackageReference Include="xunit.assert.source" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.3" />
</ItemGroup>
<ItemGroup>