Skip to content
This repository was archived by the owner on Aug 6, 2019. It is now read-only.

Commit 58feaaa

Browse files
Merge branch 'develop'
2 parents 11a4d0c + 44786ec commit 58feaaa

13 files changed

+362
-177
lines changed

.editorconfig

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,14 @@ csharp_space_between_method_call_parameter_list_parentheses = true
2020
csharp_space_between_method_declaration_parameter_list_parentheses = true
2121
csharp_space_after_keywords_in_control_flow_statements = false
2222
csharp_space_between_parentheses = control_flow_statements
23+
24+
# internal and private fields should be _camelCase
25+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
26+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
27+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
28+
29+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
30+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
31+
32+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
33+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case

Code.Cake/Code.Cake.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,10 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

3+
<Import Project="..\Common\Shared.props"/>
4+
35
<PropertyGroup>
46
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
57
<Description>CodeCake offers code based support to Cake (see http://cakebuild.net/ site).</Description>
6-
<Authors>Olivier Spinelli</Authors>
7-
<Company>Signature-Code</Company>
8-
<PackageLicenseUrl>https://github.com/SimpleGitVersion/CodeCake/blob/master/LICENSE.txt</PackageLicenseUrl>
9-
<PackageProjectUrl>https://github.com/SimpleGitVersion/CodeCake</PackageProjectUrl>
10-
<PackageIconUrl>https://raw.githubusercontent.com/SimpleGitVersion/CodeCake/blob/master/CodeCake.png</PackageIconUrl>
11-
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
12-
<Copyright>Copyright (c) 2012-2018 Signature-Code</Copyright>
138
<PackageTags>CodeCake Cake Script Build CakeBuild</PackageTags>
149
</PropertyGroup>
1510

CodeCake.sln

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.27130.2027
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Code.Cake", "Code.Cake\Code.Cake.csproj", "{246BDFF0-AF13-4353-835C-2C39787339BB}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Code.Cake", "Code.Cake\Code.Cake.csproj", "{246BDFF0-AF13-4353-835C-2C39787339BB}"
77
EndProject
88
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{07994045-D177-4D39-A1DD-82200AC26EF0}"
99
ProjectSection(SolutionItems) = preProject
@@ -13,9 +13,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
1313
nuget.config = nuget.config
1414
README.md = README.md
1515
RepositoryInfo.xml = RepositoryInfo.xml
16+
Common\Shared.props = Common\Shared.props
1617
EndProjectSection
1718
EndProject
18-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CodeCakeBuilder", "CodeCakeBuilder\CodeCakeBuilder.csproj", "{FD4817B6-3CD7-4E74-AA10-7CA95FDFCF2D}"
19+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "CodeCakeBuilder", "CodeCakeBuilder\CodeCakeBuilder.csproj", "{FD4817B6-3CD7-4E74-AA10-7CA95FDFCF2D}"
1920
EndProject
2021
Global
2122
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
using Cake.Common.Build;
2+
using Cake.Common.Diagnostics;
3+
using Cake.Common.Solution;
4+
using CK.Text;
5+
using SimpleGitVersion;
6+
using System.Collections.Generic;
7+
using System.Linq;
8+
9+
namespace CodeCake
10+
{
11+
public partial class Build
12+
{
13+
string StandardCheckRepository( IEnumerable<SolutionProject> projectsToPublish, SimpleRepositoryInfo gitInfo )
14+
{
15+
string configuration = "Debug";
16+
if( !gitInfo.IsValid )
17+
{
18+
if( Cake.IsInteractiveMode()
19+
&& Cake.ReadInteractiveOption( "PublishDirtyRepo", "Repository is not ready to be published. Proceed anyway?", 'Y', 'N' ) == 'Y' )
20+
{
21+
Cake.Warning( "GitInfo is not valid, but you choose to continue..." );
22+
}
23+
else
24+
{
25+
// On Appveyor, we let the build be done: this gracefully handles Pull Requests.
26+
if( !Cake.AppVeyor().IsRunningOnAppVeyor ) Cake.TerminateWithError( "Repository is not ready to be published." );
27+
}
28+
}
29+
30+
if( gitInfo.IsValidRelease
31+
&& (gitInfo.PreReleaseName.Length == 0 || gitInfo.PreReleaseName == "rc") )
32+
{
33+
configuration = "Release";
34+
}
35+
36+
Cake.Information( "Publishing {0} projects with version={1} and configuration={2}: {3}",
37+
projectsToPublish.Count(),
38+
gitInfo.SafeSemVersion,
39+
configuration,
40+
projectsToPublish.Select( p => p.Name ).Concatenate() );
41+
return configuration;
42+
}
43+
44+
}
45+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Cake.Common.Diagnostics;
2+
using Cake.Common.Solution;
3+
using Cake.Common.Tools.DotNetCore;
4+
using Cake.Common.Tools.DotNetCore.Pack;
5+
using Cake.Core;
6+
using Cake.Core.IO;
7+
using SimpleGitVersion;
8+
using System.Collections.Generic;
9+
10+
namespace CodeCake
11+
{
12+
public partial class Build
13+
{
14+
void StandardCreateNuGetPackages( DirectoryPath releasesDir, IEnumerable<SolutionProject> projectsToPublish, SimpleRepositoryInfo gitInfo, string configuration )
15+
{
16+
var settings = new DotNetCorePackSettings().AddVersionArguments( gitInfo, c =>
17+
{
18+
// Waiting for netcore 2.1 (https://github.com/dotnet/cli/issues/5331).
19+
// Setting nobuild and BuildProjectReferences=false
20+
// IsPackable=true is required for Tests package. Without this Pack on Tests projects does not generate nupkg.
21+
c.ArgumentCustomization += args => args.Append( "/p:IsPackable=true" )
22+
.Append( "/p:BuildProjectReferences=false" );
23+
c.NoBuild = true;
24+
c.IncludeSymbols = true;
25+
c.Configuration = configuration;
26+
c.OutputDirectory = releasesDir;
27+
} );
28+
foreach( SolutionProject p in projectsToPublish )
29+
{
30+
Cake.Information( p.Path.GetDirectory().FullPath );
31+
Cake.DotNetCorePack( p.Path.GetDirectory().FullPath, settings );
32+
}
33+
}
34+
}
35+
}
Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
using Cake.Common.Build;
2+
using Cake.Common.Diagnostics;
3+
using Cake.Common.IO;
4+
using Cake.Common.Tools.NuGet;
5+
using Cake.Common.Tools.NuGet.Push;
6+
using Cake.Core.IO;
7+
using SimpleGitVersion;
8+
using System.Collections.Generic;
9+
using System.Diagnostics;
10+
11+
namespace CodeCake
12+
{
13+
public partial class Build
14+
{
15+
16+
void StandardPushNuGetPackages( IEnumerable<FilePath> nugetPackages, SimpleRepositoryInfo gitInfo )
17+
{
18+
if( Cake.IsInteractiveMode() )
19+
{
20+
var localFeed = Cake.FindDirectoryAbove( "LocalFeed" );
21+
if( localFeed != null )
22+
{
23+
Cake.Information( $"LocalFeed directory found: {localFeed}" );
24+
if( Cake.ReadInteractiveOption( "LocalFeed", "Do you want to publish to LocalFeed?", 'Y', 'N' ) == 'Y' )
25+
{
26+
Cake.CopyFiles( nugetPackages, localFeed );
27+
}
28+
}
29+
}
30+
if( gitInfo.IsValidRelease )
31+
{
32+
if( gitInfo.PreReleaseName == ""
33+
|| gitInfo.PreReleaseName == "prerelease"
34+
|| gitInfo.PreReleaseName == "rc" )
35+
{
36+
PushNuGetPackages( "MYGET_RELEASE_API_KEY",
37+
"https://www.myget.org/F/invenietis-release/api/v2/package",
38+
"https://www.myget.org/F/invenietis-release/symbols/api/v2/package" );
39+
}
40+
else
41+
{
42+
// An alpha, beta, delta, epsilon, gamma, kappa goes to invenietis-preview.
43+
PushNuGetPackages( "MYGET_PREVIEW_API_KEY",
44+
"https://www.myget.org/F/invenietis-preview/api/v2/package",
45+
"https://www.myget.org/F/invenietis-preview/symbols/api/v2/package" );
46+
}
47+
}
48+
else
49+
{
50+
Debug.Assert( gitInfo.IsValidCIBuild );
51+
PushNuGetPackages( "MYGET_CI_API_KEY",
52+
"https://www.myget.org/F/invenietis-ci/api/v2/package",
53+
"https://www.myget.org/F/invenietis-ci/symbols/api/v2/package" );
54+
}
55+
if( Cake.AppVeyor().IsRunningOnAppVeyor )
56+
{
57+
Cake.AppVeyor().UpdateBuildVersion( gitInfo.SafeNuGetVersion );
58+
}
59+
60+
void PushNuGetPackages( string apiKeyName, string pushUrl, string pushSymbolUrl )
61+
{
62+
// Resolves the API key.
63+
var apiKey = Cake.InteractiveEnvironmentVariable( apiKeyName );
64+
if( string.IsNullOrEmpty( apiKey ) )
65+
{
66+
Cake.Information( $"Could not resolve {apiKeyName}. Push to {pushUrl} is skipped." );
67+
}
68+
else
69+
{
70+
var settings = new NuGetPushSettings
71+
{
72+
Source = pushUrl,
73+
ApiKey = apiKey,
74+
Verbosity = NuGetVerbosity.Detailed
75+
};
76+
NuGetPushSettings symbSettings = null;
77+
if( pushSymbolUrl != null )
78+
{
79+
symbSettings = new NuGetPushSettings
80+
{
81+
Source = pushSymbolUrl,
82+
ApiKey = apiKey,
83+
Verbosity = NuGetVerbosity.Detailed
84+
};
85+
}
86+
foreach( var nupkg in nugetPackages )
87+
{
88+
if( !nupkg.FullPath.EndsWith( ".symbols.nupkg" ) )
89+
{
90+
Cake.Information( $"Pushing '{nupkg}' to '{pushUrl}'." );
91+
Cake.NuGetPush( nupkg, settings );
92+
}
93+
else
94+
{
95+
if( symbSettings != null )
96+
{
97+
Cake.Information( $"Pushing Symbols '{nupkg}' to '{pushSymbolUrl}'." );
98+
Cake.NuGetPush( nupkg, symbSettings );
99+
}
100+
}
101+
}
102+
}
103+
}
104+
}
105+
106+
}
107+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using Cake.Common.Solution;
2+
using Cake.Common.Tools.DotNetCore;
3+
using Cake.Common.Tools.DotNetCore.Build;
4+
using SimpleGitVersion;
5+
using System.Collections.Generic;
6+
7+
namespace CodeCake
8+
{
9+
public partial class Build
10+
{
11+
/// <summary>
12+
/// Builds the provided .sln without "CodeCakeBuilder" project itself and
13+
/// optionally other projects.
14+
/// </summary>
15+
/// <param name="solutionFileName">The solution file name to build (relative to the repository root).</param>
16+
/// <param name="gitInfo">The current git info.</param>
17+
/// <param name="configuration">The build configuration.</param>
18+
/// <param name="excludedProjectName">Optional project names (without path nor .csproj extension).</param>
19+
void StandardSolutionBuild( string solutionFileName, SimpleRepositoryInfo gitInfo, string configuration, params string[] excludedProjectName )
20+
{
21+
using( var tempSln = Cake.CreateTemporarySolutionFile( solutionFileName ) )
22+
{
23+
var exclude = new List<string>( excludedProjectName );
24+
exclude.Add( "CodeCakeBuilder" );
25+
tempSln.ExcludeProjectsFromBuild( exclude.ToArray() );
26+
Cake.DotNetCoreBuild( tempSln.FullPath.FullPath,
27+
new DotNetCoreBuildSettings().AddVersionArguments( gitInfo, s =>
28+
{
29+
s.Configuration = configuration;
30+
} ) );
31+
}
32+
}
33+
34+
}
35+
}

0 commit comments

Comments
 (0)