Skip to content

Commit 40fcda3

Browse files
committed
Converted to netcore/Cofoundry 0.2.0
1 parent d094d65 commit 40fcda3

33 files changed

+330
-1152
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ This plugin contains a simple implementation of `IErrorLoggingService` that logs
1313

1414
The [Cofoundry.Plugins.ErrorLogging.Admin](https://www.nuget.org/packages/Cofoundry.Plugins.ErrorLogging/) package can be installed to enable an error log section in the admin panel.
1515

16-
*Note that this current version of the error logging package has not been given much attention. We will be giving this a lot more love in upcoming releases.*
16+
*Note that this current version of the error logging package has not been given much attention. We will be giving this a little more love in upcoming releases.*
1717

1818
## Settings
1919

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
version: '{build}'
2-
image: Visual Studio 2015
2+
image: Visual Studio 2017
33
environment:
44
NUGET_API_KEY:
55
secure: KBgtBksw79Z4kFehSqUePYoknzeWB8Tq8eAzSFPxDysRJCjJT3iUiCzk7OweTp0K

build.cake

Lines changed: 48 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#tool "nuget:?package=GitVersion.CommandLine"
22

3+
using System.Text.RegularExpressions;
4+
35
//////////////////////////////////////////////////////////////////////
46
// ARGUMENTS
57
//////////////////////////////////////////////////////////////////////
@@ -10,6 +12,12 @@ var pushPackages = Argument("PushPackages", "false") == "true";
1012
bool isPrerelease = false;
1113
GitVersion versionInfo = null;
1214

15+
var projectsToBuild = new string[]{
16+
"./src/Cofoundry.Plugins.ErrorLogging/Cofoundry.Plugins.ErrorLogging.csproj",
17+
"./src/Cofoundry.Plugins.ErrorLogging.Admin/Cofoundry.Plugins.ErrorLogging.Admin.csproj",
18+
};
19+
20+
1321
//////////////////////////////////////////////////////////////////////
1422
// PREPARATION
1523
//////////////////////////////////////////////////////////////////////
@@ -27,15 +35,8 @@ Task("Clean")
2735
CleanDirectory(nugetPackageDir);
2836
CleanDirectories("./src/**/bin/" + configuration);
2937
CleanDirectories("./src/**/obj/" + configuration);
30-
CleanDirectory("./src/Cofoundry.Plugins.ErrorLogging.Admin/bin/");
3138
});
3239

33-
Task("Restore-NuGet-Packages")
34-
.IsDependentOn("Clean")
35-
.Does(() =>
36-
{
37-
NuGetRestore("./src/Cofoundry.Plugins.ErrorLogging.sln");
38-
});
3940

4041
Task("Patch-Assembly-Version")
4142
.IsDependentOn("Clean")
@@ -45,49 +46,65 @@ Task("Patch-Assembly-Version")
4546
UpdateAssemblyInfo = false
4647
});
4748

48-
Information("Building version {0} of Cofoundry.Plugins.ErrorLogging.", versionInfo.InformationalVersion);
49+
Information("Building version {0} of Cofoundry.", versionInfo.InformationalVersion);
4950

5051
isPrerelease = !string.IsNullOrEmpty(versionInfo.PreReleaseNumber);
5152

52-
var file = "./src/SolutionInfo.cs";
53-
CreateAssemblyInfo(file, new AssemblyInfoSettings {
54-
Version = versionInfo.AssemblySemVer,
55-
FileVersion = versionInfo.MajorMinorPatch + ".0",
56-
InformationalVersion = versionInfo.InformationalVersion,
57-
Copyright = "Copyright © Cofoundry.org " + DateTime.Now.Year
58-
});
53+
// Patch the version number so it's picked up when dependent projects are references
54+
// as nuget dependencies. Can't find a better way to do this.
55+
// Also this needs to run before DotNetCoreRestore for some reason (cached?)
56+
var file = MakeAbsolute(File("./src/Directory.Build.props"));
57+
var xml = System.IO.File.ReadAllText(file.FullPath, Encoding.UTF8);
58+
xml = Regex.Replace(xml, @"(<Version>)(.+)(<\/Version>)", "${1}" + versionInfo.NuGetVersion +"${3}");
59+
System.IO.File.WriteAllText(file.FullPath, xml, Encoding.UTF8);
60+
});
61+
62+
Task("Restore-NuGet-Packages")
63+
.IsDependentOn("Patch-Assembly-Version")
64+
.Does(() =>
65+
{
66+
foreach (var projectToBuild in projectsToBuild)
67+
{
68+
DotNetCoreRestore(projectToBuild);
69+
}
5970
});
6071

6172
Task("Build")
6273
.IsDependentOn("Restore-NuGet-Packages")
63-
.IsDependentOn("Patch-Assembly-Version")
6474
.Does(() =>
6575
{
66-
if(IsRunningOnWindows())
76+
77+
var settings = new DotNetCoreBuildSettings
78+
{
79+
Configuration = configuration,
80+
ArgumentCustomization = args => args
81+
.Append("/p:NuGetVersion=" + versionInfo.NuGetVersion)
82+
.Append("/p:AssemblyVersion=" + versionInfo.AssemblySemVer)
83+
.Append("/p:FileVersion=" + versionInfo.MajorMinorPatch + ".0")
84+
.Append("/p:InformationalVersion=" + versionInfo.InformationalVersion)
85+
.Append("/p:Copyright=" + "\"Copyright © Cofoundry.org " + DateTime.Now.Year + "\"")
86+
};
87+
88+
foreach (var projectToBuild in projectsToBuild)
6789
{
68-
// Use MSBuild
69-
MSBuild("./src/Cofoundry.Plugins.ErrorLogging.sln", settings => settings.SetConfiguration(configuration));
90+
DotNetCoreBuild(projectToBuild, settings);
7091
}
7192
});
7293

7394
Task("Pack")
7495
.IsDependentOn("Build")
7596
.Does(() =>
7697
{
77-
var nugetFilePaths = GetFiles("./src/Cofoundry.*/*.nuspec");
78-
79-
var nuGetPackSettings = new NuGetPackSettings
80-
{
81-
Version = versionInfo.NuGetVersion,
82-
OutputDirectory = nugetPackageDir,
83-
Verbosity = NuGetVerbosity.Detailed,
84-
ArgumentCustomization = args => args.Append("-Prop Configuration=" + configuration)
85-
};
98+
var settings = new DotNetCorePackSettings
99+
{
100+
Configuration = configuration,
101+
OutputDirectory = "./artifacts/",
102+
NoBuild = true
103+
};
86104

87-
foreach (var path in nugetFilePaths)
105+
foreach (var projectToBuild in projectsToBuild)
88106
{
89-
Information("Packing:" + path);
90-
NuGetPack(path, nuGetPackSettings);
107+
DotNetCorePack(projectToBuild, settings);
91108
}
92109
});
93110

src/Cofoundry.Plugins.ErrorLogging.Admin/Bootstrap/AssemblyResourceRegistration.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
using System;
1+
using Cofoundry.Core.ResourceFiles;
2+
using System;
23
using System.Collections.Generic;
34
using System.Linq;
4-
using System.Web;
5-
using Cofoundry.Core.EmbeddedResources;
65

76
namespace Cofoundry.Plugins.ErrorLogging.Admin.Bootstrap
87
{

0 commit comments

Comments
 (0)