Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
Next Next commit
added back the msbuild tasks
  • Loading branch information
arturcic committed Jun 24, 2019
commit 047b34d7c1447eeaeac9dede411ab543ddd5578a
7 changes: 4 additions & 3 deletions src/GitVersionTask/FileHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Linq;
using System.Text.RegularExpressions;
using GitVersion;
using Microsoft.Build.Framework;

public static class FileHelper
{
Expand Down Expand Up @@ -59,7 +60,7 @@ public static string GetFileExtension(string language)
}
}

public static void CheckForInvalidFiles(IEnumerable<string> compileFiles, string projectFile)
public static void CheckForInvalidFiles(IEnumerable<ITaskItem> compileFiles, string projectFile)
{
foreach (var compileFile in GetInvalidFiles(compileFiles, projectFile))
{
Expand Down Expand Up @@ -129,9 +130,9 @@ private static bool VisualBasicFileContainsVersionAttribute(string compileFile,
\s*\(\s*\)\s*\> # End brackets ()>");
}

private static IEnumerable<string> GetInvalidFiles(IEnumerable<string> compileFiles, string projectFile)
private static IEnumerable<string> GetInvalidFiles(IEnumerable<ITaskItem> compileFiles, string projectFile)
{
return compileFiles
return compileFiles.Select(x => x.ItemSpec)
.Where(compileFile => compileFile.Contains("AssemblyInfo"))
.Where(s => FileContainsVersionAttribute(s, projectFile));
}
Expand Down
24 changes: 14 additions & 10 deletions src/GitVersionTask/GenerateGitVersionInformation.cs
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
namespace GitVersionTask
{
public class GenerateGitVersionInformation
using Microsoft.Build.Framework;

public class GenerateGitVersionInformation : GitVersionTaskBase
{
// This method is entrypoint for the task declared in .props file
public static Output Execute(Input input) => GitVersionTasks.GenerateGitVersionInformation(input);
[Required]
public string ProjectFile { get; set; }

[Required]
public string IntermediateOutputPath { get; set; }

[Required]
public string Language { get; set; }

public sealed class Input : InputWithCommonAdditionalProperties
{
}
[Output]
public string GitVersionInformationFilePath { get; set; }

public sealed class Output
{
public string GitVersionInformationFilePath { get; set; }
}
public override bool Execute() => TaskProxy.GenerateGitVersionInformation(this);
}
}
103 changes: 64 additions & 39 deletions src/GitVersionTask/GetVersion.cs
Original file line number Diff line number Diff line change
@@ -1,74 +1,99 @@
namespace GitVersionTask
{
public class GetVersion
{
public static Output Execute(Input input) => GitVersionTasks.GetVersion(input);
using Microsoft.Build.Framework;

public sealed class Input : InputBase
{
}
public class GetVersion : GitVersionTaskBase
{
[Output]
public string Major { get; set; }

public sealed class Output
{
public string Major { get; set; }
[Output]
public string Minor { get; set; }

public string Minor { get; set; }
[Output]
public string Patch { get; set; }

public string Patch { get; set; }
[Output]
public string PreReleaseTag { get; set; }

public string PreReleaseTag { get; set; }
[Output]
public string PreReleaseTagWithDash { get; set; }

public string PreReleaseTagWithDash { get; set; }
[Output]
public string PreReleaseLabel { get; set; }

public string PreReleaseLabel { get; set; }
[Output]
public string PreReleaseNumber { get; set; }

public string PreReleaseNumber { get; set; }
[Output]
public string WeightedPreReleaseNumber { get; set; }

public string WeightedPreReleaseNumber { get; set; }
[Output]
public string BuildMetaData { get; set; }

public string BuildMetaData { get; set; }
[Output]
public string BuildMetaDataPadded { get; set; }

public string BuildMetaDataPadded { get; set; }
[Output]
public string FullBuildMetaData { get; set; }

public string FullBuildMetaData { get; set; }
[Output]
public string MajorMinorPatch { get; set; }

public string MajorMinorPatch { get; set; }
[Output]
public string SemVer { get; set; }

public string SemVer { get; set; }
[Output]
public string LegacySemVer { get; set; }

public string LegacySemVer { get; set; }
[Output]
public string LegacySemVerPadded { get; set; }

public string LegacySemVerPadded { get; set; }
[Output]
public string AssemblySemVer { get; set; }

public string AssemblySemVer { get; set; }
[Output]
public string AssemblySemFileVer { get; set; }

public string AssemblySemFileVer { get; set; }
[Output]
public string FullSemVer { get; set; }

public string FullSemVer { get; set; }
[Output]
public string InformationalVersion { get; set; }

public string InformationalVersion { get; set; }
[Output]
public string BranchName { get; set; }

public string BranchName { get; set; }
[Output]
public string Sha { get; set; }

public string Sha { get; set; }
[Output]
public string ShortSha { get; set; }

public string ShortSha { get; set; }
[Output]
public string NuGetVersionV2 { get; set; }

public string NuGetVersionV2 { get; set; }
[Output]
public string NuGetVersion { get; set; }

public string NuGetVersion { get; set; }
[Output]
public string NuGetPreReleaseTagV2 { get; set; }

public string NuGetPreReleaseTagV2 { get; set; }
[Output]
public string NuGetPreReleaseTag { get; set; }

public string NuGetPreReleaseTag { get; set; }
[Output]
public string CommitDate { get; set; }

public string CommitDate { get; set; }
[Output]
public string VersionSourceSha { get; set; }

public string VersionSourceSha { get; set; }
[Output]
public string CommitsSinceVersionSource { get; set; }

public string CommitsSinceVersionSource { get; set; }
[Output]
public string CommitsSinceVersionSourcePadded { get; set; }

public string CommitsSinceVersionSourcePadded { get; set; }
}
public override bool Execute() => TaskProxy.GetVersion(this);
}
}
4 changes: 2 additions & 2 deletions src/GitVersionTask/GitVersionTaskUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ namespace GitVersionTask

public static class GitVersionTaskUtils
{
public static bool GetVersionVariables(InputBase input, out VersionVariables versionVariables)
=> new ExecuteCore(new FileSystem()).TryGetVersion(input.SolutionDirectory, out versionVariables, input.NoFetch, new Authentication());
public static bool GetVersionVariables(GitVersionTaskBase task, out VersionVariables versionVariables)
=> new ExecuteCore(new FileSystem()).TryGetVersion(task.SolutionDirectory, out versionVariables, task.NoFetch, new Authentication());

public static FileWriteInfo GetFileWriteInfo(
this string intermediateOutputPath,
Expand Down
Loading