Skip to content

Commit 15488dc

Browse files
committed
Clean + refactoring code
1 parent 59004ec commit 15488dc

File tree

86 files changed

+1281
-1548
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+1281
-1548
lines changed

.appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ init:
3939

4040
install:
4141
# .NET Core SDK binaries
42-
- ps: $urlCurrent = "https://download.microsoft.com/download/D/7/8/D788D3CD-44C4-487D-829B-413E914FB1C3/dotnet-sdk-2.1.300-preview1-008174-win-x64.zip"
42+
- ps: $urlCurrent = "https://download.microsoft.com/download/D/7/8/D788D3CD-44C4-487D-829B-413E914FB1C3/dotnet-sdk-2.1.300-win-x64.zip"
4343
- ps: $env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
4444
- ps: mkdir $env:DOTNET_INSTALL_DIR -Force | Out-Null
4545
- ps: $tempFileCurrent = [System.IO.Path]::Combine([System.IO.Path]::GetTempPath(), [System.IO.Path]::GetRandomFileName())

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ addons:
2020
osx_image: xcode7.2
2121

2222
# Ensure that .NET Core is installed
23-
dotnet: 2.1.105
23+
dotnet: 2.1.300
2424
# dotnet: 2.1.300-preview1-008174
2525
# sudo apt-get install apt-transport-https
2626
# sudo apt-get update

Directory.Build.props

Lines changed: 2 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
2+
23
<PropertyGroup>
34
<TargetFramework>netcoreapp2.1</TargetFramework>
45
</PropertyGroup>
5-
<!-- Framework constants -->
6-
<!--<PropertyGroup>
7-
<NetStandardImplicitPackageVersion Condition=" '$(TargetFramework)' == 'netcoreapp2.0' ">2.0.0</NetStandardImplicitPackageVersion>
8-
</PropertyGroup>-->
9-
<!--<DefineConstants>$(DefineConstants);NETCORE;NETCOREAPP2_1;LIBLOG_PORTABLE</DefineConstants>-->
106
<PropertyGroup Condition=" '$(TargetFramework)' == 'netcoreapp2.1' ">
117
<DefineConstants>LIBLOG_PORTABLE</DefineConstants>
128
</PropertyGroup>
@@ -19,59 +15,8 @@
1915
<Import Project="Directory.CodeAnalysis.props" />
2016

