diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6a9a8e5..c7420de 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -68,6 +68,7 @@ stages: - stage: nuget_deploy jobs: - deployment: nuget_deploy + condition: and(succeeded(), eq(variables['Deploy.Nuget'], 'true')) pool: Personal-Docker environment: nuget strategy: diff --git a/build.cake b/build.cake index 2db0fa6..15ae983 100644 --- a/build.cake +++ b/build.cake @@ -65,6 +65,7 @@ Task("CleanAll") Information("Cleaning {0}", path); try { + CleanDirectories(path + "/packages"); CleanDirectories(path + "/**/bin"); CleanDirectories(path + "/**/obj"); } @@ -155,12 +156,20 @@ Task("Build") { case "dotnetcore": var dotNetCoreBuildSettings = new DotNetCoreMSBuildSettings(); - if (!string.IsNullOrEmpty(versionInfo.ToVersionPrefix())) - dotNetCoreBuildSettings.SetVersionPrefix(versionInfo.ToVersionPrefix()); - if (!string.IsNullOrEmpty(versionInfo.ToVersionSuffix())) - dotNetCoreBuildSettings.SetVersionSuffix(versionInfo.ToVersionSuffix()); - if (!string.IsNullOrEmpty(versionInfo.ToString())) - dotNetCoreBuildSettings.SetFileVersion(versionInfo.ToString(false)); + + if (versionInfo.IsSemantic) + { + dotNetCoreBuildSettings.SetFileVersion(versionInfo.ToString()); + } + else + { + if (!string.IsNullOrEmpty(versionInfo.ToVersionPrefix())) + dotNetCoreBuildSettings.SetVersionPrefix(versionInfo.ToVersionPrefix()); + if (!string.IsNullOrEmpty(versionInfo.ToVersionSuffix())) + dotNetCoreBuildSettings.SetVersionSuffix(versionInfo.ToVersionSuffix()); + if (!string.IsNullOrEmpty(versionInfo.ToString())) + dotNetCoreBuildSettings.SetFileVersion(versionInfo.ToString(false)); + } DotNetCoreBuild(solution.ToString(), new DotNetCoreBuildSettings { @@ -331,13 +340,16 @@ Task("Nuget-Package-DotNetCore") CreateDirectory(artifactsPath); var dotNetCoreBuildSettings = new DotNetCoreMSBuildSettings(); - if (!string.IsNullOrEmpty(versionInfo.ToVersionPrefix())) - dotNetCoreBuildSettings.SetVersionPrefix(versionInfo.ToVersionPrefix()); - if (!string.IsNullOrEmpty(versionInfo.ToVersionSuffix())) - dotNetCoreBuildSettings.SetVersionSuffix(versionInfo.ToVersionSuffix()); - if (!string.IsNullOrEmpty(versionInfo.ToString())) - dotNetCoreBuildSettings.SetFileVersion(versionInfo.ToString(true)); - + + dotNetCoreBuildSettings.SetFileVersion(versionInfo.ToString()); + if (!versionInfo.IsSemantic) + { + if (!string.IsNullOrEmpty(versionInfo.ToVersionPrefix())) + dotNetCoreBuildSettings.SetVersionPrefix(versionInfo.ToVersionPrefix()); + if (!string.IsNullOrEmpty(versionInfo.ToVersionSuffix())) + dotNetCoreBuildSettings.SetVersionSuffix(versionInfo.ToVersionSuffix()); + } + var opts = new DotNetCorePackSettings { Configuration = settings.Configuration, @@ -347,8 +359,9 @@ Task("Nuget-Package-DotNetCore") MSBuildSettings = dotNetCoreBuildSettings }; - if (!string.IsNullOrEmpty(versionInfo.ToVersionSuffix())) + if (!versionInfo.IsSemantic && versionInfo.IsPreRelease) { opts.VersionSuffix = versionInfo.ToVersionSuffix(); + } if (settings.NuGet.IncludeSymbols) { opts.ArgumentCustomization = args => args.Append("--include-symbols -p:SymbolPackageFormat=snupkg"); diff --git a/build.version.json b/build.version.json index fb3db9d..aec5f38 100644 --- a/build.version.json +++ b/build.version.json @@ -2,10 +2,12 @@ "Major": 1, "Minor": 1, "Build": 10, - "PreRelease": 2, + "Suffix": null, + "PreRelease": 0, "ReleaseNotes": [], "Semantic": null, "Milestone": null, - "CakeVersion": "0.33.0.0", - "IsPreRelease": true + "CakeVersion": "0.37.0.0", + "IsPreRelease": false, + "IsSemantic": false } \ No newline at end of file diff --git a/src/Invisionware.Collections/Invisionware.Collections.csproj b/src/Invisionware.Collections/Invisionware.Collections.csproj index d9d3adf..44ddbc8 100644 --- a/src/Invisionware.Collections/Invisionware.Collections.csproj +++ b/src/Invisionware.Collections/Invisionware.Collections.csproj @@ -1,7 +1,7 @@  - netcoreapp1.0;netstandard1.0;net472 + netstandard1.0;net472 Invisionware.Collections Invisionware https://github.com/Invisionware/Invisionware.Collections @@ -13,15 +13,13 @@ true Contains various extension methods for collections invisionware extensions dictionary enumerable list - - 1.6.1 - + True - + \ No newline at end of file diff --git a/tests/Invisionware.Collections.Tests/Invisionware.Collections.Tests.csproj b/tests/Invisionware.Collections.Tests/Invisionware.Collections.Tests.csproj index 0091505..ddcc5c5 100644 --- a/tests/Invisionware.Collections.Tests/Invisionware.Collections.Tests.csproj +++ b/tests/Invisionware.Collections.Tests/Invisionware.Collections.Tests.csproj @@ -1,7 +1,7 @@ - net472 + netcoreapp2.1;netcoreapp3.1;net472 false true @@ -11,7 +11,7 @@ - + diff --git a/tools/settingsUtils.cake b/tools/settingsUtils.cake index 8769185..2366708 100644 --- a/tools/settingsUtils.cake +++ b/tools/settingsUtils.cake @@ -132,6 +132,11 @@ public class SettingsUtils context.Information("\t\t-settingsFile=\t\t(Default: {0})", defaultValues.SettingsFile); context.Information("\t\t-versionFile=\t\t(Default: {0})", defaultValues.VersionFile); context.Information("\t\t-autoincrement=<0|1>\t\t\t\t(Default: {0})", defaultValues.Version.AutoIncrementVersion); + context.Information("\t\t-versionMajor="); + context.Information("\t\t-versionMinor="); + context.Information("\t\t-versionBuild="); + context.Information("\t\t-versionSuffix= (ex: pre, beta, alpha)"); + context.Information("\t\t-versionPreRelease="); context.Information("\t\t-build=<0|1>\t\t\t\t(Default: {0})", defaultValues.ExecuteBuild); context.Information("\t\t-package=<0|1>\t\t\t\t(Default: {0})", defaultValues.ExecutePackage); context.Information("\t\t-unitTest=<0|1>\t\t\t\t(Default: {0})", defaultValues.ExecuteUnitTest); diff --git a/tools/versionUtils.cake b/tools/versionUtils.cake index 1c3f597..d8f360d 100644 --- a/tools/versionUtils.cake +++ b/tools/versionUtils.cake @@ -1,4 +1,6 @@ #addin "nuget:?package=Cake.Json&version=4.0.0" +#addin "nuget:?package=Cake.Incubator&version=5.1.0" +#addin "nuget:?package=Cake.GitVersioning&version=3.0.25" #addin "nuget:?package=Newtonsoft.Json&version=12.0.3" #addin "nuget:?package=Cake.FileHelpers&version=3.2.1" #tool "nuget:?package=GitVersion.CommandLine&version=5.1.3" @@ -96,23 +98,32 @@ public class VersionUtils context.Information("Fetching Verson Info from Git"); try { - GitVersion assertedVersions = context.GitVersion(new GitVersionSettings - { - OutputType = GitVersionOutput.Json, - }); + // GitVersion gitVersionInfo = context.GitVersion(new GitVersionSettings + // { + // OutputType = GitVersionOutput.Json, + // }); + + var gitVersionInfo = context.GitVersioningGetVersion(); + + //context.Information("Git Version Details:\n{0}", gitVersionInfo.Dump()); var verInfo = new VersionInfo { - Major = assertedVersions.Major, - Minor = assertedVersions.Minor, - Build = assertedVersions.Patch, - Semantic = assertedVersions.LegacySemVerPadded, - Milestone = string.Concat("v", assertedVersions.MajorMinorPatch) + Major = gitVersionInfo.VersionMajor, + Minor = gitVersionInfo.VersionMinor, + Build = gitVersionInfo.BuildNumber, + //Suffix = gitVersionInfo.PreReleaseTag, + //PreRelease = gitVersionInfo.PrereleaseVersion, + Semantic = gitVersionInfo.SemVer2, + Milestone = string.Concat("v", gitVersionInfo.VersionRevision) }; - context.Information("Calculated Semantic Version: {0}", verInfo.Semantic); + //context.Information("Version Info:\n{0}", verInfo.Dump()); + + //context.Information(context.GitVersioningGetVersion().Dump()); return verInfo; - } catch {} + } catch { + } return null; } @@ -146,10 +157,12 @@ public class VersionUtils try { var verInfo = new VersionInfo { - Major = context.Argument("versionMajor"), - Minor = context.Argument("versionMinor"), - Build = context.Argument("versionBuild"), - PreRelease = context.Argument("versionPreRelease") + Major = context.Argument("versionMajor", 0), + Minor = context.Argument("versionMinor", 0), + Build = context.Argument("versionBuild", 0), + PreRelease = context.Argument("versionPreRelease", 0), + Suffix = context.Argument("versionSuffix", ""), + Semantic = context.Argument("versionSem", "") }; context.Information("Calculated Semantic Version: {0}", verInfo.Semantic); @@ -248,6 +261,8 @@ public class VersionInfo public int? Minor {get;set;} [Newtonsoft.Json.JsonProperty("build")] public int? Build {get;set;} + [Newtonsoft.Json.JsonProperty("suffix")] + public string Suffix {get;set;} [Newtonsoft.Json.JsonProperty("preRelease")] public int? PreRelease {get;set;} [Newtonsoft.Json.JsonProperty("releaseNotes")] @@ -261,12 +276,16 @@ public class VersionInfo public string CakeVersion {get;set;} [Newtonsoft.Json.JsonIgnore] - public bool IsPreRelease { get { return PreRelease != null && PreRelease != 0; } } + public bool IsPreRelease { get { return (PreRelease != null && PreRelease != 0); } } + + [Newtonsoft.Json.JsonIgnore] + public bool IsSemantic { get { return !string.IsNullOrEmpty(Semantic); } } public string ToString(bool includePreRelease = true) { - var str = string.Format("{0:#0}.{1:#0}.{2:#0}", Major, Minor, Build); - if (IsPreRelease && includePreRelease) str += string.Format("-pre{0:00}", PreRelease); + if (IsSemantic) return Semantic; + + var str = string.Format("{0}{1}", ToVersionPrefix(), includePreRelease ? ToVersionSuffix() : ""); return str; } @@ -282,10 +301,12 @@ public class VersionInfo public string ToVersionSuffix() { - if (!IsPreRelease) return string.Empty; - - var str = string.Format("pre{0:00}", PreRelease); + if (!IsPreRelease || IsSemantic) return string.Empty; + if (string.IsNullOrEmpty(Suffix)) Suffix = "pre"; + + var str = string.Format("-{0}{1:00}", Suffix, PreRelease); + return str; } @@ -295,8 +316,9 @@ public class VersionInfo context.Information("\tMajor: {0}", Major); context.Information("\tMinor: {0}", Minor); context.Information("\tBuild: {0}", Build); + context.Information("\tSuffix: {0}", ToVersionSuffix()); context.Information("\tIs PreRelease: {0}", IsPreRelease); - context.Information("\tPreRelease: {0}", PreRelease); + context.Information("\tIs Semantic: {0}", IsSemantic); context.Information("\tSemantic: {0}", Semantic); context.Information("\tMilestone: {0}", Milestone); context.Information("\tCake Version: {0}", CakeVersion);