Skip to content

Commit

Permalink
Added support for .NET core
Browse files Browse the repository at this point in the history
Cleaned up namespaces a little to standardize
Updated build scripts
  • Loading branch information
ravensorb committed Jan 7, 2019
1 parent f7335e4 commit c28c829
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 140 deletions.
16 changes: 3 additions & 13 deletions Invisionware.Collections.sln
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.12
# Visual Studio Version 16
VisualStudioVersion = 16.0.28407.52
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Source", "Source", "{030783D5-8B49-446B-B4BD-623CE9C87C7E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuspec", ".nuspec", "{A31F0DBA-7B31-40C8-9887-2E51BD76D565}"
ProjectSection(SolutionItems) = preProject
nuspec\Invisionware.Collections.nuspec = nuspec\Invisionware.Collections.nuspec
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".misc", ".misc", "{B67DBE97-2A64-4E27-8878-698FC381DABD}"
ProjectSection(SolutionItems) = preProject
build.cake = build.cake
Expand All @@ -21,12 +16,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{FC9A0D21
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Invisionware.Collections", "src\Invisionware.Collections\Invisionware.Collections.csproj", "{C6677D99-FA98-4F79-92E8-8247C54561F1}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Invisionware.Collections.Tests", "tests\Invisionware.Collections.Tests\Invisionware.Collections.Tests.csproj", "{913CA724-9FBC-49E4-991D-D9319B74DA05}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".nuget", ".nuget", "{170B64E1-5A0B-4469-A44D-BEEB9E88889D}"
ProjectSection(SolutionItems) = preProject
.nuget\NuGet.Config = .nuget\NuGet.Config
EndProjectSection
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Invisionware.Collections.Tests", "tests\Invisionware.Collections.Tests\Invisionware.Collections.Tests.csproj", "{913CA724-9FBC-49E4-991D-D9319B74DA05}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down
146 changes: 118 additions & 28 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#l "tools/versionUtils.cake"
#l "tools/settingsUtils.cake"
#tool "nuget:?package=NUnit.ConsoleRunner&version=3.9.0"
#addin "Cake.Incubator"

///////////////////////////////////////////////////////////////////////////////
// ARGUMENTS
Expand All @@ -19,7 +20,10 @@ var versionInfo = VersionUtils.LoadVersion(Context, settings);
///////////////////////////////////////////////////////////////////////////////

var solutions = GetFiles(settings.Build.SolutionFilePath);
//Information("Solutions Found:"); Information("\t{0}", string.Join("\n\t", solutions.Select(x => x.GetFilename().ToString()).ToList()));

var solutionPaths = solutions.Select(solution => solution.GetDirectory());
//Information("Solution Paths Found:"); Information("\t{0}", string.Join("\n\t", solutionPaths.Select(x => x.ToString()).ToList()));

///////////////////////////////////////////////////////////////////////////////
// SETUP / TEARDOWN
Expand All @@ -38,8 +42,8 @@ Setup((c) =>
c.Information("\tSolutions Found: {0}", solutions.Count);

// Executed BEFORE the first task.
settings.Display(c);
versionInfo.Display(c);
try { settings.Display(c); } catch (Exception ex) { Error("Failed to Display Settings: {0}", ex.ToString()); }
try { versionInfo.Display(c); } catch (Exception ex) { Error("Failed to Version Info: {0}", ex.ToString()); }
});

Teardown((c) =>
Expand All @@ -60,18 +64,25 @@ Task("CleanAll")
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/**/bin");
CleanDirectories(path + "/**/obj");
CleanDirectories(path + "/packages/**/*");
CleanDirectories(path + "/artifacts/**/*");
CleanDirectories(path + "/packages");
CleanDirectories(path + "/artifacts");

try {
CleanDirectories(path + "/**/bin");
CleanDirectories(path + "/**/obj");
}
catch {
Warning("\tFailed to clean path");
}
}

var pathTest = MakeAbsolute(Directory(settings.Test.SourcePath)).FullPath;
Information("Cleaning {0}", pathTest);
try { CleanDirectories(pathTest + "/**/bin"); } catch {}
try { CleanDirectories(pathTest + "/**/obj"); } catch {}

var pathArtificats = MakeAbsolute(Directory(settings.Build.ArtifactsPath)).FullPath;
Information("Cleaning {0}", pathArtificats);
try { CleanDirectories(pathArtificats); } catch {}

});

