Skip to content

Commit abae820

Browse files
committed
Update build.cake
1 parent 8df2181 commit abae820

File tree

1 file changed

+53
-10
lines changed

1 file changed

+53
-10
lines changed

build.cake

Lines changed: 53 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Setup(context =>
3333
BuildParameters.Initialize(Context);
3434

3535
// Executed BEFORE the first task.
36-
Information("Xer.Delegator");
36+
Information("Xer.Messaginator.Extensions.MessageSources.Http");
3737
Information("Parameters");
3838
Information("///////////////////////////////////////////////////////////////////////////////");
3939
Information("Branch: {0}", BuildParameters.Instance.BranchName);
@@ -62,8 +62,14 @@ Task("Clean")
6262
.Description("Cleans all directories that are used during the build process.")
6363
.Does(() =>
6464
{
65+
if (projects.Count() == 0)
66+
{
67+
Information("No projects found.");
68+
return;
69+
}
70+
6571
// Clean solution directories.
66-
foreach(var project in projects)
72+
foreach (var project in projects)
6773
{
6874
Information("Cleaning {0}", project);
6975
DotNetCoreClean(project.FullPath);
@@ -73,7 +79,13 @@ Task("Clean")
7379
Task("Restore")
7480
.Description("Restores all the NuGet packages that are used by the specified solution.")
7581
.Does(() =>
76-
{
82+
{
83+
if (solutions.Count() == 0)
84+
{
85+
Information("No solutions found.");
86+
return;
87+
}
88+
7789
var settings = new DotNetCoreRestoreSettings
7890
{
7991
ArgumentCustomization = args => args
@@ -84,7 +96,7 @@ Task("Restore")
8496
};
8597

8698
// Restore all NuGet packages.
87-
foreach(var solution in solutions)
99+
foreach (var solution in solutions)
88100
{
89101
Information("Restoring {0}...", solution);
90102

@@ -98,6 +110,12 @@ Task("Build")
98110
.IsDependentOn("Restore")
99111
.Does(() =>
100112
{
113+
if (solutions.Count() == 0)
114+
{
115+
Information("No solutions found.");
116+
return;
117+
}
118+
101119
var settings = new DotNetCoreBuildSettings
102120
{
103121
Configuration = configuration,
@@ -109,7 +127,7 @@ Task("Build")
109127
};
110128

111129
// Build all solutions.
112-
foreach(var solution in solutions)
130+
foreach (var solution in solutions)
113131
{
114132
Information("Building {0}", solution);
115133

@@ -123,13 +141,20 @@ Task("Test")
123141
.Does(() =>
124142
{
125143
var projects = GetFiles("./Tests/**/*.Tests.csproj");
144+
145+
if (projects.Count == 0)
146+
{
147+
Information("No test projects found.");
148+
return;
149+
}
150+
126151
var settings = new DotNetCoreTestSettings
127152
{
128153
Configuration = configuration,
129154
NoBuild = true,
130155
};
131156

132-
foreach(var project in projects)
157+
foreach (var project in projects)
133158
{
134159
DotNetCoreTest(project.FullPath, settings);
135160
}
@@ -140,6 +165,13 @@ Task("Pack")
140165
.Does(() =>
141166
{
142167
var projects = GetFiles("./src/**/*.csproj");
168+
169+
if (projects.Count() == 0)
170+
{
171+
Information("No projects found.");
172+
return;
173+
}
174+
143175
var settings = new DotNetCorePackSettings
144176
{
145177
NoBuild = true,
@@ -163,8 +195,14 @@ Task("PublishMyGet")
163195
.Does(() =>
164196
{
165197
var nupkgs = GetFiles("./**/*.nupkg");
198+
199+
if (nupkgs.Count() == 0)
200+
{
201+
Information("No nupkgs found.");
202+
return;
203+
}
166204

167-
foreach(var nupkgFile in nupkgs)
205+
foreach (var nupkgFile in nupkgs)
168206
{
169207
Information("Pulishing to myget {0}", nupkgFile);
170208

@@ -183,7 +221,13 @@ Task("PublishNuGet")
183221
{
184222
var nupkgs = GetFiles("./**/*.nupkg");
185223

186-
foreach(var nupkgFile in nupkgs)
224+
if (nupkgs.Count() == 0)
225+
{
226+
Information("No nupkgs found.");
227+
return;
228+
}
229+
230+
foreach (var nupkgFile in nupkgs)
187231
{
188232
Information("Pulishing to nuget {0}", nupkgFile);
189233
NuGetPush(nupkgFile, new NuGetPushSettings
@@ -267,6 +311,5 @@ public class BuildParameters
267311

268312
public bool ShouldPublishNuGet => !string.IsNullOrWhiteSpace(NuGetApiKey)
269313
&& !string.IsNullOrWhiteSpace(NuGetFeed)
270-
&& IsMasterBranch
271-
&& IsHotFixBranch;
314+
&& (IsMasterBranch || IsHotFixBranch);
272315
}

0 commit comments

Comments
 (0)