Skip to content

Commit

Permalink
Converted Nuspec to dotnetcore project references
Browse files Browse the repository at this point in the history
updated build scripts to latest version
  • Loading branch information
ravensorb committed Oct 2, 2018
1 parent 6125f2f commit f4cd29c
Show file tree
Hide file tree
Showing 4 changed files with 93 additions and 19 deletions.
57 changes: 57 additions & 0 deletions build.cake
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#load "tools/settingsUtils.cake"
///////////////////////////////////////////////////////////////////////////////
// Directives
///////////////////////////////////////////////////////////////////////////////
Expand Down Expand Up @@ -28,6 +29,7 @@ Setup((c) =>
{
c.Information("Command Line:");
c.Information("\tConfiguration: {0}", settings.Configuration);
c.Information("\tRoot Path: {0}", settings.RootPath);
c.Information("\tSettings Files: {0}", settings.SettingsFile);
c.Information("\tExecute Build: {0}", settings.ExecuteBuild);
c.Information("\tExecute Clean: {0}", settings.ExecuteClean);
Expand Down Expand Up @@ -243,6 +245,61 @@ Task("Nuget-Package")
.Does(() =>
{
var artifactsPath = Directory(settings.NuGet.ArtifactsPath);
CreateDirectory(artifactsPath);
switch (settings.NuGet.BuildType)
{
case "dotnetcore":
RunTarget("Nuget-Package-DotNetCore");
break;
default:
RunTarget("Nuget-Package-CLI");
break;
}
});

Task("Nuget-Package-DotNetCore")
.Description("Packages all projects in the solution using dotnetcore")
.WithCriteria(settings.ExecutePackage)
.Does(() =>
{
var artifactsPath = Directory(settings.NuGet.ArtifactsPath);
CreateDirectory(artifactsPath);
var dncps = new DotNetCorePackSettings
{
Configuration = settings.Configuration,
OutputDirectory = artifactsPath
};
Information("Location of Artifacts: {0}", artifactsPath);
foreach(var solution in solutions)
{
Information("Building Packages for {0}", solution);
try {
//DotNetCorePack("./src/**/*.csproj", dncps);
DotNetCorePack(solution.ToString(), dncps);
}
catch (Exception ex)
{
Information("There was a problem with packing some of the projects in {0}", solution);
}
}
});

Task("Nuget-Package-CLI")
.Description("Packages all projects in the solution using the nuget.exe cli")
.WithCriteria(settings.ExecutePackage)
.Does(() =>
{
var artifactsPath = Directory(settings.NuGet.ArtifactsPath);
var nugetProps = new Dictionary<string, string>() { {"Configuration", settings.Configuration} };
CreateDirectory(artifactsPath);
Expand Down
6 changes: 4 additions & 2 deletions build.settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
"BuildType": "dotnetcore",
"SourcePath": "./src",
"SolutionFileSpec": "./*.sln",
"ArtifactsPath": "./artifacts/app",
"TreatWarningsAsErrors": false
"ArtifactsPath": "./artifacts/packages",
"TreatWarningsAsErrors": false,
"CopyNugetPackagesToArtificatsPath": true
},
"xamarin": {
"EnableXamarinIOS": false,
Expand All @@ -25,6 +26,7 @@
"Framework": "NUnit3"
},
"nuget": {
"BuildType": "dotnetcore",
"NuGetConfig": "./src/.nuget/NuGet.config",
"FeedUrl": "https://api.nuget.org/v3/index.json",
"FeedAPIKey": "NUGETAPIKEY",
Expand Down
38 changes: 22 additions & 16 deletions src/Invisionware.Collections/Invisionware.Collections.csproj
Original file line number Diff line number Diff line change
@@ -1,17 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<AssemblyName>Invisionware.Collections</AssemblyName>
<PackageId>Invisionware.Collections</PackageId>
<NetStandardImplicitPackageVersion>1.6.1</NetStandardImplicitPackageVersion>
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
<GenerateNeutralResourcesLanguageAttribute>false</GenerateNeutralResourcesLanguageAttribute>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.2" />
</ItemGroup>

</Project>
<PropertyGroup>
<TargetFramework>netstandard1.1</TargetFramework>
<AssemblyName>Invisionware.Collections</AssemblyName>
<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>
<PackageLicenseUrl>https://raw.githubusercontent.com/Invisionware/Invisionware.Collections/master/LICENSE</PackageLicenseUrl>
<PackageIconUrl>https://github.com/Invisionware/Invisionware.Collections/raw/master/logo.png</PackageIconUrl>
<Description>Contains various extension methods for collections</Description>
<PackageReleaseNotes></PackageReleaseNotes>
<Copyright>Copyright © 2018 Invisionware</Copyright>
<PackageTags>invisionware extensions dictionary enumerable list</PackageTags>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.Portable.Compatibility" Version="1.0.2" />
</ItemGroup>
</Project>
11 changes: 10 additions & 1 deletion tools/settingsUtils.cake
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@ public class SettingsUtils
context.Error("Settings File Does Not Exist");
return null;
}

var obj = context.DeserializeJsonFromFile<Settings>(settingsFile);

obj.SettingsFile = settingsFile;

obj.RootPath = context.MakeAbsolute(context.Directory(obj.RootPath)).ToString() + "/";
if (obj.Build.ArtifactsPath.StartsWith("./")) obj.Build.ArtifactsPath.Replace("./", obj.RootPath);

// Allow for any overrides
obj.Target = context.Argument<string>("target", obj.Target);
Expand Down Expand Up @@ -55,6 +58,7 @@ public class SettingsUtils

if (obj.NuGet == null) obj.NuGet = new NuGetSettings();

obj.NuGet.BuildType = context.Argument<string>("BuildType", obj.NuGet.BuildType);
obj.NuGet.FeedUrl = context.Argument<string>("nugetFeed", obj.NuGet.FeedUrl);
obj.NuGet.FeedUrl = context.Argument<string>("nugetFeedUrl", obj.NuGet.FeedUrl);

Expand Down Expand Up @@ -112,6 +116,7 @@ public class Settings
ExecuteUnitTest = true;
ExecuteClean = true;

RootPath = ".\\";
Target = "DisplayHelp";
Configuration = "Release";
SettingsFile = ".\\build.settings.json";
Expand All @@ -128,6 +133,7 @@ public class Settings
public string Configuration {get;set;}
public string SettingsFile {get;set;}
public string VersionFile {get;set;}
public string RootPath {get;set;}

public bool ExecuteBuild {get;set;}
public bool ExecutePackage {get;set;}
Expand All @@ -145,6 +151,7 @@ public class Settings
context.Information("Settings:");

context.Information("\tTarget: {0}", Target);
context.Information("\tRoot Path: {0}", RootPath);
context.Information("\tConfiguration: {0}", Configuration);
context.Information("\tSettings File: {0}", SettingsFile);
context.Information("\tVersion File: {0}", VersionFile);
Expand Down Expand Up @@ -286,6 +293,7 @@ public class NuGetSettings
LibraryMinVersionDependency = null;
}

public string BuildType {get;set;}
public string NuGetConfig {get;set;}
public string FeedUrl {get;set;}
public string FeedApiKey {get;set;}
Expand All @@ -312,6 +320,7 @@ public class NuGetSettings
public void Display(ICakeContext context)
{
context.Information("NuGet Settings:");
context.Information("\tBuild Type: {0}", BuildType);
context.Information("\tNuGet Config: {0}", NuGetConfig);
context.Information("\tFeed Url: {0}", FeedUrl);
//context.Information("\tFeed API Key: {0}", FeedApiKey);
Expand Down

0 comments on commit f4cd29c

Please sign in to comment.