Task("Clean")
Expand All @@ -98,13 +109,9 @@ Task("CleanPackages")
.Description("Cleans all packages that are used during the build process.")
.Does(() =>
{
// Clean solution directories.
foreach(var path in solutionPaths)
{
Information("Cleaning {0}", path);
CleanDirectories(path + "/packages/**/*");
CleanDirectories(path + "/packages");
}
var pathArtificats = MakeAbsolute(Directory(settings.Build.ArtifactsPath)).FullPath;
Information("Cleaning {0}", pathArtificats);
try { CleanDirectories(pathArtificats); } catch {}
});

Task("Restore")
Expand Down Expand Up @@ -344,50 +351,133 @@ Task("Nuget-Publish")
.IsDependentOn("Nuget-Package")
.Does(() =>
{
var authError = false;

var artifactsPath = Directory(settings.NuGet.ArtifactsPath);

CreateDirectory(artifactsPath);

if (settings.NuGet.FeedApiKey.ToLower() == "local")
{
settings.NuGet.FeedUrl = Directory(settings.NuGet.FeedUrl).Path.FullPath;
//Information("Using Local repository: {0}", settings.NuGet.FeedUrl);
}

if (settings.NuGet.FeedApiKey == "NUGETAPIKEY")
{
if (!System.IO.File.Exists("nugetapi.key"))
{
Error("Could not load nugetapi.key");
return;
}

settings.NuGet.FeedApiKey = System.IO.File.ReadAllText("nugetapi.key");
}

if (string.IsNullOrEmpty(settings.NuGet.NuGetConfig)) settings.NuGet.NuGetConfig = null;

switch (settings.NuGet.BuildType)
{
case "dotnetcore":
RunTarget("Nuget-Publish-DotNetCore");

break;
default:
RunTarget("Nuget-Publish-CLI");

break;
}

});

Task("Nuget-Publish-DotNetCore")
.Description("Publishes all of the nupkg packages to the nuget server. ")
.Does(() =>
{
var authError = false;

Information("Publishing Packages from {0} to {1} for version {2}", settings.NuGet.ArtifactsPath, settings.NuGet.FeedUrl, versionInfo.ToString());

// Lets get the list of packages (we can skip anything that is not part of the current version being built)
var nupkgFiles = GetFiles(settings.NuGet.NuGetPackagesSpec).Where(x => x.ToString().Contains(versionInfo.ToString())).ToList();

Information("\t{0}", string.Join("\n\t", nupkgFiles.Select(x => x.GetFilename().ToString()).ToList()));

if (settings.NuGet.FeedApiKey == "NUGETAPIKEY")
var dncps = new DotNetCoreNuGetPushSettings
{
Source = settings.NuGet.FeedUrl,
ApiKey = settings.NuGet.FeedApiKey
};

foreach (var n in nupkgFiles)
{
if (!System.IO.File.Exists("nugetapi.key"))
//Information("Pushing Package: {0}", n);

try {
DotNetCoreNuGetPush(n.ToString(), dncps);
}
catch (Exception ex)
{
Error("Could not load nugetapi.key");
return;
if (ex.Message.Contains("403") || ex.Message.Contains("401")) {
Information("\tUnable to Authenticate to Nuget Feed. Publish of {0} failed", n.ToString());

authError = true;
}
else {
Warning("\tFailed to published: {0}", ex.Message);
}
}

settings.NuGet.FeedApiKey = System.IO.File.ReadAllText("nugetapi.key");
}

if (authError && settings.NuGet.FeedApiKey == "VSTS")
{
Warning("\tYou may need to Configuration Your Credentials.\r\n\t\tCredentialProvider.VSS.exe -Uri {0}", settings.NuGet.FeedUrl);
}
});