2117
<PropertyGroup Label="Package Versions">
22-
<AspNetCoreVersion>2.1.0-preview1-final</AspNetCoreVersion>
18+
<AspNetCoreVersion>2.1.0</AspNetCoreVersion>
2319
<XunitVersion>2.3.1</XunitVersion>
2420
<XunitAnalyzersVersion>0.8.0</XunitAnalyzersVersion>
2521
</PropertyGroup>
26-
27-
<!--<ItemGroup>
28-
<PackageReference Include="Microsoft.AspNetCore.App" Version="$(AspNetCoreVersion)" />
29-
<PackageReference Include="Serilog" Version="2.6.0" />
30-
<PackageReference Include="Serilog.Extensions.Logging" Version="2.0.0" />
31-
<PackageReference Include="Serilog.AspNetCore" Version="2.1.1" />
32-
<PackageReference Include="Serilog.Formatting.Compact" Version="1.0.0" />
33-
<PackageReference Include="Serilog.Settings.Configuration" Version="2.6.1" />
34-
<PackageReference Include="Serilog.Sinks.ColoredConsole" Version="3.0.1" />
35-
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
36-
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
37-
<PackageReference Include="Serilog.Sinks.Literate" Version="3.0.0" />
38-
</ItemGroup>-->
39-
40-
<!--<PropertyGroup>
41-
<GenerateAssemblyTitleAttribute>false</GenerateAssemblyTitleAttribute>
42-
<GenerateAssemblyDescriptionAttribute>false</GenerateAssemblyDescriptionAttribute>
43-
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
44-
<GenerateAssemblyCompanyAttribute>false</GenerateAssemblyCompanyAttribute>
45-
<GenerateAssemblyVersionAttribute>false</GenerateAssemblyVersionAttribute>
46-
<GenerateAssemblyFileVersionAttribute>false</GenerateAssemblyFileVersionAttribute>
47-
<GenerateAssemblyInformationalVersionAttribute>false</GenerateAssemblyInformationalVersionAttribute>
48-
<GenerateAssemblyCopyrightAttribute>false</GenerateAssemblyCopyrightAttribute>
49-
</PropertyGroup>-->
50-
51-
<!--<Target Name="ShowReservedProperties" AfterTargets="BeforeBuild">
52-
<Message Text=" SolutionDir = $(SolutionDir)" Importance="high" />
53-
<Message Text=" MSBuildProjectDirectory = $(MSBuildProjectDirectory)" Importance="high" />
54-
<Message Text=" MSBuildThisFileDirectory = $(MSBuildThisFileDirectory)" Importance="high" />
55-
<Message Text=" MSBuildProjectFile = $(MSBuildProjectFile)" Importance="high" />
56-
<Message Text=" MSBuildThisFileName = $(MSBuildThisFileName)" Importance="high" />
57-
<Message Text=" MSBuildProjectExtension = $(MSBuildProjectExtension)" Importance="high" />
58-
<Message Text=" MSBuildProjectFullPath = $(MSBuildProjectFullPath)" Importance="high" />
59-
<Message Text=" MSBuildProjectName = $(MSBuildProjectName)" Importance="high" />
60-
<Message Text=" MSBuildBinPath = $(MSBuildBinPath)" Importance="high" />
61-
<Message Text=" MSBuildProjectDefaultTargets = $(MSBuildProjectDefaultTargets)" Importance="high" />
62-
<Message Text=" MSBuildExtensionsPath = $(MSBuildExtensionsPath)" Importance="high" />
63-
<Message Text=" MSBuildStartupDirectory = $(MSBuildStartupDirectory)" Importance="high"/>
64-
</Target>-->
65-
66-
<!--<Target Name="ShowOtherProperties">
67-
<Message Text=" " />
68-
<Message Text=" " />
69-
<Message Text=" Environment (SET) Variables* " />
70-
<Message Text=" ============================ " />
71-
<Message Text=" COMPUTERNAME = *$(COMPUTERNAME)* " />
72-
<Message Text=" USERDNSDOMAIN = *$(USERDNSDOMAIN)* " />
73-
<Message Text=" USERDOMAIN = *$(USERDOMAIN)* " />
74-
<Message Text=" USERNAME = *$(USERNAME)* " />
75-
</Target>-->
76-
7722
</Project>

GlobalSuppressions.cs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-

2-
using System.Diagnostics.CodeAnalysis;
1+
using System.Diagnostics.CodeAnalysis;
32

