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

Commit 0536974

Browse files
+ improved nuspec files section
1 parent f4c6954 commit 0536974

File tree

3 files changed

+69
-17
lines changed

3 files changed

+69
-17
lines changed

Build/build.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,22 @@
3030
"Copyright": "Copyright 2016",
3131
"Tags": [
3232

33+
],
34+
35+
"Files": [
36+
{
37+
"Target": "lib/net45",
38+
"TargetFiles": [
39+
"bin/debug/SubPointSolutions.CakeBuildTools.dll",
40+
"bin/debug/SubPointSolutions.CakeBuildTools.xml"
41+
]
42+
},
43+
{
44+
"Target": "scripts",
45+
"TargetFiles": [
46+
"bin/debug/scripts/SubPointSolutions.CakeBuild.Core.cake"
47+
]
48+
}
3349
]
3450
}
3551
],

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

Lines changed: 47 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -364,21 +364,53 @@ NuGetPackSettings[] ResolveNuGetPackSettings() {
364364
packSettings.Symbols = false;
365365
packSettings.NoPackageAnalysis = false;
366366

367-
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
368-
var projectBinPath = System.IO.Path.Combine(projectPath, "bin/debug");
369-
370-
packSettings.BasePath = projectBinPath;
371-
372-
packSettings.Files = new [] {
373-
new NuSpecContent {
374-
Source = packSettings.Id + ".dll",
375-
Target = "lib/net45"
376-
},
377-
new NuSpecContent {
378-
Source = packSettings.Id + ".xml",
379-
Target = "lib/net45"
380-
}
381-
};
367+
// files
368+
var packageFiles = spec["Files"].ToArray();
369+
370+
// default files
371+
if(packageFiles.Count() == 0)
372+
{
373+
Verbose("Adding default files - *.dll/*.xml from bin/debug");
374+
375+
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
376+
var projectBinPath = System.IO.Path.Combine(projectPath, "bin/debug");
377+
378+
packSettings.BasePath = projectBinPath;
379+
380+
packSettings.Files = new [] {
381+
new NuSpecContent {
382+
Source = packSettings.Id + ".dll",
383+
Target = "lib/net45"
384+
},
385+
new NuSpecContent {
386+
Source = packSettings.Id + ".xml",
387+
Target = "lib/net45"
388+
}
389+
};
390+
}
391+
else{
392+
Verbose("Adding custom files...");
393+
394+
var nuSpecContentFiles = new List<NuSpecContent>();
395+
396+
var projectPath = System.IO.Path.Combine(defaultSolutionDirectory, packSettings.Id);
397+
packSettings.BasePath = projectPath;
398+
399+
foreach(var packageFile in packageFiles){
400+
401+
var target = (string)packageFile["Target"];
402+
403+
foreach(var srcFile in packageFile["TargetFiles"].Select(t => (string)t).ToArray())
404+
{
405+
nuSpecContentFiles.Add( new NuSpecContent {
406+
Source = srcFile,
407+
Target = target
408+
});
409+
}
410+
}
411+
412+
packSettings.Files = nuSpecContentFiles.ToArray();
413+
}
382414

383415
packSettings.OutputDirectory = new DirectoryPath(defaultNuGetPackagesDirectory);
384416

SubPointSolutions.CakeBuildTools/SubPointSolutions.CakeBuildTools.csproj

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,12 @@
4343
<Compile Include="Properties\AssemblyInfo.cs" />
4444
</ItemGroup>
4545
<ItemGroup>
46-
<None Include="Scripts\build-template.json" />
47-
<None Include="Scripts\SubPointSolutions.CakeBuild.Core.cake" />
46+
<None Include="Scripts\build-template.json">
47+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
48+
</None>
49+
<None Include="Scripts\SubPointSolutions.CakeBuild.Core.cake">
50+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
51+
</None>
4852
</ItemGroup>
4953
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
5054
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.

0 commit comments

Comments
 (0)