Skip to content
This repository was archived by the owner on Mar 19, 2025. It is now read-only.

Commit 619b7b2

Browse files
2 parents ff61a7a + 97612a3 commit 619b7b2

File tree

1 file changed

+41
-12
lines changed

1 file changed

+41
-12
lines changed

SubPointSolutions.CakeBuildTools/Scripts/SubPointSolutions.CakeBuild.Core.cake

Lines changed: 41 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// common tooling
1+
// common tooling
22
// always version to avoid breaking change with new releases
33
#addin nuget:https://www.nuget.org/api/v2/?package=Cake.Powershell&Version=0.2.9
44
#addin nuget:https://www.nuget.org/api/v2/?package=newtonsoft.json&Version=9.0.1
@@ -189,13 +189,16 @@ string ResolveVersionForPackage(string id) {
189189
// is it choco spec?
190190
specs = jsonConfig["customChocolateySpecs"];
191191

192-
foreach(var spec in specs) {
193-
var specId = (string)spec["Id"];
192+
if(specs != null)
193+
{
194+
foreach(var spec in specs) {
195+
var specId = (string)spec["Id"];
194196

195-
if(specId == id) {
196-
return (string)spec["Version"];
197-
}
198-
}
197+
if(specId == id) {
198+
return (string)spec["Version"];
199+
}
200+
}
201+
}
199202

200203
throw new Exception(String.Format("Cannot resolve version for package:[{0}]. Neither customNuspecs nor customChocolateySpecs has it", id));
201204
}
@@ -341,6 +344,7 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
341344

342345
packSettings.Dependencies = ResolveDependenciesForPackage(packSettings.Id);
343346

347+
Verbose("Adding Authors/Owners...");
344348
if(spec["Authors"] == null)
345349
packSettings.Authors = new [] { "SubPoint Solutions" };
346350
else
@@ -351,28 +355,40 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
351355
else
352356
packSettings.Owners = spec["Owners"].Select(t => (string)t).ToArray();
353357

358+
Verbose("Adding License/ProjectUrl/IconUrl...");
354359
packSettings.LicenseUrl = new System.Uri((string)spec["LicenseUrl"]);
355360
packSettings.ProjectUrl = new System.Uri((string)spec["ProjectUrl"]);
356361
packSettings.IconUrl = new System.Uri((string)spec["IconUrl"]);
357362

363+
Verbose("Adding Description/Copyright...");
358364
packSettings.Description = (string)spec["Description"];
359365
packSettings.Copyright = (string)spec["Copyright"];
360366

367+
Verbose("Adding tags...");
361368
packSettings.Tags = spec["Tags"].Select(t => (string)t).ToArray();
362369

363370
packSettings.RequireLicenseAcceptance = false;
364371
packSettings.Symbols = false;
365372
packSettings.NoPackageAnalysis = false;
366373

367374
// files
368-
var packageFiles = spec["Files"].ToArray();
375+
var packageFilesObject = spec["Files"];
376+
377+
Verbose("Adding files...");
369378

370379
// default files
371-
if(packageFiles.Count() == 0)
380+
if(packageFilesObject == null || packageFilesObject.Select(t => t).Count() == 0)
372381
{
373-
Verbose("Adding default files - *.dll/*.xml from bin/debug");
382+
var packageFiles = packageFilesObject;
374383

384+
Verbose("Adding default files - *.dll/*.xml from bin/debug");
385+
375386
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
387+
388+
var customProjectFolder = (string)spec["CustomProjectFolder"];
389+
if(!String.IsNullOrEmpty(customProjectFolder))
390+
projectPath = System.IO.Path.Combine(defaultSolutionDirectory, customProjectFolder);
391+
376392
var projectBinPath = System.IO.Path.Combine(projectPath, "bin/debug");
377393

378394
packSettings.BasePath = projectBinPath;
@@ -389,11 +405,24 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
389405
};
390406
}
391407
else{
408+
409+
var packageFiles = packageFilesObject;
410+
392411
Verbose("Adding custom files...");
393412

394413
var nuSpecContentFiles = new List<NuSpecContent>();
395414

396-
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
415+
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
416+
417+
var customProjectFolder = (string)spec["CustomProjectFolder"];
418+
419+
if(!String.IsNullOrEmpty(customProjectFolder))
420+
projectPath = System.IO.Path.Combine(defaultSolutionDirectory, customProjectFolder);
421+
422+
Verbose("Project path: " + projectPath);
423+
424+
var projectBinPath = System.IO.Path.Combine(projectPath, "bin/debug");
425+
397426
packSettings.BasePath = projectPath;
398427

399428
foreach(var packageFile in packageFiles){
@@ -1005,4 +1034,4 @@ var taskDefaultCI = Task("Default-CI")
10051034
// the action checks if the current branch has to be published (dev always, the rest goes via 'ci.nuget.shouldpublish')
10061035
.IsDependentOn("Action-API-NuGet-Publishing")
10071036

1008-
.IsDependentOn("Action-Docs-Merge");
1037+
.IsDependentOn("Action-Docs-Merge");

0 commit comments

Comments
 (0)