using Cake.Common.IO; using Cake.Common.IO.Paths; using Cake.Core; using Cake.Core.IO; using Cake.Frosting; namespace Build; public class BuildContext : FrostingContext { /// /// Base source directory /// public DirectoryPath BaseSourceLocation { get; set; } /// /// Powershell module project folder /// public ConvertableDirectoryPath PowershellModuleProjectDirectory { get; set; } /// /// Powershell module csproj location /// public ConvertableFilePath PowershellModuleCsproj { get; set; } /// /// Output directory for built DLLs and powershell module manifest files /// public ConvertableDirectoryPath PowershellModuleOutputDir { get; set; } /// /// Path to powershell script that creates the module manifest files /// public ConvertableFilePath CreateModuleManifestScript { get; set; } /// /// Suffix to tag the build with, defaults to pre-release. /// /// Immediately follows the version number and before the commit hash. /// /// public string BuildSuffix { get; set; } /// /// Disable the commit hash from being added /// public bool DisableCommitHash { get; set; } public BuildContext(ICakeContext context) : base(context) { BaseSourceLocation = context.Directory("../src").Path.MakeAbsolute(context.Environment); PowershellModuleProjectDirectory = BaseSourceLocation + context.Directory("PowershellModule"); PowershellModuleCsproj = PowershellModuleProjectDirectory + context.File("PowershellModule.csproj"); PowershellModuleOutputDir = context.Directory("../") + context.Directory("output") + context.Directory("PowershellModule"); var buildScriptDirectory = context.Directory("./Scripts"); CreateModuleManifestScript = buildScriptDirectory + context.File("CreateModuleManifest.ps1"); BuildSuffix = context.Configuration.GetValue(nameof(BuildSuffix)) ?? "pre-release"; DisableCommitHash = context.Configuration.GetBoolValue(nameof(DisableCommitHash)); } }