Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating UtilPack.NuGet.MSBuild to NuGetUtils.MSBuild.Exec #1634

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
6ae9c55
First modifications for changing from UtilPack.NuGet.MSBuild to NuGet…
stazz Mar 8, 2019
ac88f0d
Also updated .nuspec file with new dependency, and modified task fact…
stazz Mar 10, 2019
61a71eb
Making GitVersionTask.Tests compilable again.
stazz Mar 10, 2019
0bca914
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 10, 2019
844fbc0
Updated to newer NuGetUtils.MSBuild.Exec, which runs on .NET Desktop …
stazz Mar 13, 2019
bc69b43
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 13, 2019
725fbbb
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 14, 2019
e3fd1b7
Fixing a typo causing NullReferenceException.
stazz Mar 14, 2019
c2f3610
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 18, 2019
43121f3
Updating to newer NuGetUtils.MSBuild.Exec version, which fixes the bu…
stazz Mar 18, 2019
1da59e4
Merge branch 'stazz/NuGetUtilsUpdate' of https://github.com/stazz/Git…
stazz Mar 18, 2019
9d8eb38
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 19, 2019
b608f96
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 20, 2019
166ffe0
Updated NuGetUtils.MSBuild.Exec to 2.0.3.
stazz Mar 20, 2019
44c73b2
Partially changed UtilPack names to NuGetUtils.MSBuild.Exec. Need mor…
stazz Mar 20, 2019
6e16a8c
Forgot to update one reference to renamed property.
stazz Mar 20, 2019
855a7f0
Updating to newer version of NuGetUtils.MSBuild.Exec in order to cut …
stazz Mar 20, 2019
854f16b
Merge branch 'master' into stazz/NuGetUtilsUpdate
stazz Mar 21, 2019
c52b072
Do not reset Logger during call to Execute()
tpaxatb Mar 21, 2019
9be3c29
Clean up logging
tpaxatb Mar 21, 2019
4b650f0
Merge pull request #1644 from tpaxatb/bugfix/Logging
arturcic Mar 22, 2019
3b28212
Resolving conflicts related to #1644 .
stazz Mar 23, 2019
0eb2280
Resolving something else this time, no idea what.
stazz Mar 23, 2019
8898886
Resolving last conflicts
stazz Mar 27, 2019
6f64c34
Updated the NuGetUtils.MSBuild.Exec version to newer, with most recen…
stazz Mar 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/GitVersionTask.Tests/GetVersionTaskTests.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Linq;
using System.Linq;
using GitVersion;
using GitVersionTask;
using Microsoft.Build.Framework;
using NUnit.Framework;
using Shouldly;

Expand All @@ -11,13 +10,12 @@ public class GetVersionTaskTests : TestBase
[Test]
public void OutputsShouldMatchVariableProvider()
{
var taskProperties = typeof(GetVersion)
var taskProperties = typeof( GetVersion.Output )
.GetProperties()
.Where(p => p.GetCustomAttributes(typeof(OutputAttribute), false).Any())
.Select(p => p.Name);
.Select( p => p.Name );

var variablesProperties = VersionVariables.AvailableVariables;

taskProperties.ShouldBe(variablesProperties, ignoreOrder: true);
taskProperties.ShouldBe( variablesProperties, ignoreOrder: true );
}
}
1 change: 0 additions & 1 deletion src/GitVersionTask.Tests/GitVersionTask.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
<PackageReference Include="NUnit" Version="3.11.0"></PackageReference>
<packagereference Include="NUnit3TestAdapter" Version="3.13.0"></packagereference>
<PackageReference Include="Shouldly" Version="3.0.2"></PackageReference>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="15.9.20" />
</ItemGroup>
<ItemGroup>
<Content Include="Approved\**\*.txt" />
Expand Down
128 changes: 63 additions & 65 deletions src/GitVersionTask.Tests/InvalidFileCheckerTests.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using System;
using System.IO;
using GitVersion;
using GitVersionTask.Tests.Mocks;
using Microsoft.Build.Framework;
using NUnit.Framework;

[TestFixture]
Expand All @@ -14,207 +12,207 @@ public class InvalidFileCheckerTests : TestBase
[SetUp]
public void CreateTemporaryProject()
{
projectDirectory = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
projectFile = Path.Combine(projectDirectory, "Fake.csproj");
projectDirectory = Path.Combine( Path.GetTempPath(), Guid.NewGuid().ToString() );
projectFile = Path.Combine( projectDirectory, "Fake.csproj" );

Directory.CreateDirectory(projectDirectory);
Directory.CreateDirectory( projectDirectory );

File.Create(projectFile).Close();
File.Create( projectFile ).Close();
}

