Skip to content

Commit

Permalink
Updated targetframeworks
Browse files Browse the repository at this point in the history
Updated build pipeline
  • Loading branch information
ravensorb committed Mar 20, 2020
1 parent e8b0154 commit 41b8cc5
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 46 deletions.
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
41 changes: 27 additions & 14 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ Task("CleanAll")
Information("Cleaning {0}", path);
try {
CleanDirectories(path + "/packages");
CleanDirectories(path + "/**/bin");
CleanDirectories(path + "/**/obj");
}
Expand Down Expand Up @@ -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
{
Expand Down Expand Up @@ -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,
Expand All @@ -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");
Expand Down
8 changes: 5 additions & 3 deletions build.version.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
8 changes: 3 additions & 5 deletions src/Invisionware.Collections/Invisionware.Collections.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netcoreapp1.0;netstandard1.0;net472</TargetFrameworks>
<TargetFrameworks>netstandard1.0;net472</TargetFrameworks>
<PackageId>Invisionware.Collections</PackageId>
<Authors>Invisionware</Authors>
<PackageProjectUrl>https://github.com/Invisionware/Invisionware.Collections</PackageProjectUrl>
Expand All @@ -13,15 +13,13 @@
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Description>Contains various extension methods for collections</Description>
<PackageTags>invisionware extensions dictionary enumerable list</PackageTags>

<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
</PropertyGroup>

<ItemGroup>
<None Include="..\..\logo.png">
<Pack>True</Pack>
<PackagePath></PackagePath>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<TargetFrameworks>netcoreapp2.1;netcoreapp3.1;net472</TargetFrameworks>

<IsPackable>false</IsPackable>
<IsTestProject>true</IsTestProject>
Expand All @@ -11,7 +11,7 @@
<PackageReference Include="FluentAssertions" Version="5.10.2" />
<PackageReference Include="nunit" Version="3.12.0" />
<PackageReference Include="NUnit3TestAdapter" Version="3.16.1" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
<PackageReference Include="Serilog" Version="2.9.0" />
</ItemGroup>

Expand Down
5 changes: 5 additions & 0 deletions tools/settingsUtils.cake
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,11 @@ public class SettingsUtils
context.Information("\t\t-settingsFile=<Settings File>\t\t(Default: {0})", defaultValues.SettingsFile);
context.Information("\t\t-versionFile=<Version File>\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=<Major Version Number>");
context.Information("\t\t-versionMinor=<Minor Version Number>");
context.Information("\t\t-versionBuild=<Build Version Number>");
context.Information("\t\t-versionSuffix=<Version Suffix> (ex: pre, beta, alpha)");
context.Information("\t\t-versionPreRelease=<PreRelease Number>");
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);
Expand Down
66 changes: 44 additions & 22 deletions tools/versionUtils.cake
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -146,10 +157,12 @@ public class VersionUtils
try {

var verInfo = new VersionInfo {
Major = context.Argument<int?>("versionMajor"),
Minor = context.Argument<int?>("versionMinor"),
Build = context.Argument<int?>("versionBuild"),
PreRelease = context.Argument<int?>("versionPreRelease")
Major = context.Argument<int?>("versionMajor", 0),
Minor = context.Argument<int?>("versionMinor", 0),
Build = context.Argument<int?>("versionBuild", 0),
PreRelease = context.Argument<int?>("versionPreRelease", 0),
Suffix = context.Argument<string>("versionSuffix", ""),
Semantic = context.Argument<string>("versionSem", "")
};

context.Information("Calculated Semantic Version: {0}", verInfo.Semantic);
Expand Down Expand Up @@ -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")]
Expand All @@ -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;
}
Expand All @@ -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;
}

Expand All @@ -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);
Expand Down

0 comments on commit 41b8cc5

Please sign in to comment.