Task("Nuget-Publish-CLI")
.Description("Publishes all of the nupkg packages to the nuget server. ")
.Does(() =>
{
var authError = false;

Information("Publishing Packages from {0} to {1} for version {2}", settings.NuGet.ArtifactsPath, settings.NuGet.FeedUrl, versionInfo.ToString());

// Lets get the list of packages (we can skip anything that is not part of the current version being built)
var nupkgFiles = GetFiles(settings.NuGet.NuGetPackagesSpec).Where(x => x.ToString().Contains(versionInfo.ToString())).ToList();

Information("\t{0}", string.Join("\n\t", nupkgFiles.Select(x => x.GetFilename().ToString()).ToList()));

if (BuildSystem.IsRunningOnVSTS)
{
settings.NuGet.FeedApiKey = EnvironmentVariable("SYSTEM_ACCESSTOKEN");
}

var nugetSettings = new NuGetPushSettings {
Source = settings.NuGet.FeedUrl,
ApiKey = settings.NuGet.FeedApiKey,
ConfigFile = settings.NuGet.NuGetConfig,
Verbosity = NuGetVerbosity.Normal
Verbosity = NuGetVerbosity.Detailed
};

foreach (var n in nupkgFiles)
{
Information("Pushing Package: {0}", n);

try
{
NuGetPush(n, nugetSettings);
}
catch (Exception ex)
{
Information("\tFailed to published: ", ex.Message);

if (ex.Message.Contains("403")) { authError = true; }
if (ex.Message.Contains("403") || ex.Message.Contains("401")) {
Information("\tUnable to Authenticate to Nuget Feed. Publish of {0} failed", n.ToString());

authError = true;
}
else if (ex.Message.Contains("409")) {
Warning("\tUnable to publish package: {0}", ex.Message);
}
else {
Error("\tFailed to published: {0}", ex.Message);
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion build.version.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"major":1,"minor":1,"build":9,"preRelease":0,"releaseNotes":null}
{"major":1,"minor":1,"build":10,"preRelease":1,"releaseNotes":["Added support for .NET Core"]}
29 changes: 0 additions & 29 deletions nuspec/Invisionware.Collections.nuspec

This file was deleted.

36 changes: 0 additions & 36 deletions src/AssemblyInfo.Shared.cs

This file was deleted.

13 changes: 4 additions & 9 deletions src/Invisionware.Collections/Invisionware.Collections.csproj
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<AssemblyName>Invisionware.Collections</AssemblyName>
<TargetFrameworks>netcoreapp1.0;netstandard1.0;net472</TargetFrameworks>
<PackageId>Invisionware.Collections</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
<Authors>Invisionware</Authors>
<PackageProjectUrl>https://github.com/Invisionware/Invisionware.Collections</PackageProjectUrl>
<license>Apache-2.0</license>
<PackageIconUrl>https://github.com/Invisionware/Invisionware.Collections/raw/master/logo.png</PackageIconUrl>
<Description>Contains various extension methods for collections</Description>
<PackageReleaseNotes></PackageReleaseNotes>
<PackageReleaseNotes />
<Copyright>Copyright © 2018 Invisionware</Copyright>
<PackageTags>invisionware extensions dictionary enumerable list</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
</PropertyGroup>
<ItemGroup>
</ItemGroup>
</Project>
Binary file modified tools/CredentialProvider.VSS.exe
Binary file not shown.
Binary file removed tools/VSS.NuGet.AuthHelper.exe
Binary file not shown.
Loading

0 comments on commit c28c829

Please sign in to comment.