43
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1633:File must have header", Justification = "Pending")]
54
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.DocumentationRules", "SA1652:Enable XML documentation output", Justification = "Pending")]
6-
7-
8-
95
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1101:Prefix local calls with this", Justification = "Pending")]
106
[assembly: SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1124:Do not use regions", Justification = "Pending")]

build.cake

Lines changed: 29 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,8 @@
44
#tool nuget:?package=ReportGenerator&version=3.1.2
55
#tool nuget:?package=GitVersion.CommandLine&version=3.6.5
66

7-
#load build/paths.cake
8-
#load build/urls.cake
9-
#load build/parameters.cake
10-
#load build/version.cake
11-
7+
// Load other scripts.
8+
#load "./build/parameters.cake"
129
///////////////////////////////////////////////////////////////////////////////
1310
// ARGUMENTS
1411
///////////////////////////////////////////////////////////////////////////////
@@ -17,67 +14,62 @@ var target = Argument<string>("Target", "Default");
1714
var configuration =
1815
HasArgument("Configuration") ? Argument<string>("Configuration") :
1916
EnvironmentVariable("Configuration") != null ? EnvironmentVariable("Configuration") : "Release";
20-
21-
var parameters = BuildParameters.GetParameters(Context,target,configuration);
22-
var paths = BuildPaths.GetPaths(Context, parameters);
23-
2417
// The build number to use in the version number of the built NuGet packages.
2518
// There are multiple ways this value can be passed, this is a common pattern.
2619
// 1. If command line parameter parameter passed, use that.
2720
// 2. Otherwise if running on AppVeyor, get it's build number.
2821
// 3. Otherwise if running on Travis CI, get it's build number.
2922
// 4. Otherwise if an Environment variable exists, use that.
3023
// 5. Otherwise default the build number to 0.
31-
BuildVersion buildVersion=ReadVersionNumberFromProject(Context,paths.Files.VersionFile);
32-
var tempVersionSuffix = buildVersion.VersionSuffix;
33-
3424
var preReleaseSuffix =
3525
HasArgument("PreReleaseSuffix") ? Argument<string>("PreReleaseSuffix") :
3626
(AppVeyor.IsRunningOnAppVeyor && AppVeyor.Environment.Repository.Tag.IsTag) ? null :
3727
EnvironmentVariable("PreReleaseSuffix") != null ? EnvironmentVariable("PreReleaseSuffix") :
38-
tempVersionSuffix;
28+
"beta";
3929
var buildNumber = HasArgument("BuildNumber") ?
4030
Argument<int>("BuildNumber") :
4131
AppVeyor.IsRunningOnAppVeyor ? AppVeyor.Environment.Build.Number :
4232
EnvironmentVariable("BuildNumber") != null ? int.Parse(EnvironmentVariable("BuildNumber")) :
4333
0;
34+
static DirectoryPath GetOutputArtifactFromProjectFile(DirectoryPath artifactsBinFolder,FilePath csprojFile)
35+
{
36+
var fileWithoutExtension=System.IO.Path.GetFileNameWithoutExtension(csprojFile.FullPath);
37+
return artifactsBinFolder.Combine(fileWithoutExtension);
38+
}
4439

45-
46-
var finalVersionPrefix = buildVersion.VersionPrefix;
47-
var finalVersionSuffix = string.IsNullOrEmpty(preReleaseSuffix) ? null :$"-{preReleaseSuffix}-{buildNumber.ToString("D4")}";
48-
49-
var finalVersion= $"{finalVersionPrefix}{finalVersionSuffix}";
50-
51-
52-
var msBuildSettings = new DotNetCoreMSBuildSettings()
53-
.WithProperty("Version", finalVersion)
54-
.WithProperty("AssemblyVersion",finalVersionPrefix)
55-
.WithProperty("FileVersion", finalVersionPrefix)
56-
;
57-
var dotNetCoreBuildSettings = new DotNetCoreBuildSettings {
40+
//////////////////////////////////////////////////////////////////////
41+
// PARAMETERS
42+
//////////////////////////////////////////////////////////////////////
43+
BuildParameters parameters = BuildParameters.GetParameters(Context,target,configuration,preReleaseSuffix,buildNumber);
44+
BuildPaths paths = parameters.Paths;
45+
BuildVersion buildVersion = parameters.Version;
46+
DotNetCoreMSBuildSettings msBuildSettings = new DotNetCoreMSBuildSettings()
47+
.WithProperty("Version", buildVersion.Version)
48+
.WithProperty("AssemblyVersion",buildVersion.VersionPrefix)
49+
.WithProperty("FileVersion", buildVersion.VersionPrefix)
50+
;
51+
DotNetCoreBuildSettings dotNetCoreBuildSettings = new DotNetCoreBuildSettings()
52+
{
5853
Configuration = configuration,
5954
NoRestore = true,
60-
VersionSuffix = finalVersionSuffix,
55+
VersionSuffix = buildVersion.VersionSuffix,
6156
ArgumentCustomization = args => args
6257
.Append("--no-restore")
6358
.AppendSwitch("/p:DebugType","=","Full")
6459
,
6560
MSBuildSettings=msBuildSettings
6661
};
6762

68-
static DirectoryPath GetOutputArtifactFromProjectFile(DirectoryPath artifactsBinFolder,FilePath csprojFile)
69-
{
70-
var fileWithoutExtension=System.IO.Path.GetFileNameWithoutExtension(csprojFile.FullPath);
71-
return artifactsBinFolder.Combine(fileWithoutExtension);
72-
}
73-
7463
///////////////////////////////////////////////////////////////////////////////
7564
// SETUP / TEARDOWN
7665
///////////////////////////////////////////////////////////////////////////////
7766
Setup(context =>
7867
{
79-
Information("Running tasks...");
80-
Information($"finalVersion {finalVersion}");
68+
Information($"Running tasks...{parameters}");
69+
Information($"FinalVersion {buildVersion.Version}");
70+
Information($"VersionPrefix {buildVersion.VersionPrefix}");
71+
Information($"VersionSuffix {buildVersion.VersionSuffix}");
72+
8173
EnsureDirectoryExists(paths.Directories.Artifacts);
8274
EnsureDirectoryExists(paths.Directories.ArtifactsTestResults);
8375
EnsureDirectoryExists(paths.Directories.ArtifactCodeCoverageReportDirectory);
@@ -214,11 +206,7 @@ Task("Test-OpenCover")
214206
});
215207

216208
Task("Report-Coverage")
217-
.IsDependentOn("Test-OpenCover")
218-
.WithCriteria(() => BuildSystem.IsLocalBuild)
219-
.Does(() =>
220-
{
221-
});
209+
.IsDependentOn("Test-OpenCover").WithCriteria(() => BuildSystem.IsLocalBuild).Does(() =>{});
222210

223211
Task("Test-VSTest")
224212
.IsDependentOn("Build")
@@ -301,7 +289,7 @@ Task("Package-NuGet")
301289
var fullBasePath = GetOutputArtifactFromProjectFile(paths.Directories.ArtifactsBinNetCoreapp21,nuspecFile);
302290
// normal
303291
NuGetPack(nuspecFile, new NuGetPackSettings {
304-
Version = finalVersion,
292+
Version = buildVersion.Version,
305293
BasePath = fullBasePath,
306294
OutputDirectory = paths.Directories.ArtifactNugetsDirectory,
307295
Symbols = false,

build/credentials.cake

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
public class BuildCredentials
2+
{
3+
public string UserName { get; private set; }
4+
public string Password { get; private set; }
5+
6+
public BuildCredentials(string userName, string password)
7+
{
8+
UserName = userName;
9+
Password = password;
10+
}
11+
12+
public static BuildCredentials GetGitHubCredentials(ICakeContext context)
13+
{
14+
return new BuildCredentials(
15+
context.EnvironmentVariable("CAKE_GITHUB_USERNAME"),
16+
context.EnvironmentVariable("CAKE_GITHUB_PASSWORD"));
17+
}
18+
}
19+
20+
public class CoverallsCredentials
21+
{
22+
public string RepoToken { get; private set; }
23+
24+
public CoverallsCredentials(string repoToken)
25+
{
26+
RepoToken = repoToken;
27+
}
28+
29+
public static CoverallsCredentials GetCoverallsCredentials(ICakeContext context)
30+
{
31+
return new CoverallsCredentials(
32+
context.EnvironmentVariable("COVERALLS_REPO_TOKEN"));
33+
}
34+
}
35+
36+
public class TwitterCredentials
37+
{
38+
public string ConsumerKey { get; private set; }
39+
public string ConsumerSecret { get; private set; }
40+
public string AccessToken { get; private set; }
41+
public string AccessTokenSecret { get; private set; }
42+
43+
public TwitterCredentials(string consumerKey, string consumerSecret, string accessToken, string accessTokenSecret)
44+
{
45+
ConsumerKey = consumerKey;
46+
ConsumerSecret = consumerSecret;
47+
AccessToken = accessToken;
48+
AccessTokenSecret = accessTokenSecret;
49+
}
50+
51+
public static TwitterCredentials GetTwitterCredentials(ICakeContext context)
52+
{
53+
return new TwitterCredentials(
54+
context.EnvironmentVariable("TWITTER_CONSUMER_KEY"),
55+
context.EnvironmentVariable("TWITTER_CONSUMER_SECRET"),
56+
context.EnvironmentVariable("TWITTER_ACCESS_TOKEN"),
57+
context.EnvironmentVariable("TWITTER_ACCESS_TOKEN_SECRET"));
58+
}
59+
}
60+
61+
public class GitterCredentials
62+
{
63+
public string Token { get; private set; }
64+
public string RoomId { get; private set; }
65+
66+
public GitterCredentials(string token, string roomId)
67+
{
68+
Token = token;
69+
RoomId = roomId;
70+
}
71+
72+
public static GitterCredentials GetGitterCredentials(ICakeContext context)
73+
{
74+
return new GitterCredentials(
75+
context.EnvironmentVariable("GITTER_TOKEN"),
76+
context.EnvironmentVariable("GITTER_ROOM_ID")
77+
);
78+
}
79+
}

build/parameters.cake

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,75 @@
1+
2+
#load ./paths.cake
3+
#load ./urls.cake
4+
#load ./parameters.cake
5+
#load ./version.cake
6+
7+
18
public class BuildParameters
29
{
310
public string Target { get; private set; }
411
public string Configuration { get; private set; }
12+
13+
public string PreReleaseSuffix { get; private set; }
14+
public int BuildNumber { get; private set; }
15+
516
public bool UseDotNetVsTest { get; set; }
617
public bool UseDotNetTest { get; set; }
718
public string TargetFramework { get; private set; }
819
public string TargetFrameworkFull { get; private set; }
20+
21+
public BuildPaths Paths { get; private set; }
22+
public BuildVersion Version { get; private set; }
923

10-
public static BuildParameters GetParameters(ICakeContext context,string target,string configuration)
24+
25+
/*public void Initialize(ICakeContext context)
26+
{
27+
context.Information($" {context}");
28+
var paths = BuildPaths.GetPaths(context, this);
29+
30+
Paths = BuildPaths.GetPaths(context, this);
31+
Version = BuildVersion.Calculate(context,paths.Files.VersionFile,PreReleaseSuffix,BuildNumber);
32+
}*/
33+
34+
/*private static void Initialize(ICakeContext context,BuildParameters buildParameters)
35+
{
36+
context.Information($" {context}");
37+
var paths = BuildPaths.GetPaths(context, buildParameters);
38+
39+
40+
Version = BuildVersion.Calculate(context,paths.Files.VersionFile,PreReleaseSuffix,BuildNumber);
41+
}*/
42+
43+
public static BuildParameters GetParameters(
44+
ICakeContext context,
45+
string target,
46+
string configuration,
47+
string preReleaseSuffix,
48+
int buildNumber)
1149
{
1250
if (context == null)
1351
{
1452
throw new ArgumentNullException("context");
1553
}
1654

55+
//context.Information($" {context.Argument<bool>("UseDotNetVsTest", true)}");
1756
var buildSystem = context.BuildSystem();
18-
19-
return new BuildParameters {
57+
var paths = BuildPaths.GetPaths(context);
58+
var version = BuildVersion.Calculate(context,paths.Files.VersionFile,preReleaseSuffix,buildNumber);
59+
var result = new BuildParameters(){
2060
Target = target,
2161
Configuration = configuration,
62+
PreReleaseSuffix = preReleaseSuffix,
63+
BuildNumber = buildNumber,
64+
Paths = paths,
65+
Version = version,
2266
UseDotNetVsTest = context.Argument<bool>("UseDotNetVsTest", true),
2367
UseDotNetTest = context.Argument<bool>("UseDotNetTest", false),
2468
TargetFramework = "netcoreapp2.1",
2569
TargetFrameworkFull = "netcoreapp2.1"
2670
};
71+
//Initialize( context,result);
72+
73+
return result;
2774
}
2875
}

0 commit comments

Comments
 (0)