-
Notifications
You must be signed in to change notification settings - Fork 6
/
recipe.cake
69 lines (57 loc) · 2.3 KB
/
recipe.cake
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#load nuget:?package=Cake.Recipe&version=3.0.1
//*************************************************************************************************
// Settings
//*************************************************************************************************
Environment.SetVariableNames();
BuildParameters.SetParameters(
context: Context,
buildSystem: BuildSystem,
sourceDirectoryPath: "./src",
title: "Cake.Wyam.Recipe",
repositoryOwner: "cake-contrib",
repositoryName: "Cake.Wyam.Recipe",
appVeyorAccountName: "cakecontrib",
nuspecFilePath: "./Cake.Wyam.Recipe/Cake.Wyam.Recipe.nuspec",
shouldPostToGitter: false); // Disabled because it's currently failing
BuildParameters.PrintParameters(Context);
ToolSettings.SetToolSettings(context: Context);
//*************************************************************************************************
// Extensions
//*************************************************************************************************
BuildParameters.Tasks.CleanTask
.IsDependentOn("Generate-Version-File");
Task("Generate-Version-File")
.Does<BuildVersion>((context, buildVersion) => {
// Write metadata to configuration file
System.IO.File.WriteAllText(
"./Cake.Wyam.Recipe/cake-version.yml",
@"TargetCakeVersion: 2.0.0
TargetFrameworks:
- netcoreapp3.1
- net5.0
- net6.0"
);
// Write metadata to class for use when running a build
var buildMetaDataCodeGen = TransformText(@"
public class BuildMetaData
{
public static string Date { get; } = ""<%date%>"";
public static string Version { get; } = ""<%version%>"";
public static string CakeVersion { get; } = ""<%cakeversion%>"";
}",
"<%",
"%>"
)
.WithToken("date", BuildMetaData.Date)
.WithToken("version", buildVersion.SemVersion)
.WithToken("cakeversion", BuildMetaData.CakeVersion)
.ToString();
System.IO.File.WriteAllText(
"./Cake.Wyam.Recipe/Content/version.cake",
buildMetaDataCodeGen
);
});
//*************************************************************************************************
// Execution
//*************************************************************************************************
Build.RunNuGet();