[TearDown]
public void Cleanup()
{
Directory.Delete(projectDirectory, true);
Directory.Delete( projectDirectory, true );
}

[Test]
public void VerifyIgnoreNonAssemblyInfoFile()
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "SomeOtherFile.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "SomeOtherFile.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

[assembly: AssemblyVersion(""1.0.0.0"")]
");
" );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "SomeOtherFile.cs" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "SomeOtherFile.cs" }, projectFile );
}

[Test]
public void VerifyAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")]string attribute)
public void VerifyAttributeFoundCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

[assembly:{0}(""1.0.0.0"")]
", attribute);
", attribute );
}

var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile), attribute);
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs"));
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile ), attribute );
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs" ) );
}

[Test]
public void VerifyUnformattedAttributeFoundCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")]string attribute)
public void VerifyUnformattedAttributeFoundCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

[ assembly :
{0} ( ""1.0.0.0"")]
", attribute);
", attribute );
}

var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile), attribute);
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs"));
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile ), attribute );
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.cs" ) );
}

[Test]
public void VerifyCommentWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyCommentWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

//[assembly: {0}(""1.0.0.0"")]
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
}

[Test]
public void VerifyStringWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyStringWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

public class Temp
{{
static const string Foo = ""[assembly: {0}(""""1.0.0.0"""")]"";
}}
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
}

[Test]
public void VerifyIdentifierWorksCSharp([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyIdentifierWorksCSharp( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.cs")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.cs" ) ) )
{
writer.Write(@"
writer.Write( @"
using System;
using System.Reflection;

public class {0}
{{
}}
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.cs" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.cs" }, projectFile );
}

[Test]
public void VerifyAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion")]string attribute)
public void VerifyAttributeFoundVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System.Reflection.AssemblyVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
{
writer.Write(@"
writer.Write( @"
Imports System
Imports System.Reflection

<Assembly:{0}(""1.0.0.0"")>
", attribute);
", attribute );
}

var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile), attribute);
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb"));
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile ), attribute );
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb" ) );
}

[Test]
public void VerifyUnformattedAttributeFoundVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion")]string attribute)
public void VerifyUnformattedAttributeFoundVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion", "System . Reflection . AssemblyVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
{
writer.Write(@"
writer.Write( @"
Imports System
Imports System.Reflection

< Assembly :
{0} ( ""1.0.0.0"")>
", attribute);
", attribute );
}

var ex = Assert.Throws<WarningException>(() => InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile), attribute);
Assert.That(ex.Message, Is.EqualTo("File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb"));
var ex = Assert.Throws<WarningException>( () => InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile ), attribute );
Assert.That( ex.Message, Is.EqualTo( "File contains assembly version attributes which conflict with the attributes generated by GitVersion AssemblyInfo.vb" ) );
}

[Test]
public void VerifyCommentWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyCommentWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
{
writer.Write(@"
writer.Write( @"
Imports System
Imports System.Reflection

'<Assembly: {0}(""1.0.0.0"")>
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
}

[Test]
public void VerifyStringWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyStringWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
{
writer.Write(@"
writer.Write( @"
Imports System
Imports System.Reflection

Public Class Temp
static const string Foo = ""<Assembly: {0}(""""1.0.0.0"""")>"";
End Class
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
}

[Test]
public void VerifyIdentifierWorksVisualBasic([Values("AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion")]string attribute)
public void VerifyIdentifierWorksVisualBasic( [Values( "AssemblyVersion", "AssemblyFileVersion", "AssemblyInformationalVersion" )]string attribute )
{
using (var writer = File.CreateText(Path.Combine(projectDirectory, "AssemblyInfo.vb")))
using ( var writer = File.CreateText( Path.Combine( projectDirectory, "AssemblyInfo.vb" ) ) )
{
writer.Write(@"
writer.Write( @"
Imports System
Imports System.Reflection

Public Class {0}
End Class
", attribute);
", attribute );
}

InvalidFileChecker.CheckForInvalidFiles(new ITaskItem[] { new MockTaskItem { ItemSpec = "AssemblyInfo.vb" } }, projectFile);
InvalidFileChecker.CheckForInvalidFiles( new[] { "AssemblyInfo.vb" }, projectFile );
}
}
45 changes: 0 additions & 45 deletions src/GitVersionTask.Tests/Mocks/MockBuildEngine.cs

This file was deleted.

Loading