public AssemblyInfoParserFixture(string version = "1.2.3.4", string fileVersion = "4.3.2.1", string informationalVersion = "4.2.3.1", bool createAssemblyInfo = true) { FileSystem = new FakeFileSystem(false); Environment = Substitute.For <ICakeEnvironment>(); Environment.WorkingDirectory.Returns("/Working"); if (createAssemblyInfo) { // Set the versions. var settings = new AssemblyInfoSettings(); if (version != null) { settings.Version = version; } if (fileVersion != null) { settings.FileVersion = fileVersion; } if (informationalVersion != null) { settings.InformationalVersion = informationalVersion; } // Create the assembly info. var creator = new AssemblyInfoCreator(FileSystem, Environment, Substitute.For <ICakeLog>()); creator.Create("./output.cs", settings); } }
private void CreateAssemblyInfoOnDisk(FilePath path) { var settings = new AssemblyInfoSettings(); settings.CLSCompliant = ClsCompliant; settings.ComVisible = ComVisible; if (Company != null) { settings.Company = Company; } if (Configuration != null) { settings.Configuration = Configuration; } if (Copyright != null) { settings.Copyright = Copyright; } if (Description != null) { settings.Description = Description; } if (FileVersion != null) { settings.FileVersion = FileVersion; } if (Guid != null) { settings.Guid = Guid; } if (InformationalVersion != null) { settings.InformationalVersion = InformationalVersion; } if (InternalsVisibleTo != null) { settings.InternalsVisibleTo = InternalsVisibleTo; } if (Product != null) { settings.Product = Product; } if (Title != null) { settings.Title = Title; } if (Trademark != null) { settings.Trademark = Trademark; } if (Version != null) { settings.Version = Version; } var creator = new AssemblyInfoCreator(FileSystem, Environment, Substitute.For <ICakeLog>()); creator.Create(path, settings); }
public static Version ParseAndUpdateVersion( this ICakeContext context, FilePath pathToFile, AssemblyInfoSettings assemblyInfoSettings = null, DotNetCoreMSBuildSettings dotNetCoreMSBuildSettings = null, NuGetPackSettings nuGetPackSettings = null, ReleaseNotesSettings releaseNotesSettings = null) { var version = context.ParseVersionFrom(pathToFile); if (!(assemblyInfoSettings is null)) { context.UpdateAssemblyInfoVersion(version, assemblyInfoSettings); } if (!(dotNetCoreMSBuildSettings is null)) { context.UpdateDotNetCoreBuildVersion(version, dotNetCoreMSBuildSettings); } if (!(nuGetPackSettings is null)) { context.UpdateNuGetPackVersion(version, nuGetPackSettings); } if (!(releaseNotesSettings is null)) { context.UpdateReleaseNotesVersion(version, releaseNotesSettings); } return(version); }
public AssemblyInfoFixture() { FileSystem = new FakeFileSystem(false); Environment = Substitute.For <ICakeEnvironment>(); Environment.WorkingDirectory.Returns(new DirectoryPath("/Working")); Log = Substitute.For <ICakeLog>(); Settings = new AssemblyInfoSettings(); Path = "AssemblyInfo.cs"; }
public AssemblyInfoFixture_VB() { Environment = Substitute.For <ICakeEnvironment>(); Environment.WorkingDirectory.Returns(new DirectoryPath("/Working")); FileSystem = new FakeFileSystem(Environment); FileSystem.CreateDirectory(Environment.WorkingDirectory); Log = Substitute.For <ICakeLog>(); Settings = new AssemblyInfoSettings(); Path = "AssemblyInfo.vb"; }
public override void Run(BuildContext context) { var assemblyInfoParseResult = context.ParseAssemblyInfo(BuildContext.AssemblyInfoPath); var settings = new AssemblyInfoSettings() { Product = assemblyInfoParseResult.Product, Company = assemblyInfoParseResult.Company, Trademark = assemblyInfoParseResult.Trademark, Copyright = $"© {DateTime.Today.Year} Insire", InternalsVisibleTo = assemblyInfoParseResult.InternalsVisibleTo, MetaDataAttributes = new[] { new AssemblyInfoMetadataAttribute() { Key = "Platform", Value = BuildContext.Platform, }, new AssemblyInfoMetadataAttribute() { Key = "CompileDate", Value = "[UTC]" + DateTime.UtcNow.ToString(), }, new AssemblyInfoMetadataAttribute() { Key = "PublicRelease", Value = context.IsPublicRelease.ToString(), }, new AssemblyInfoMetadataAttribute() { Key = "Branch", Value = context.Branch, }, new AssemblyInfoMetadataAttribute() { Key = "Commit", Value = context.GitVersion.GitCommitId, }, new AssemblyInfoMetadataAttribute() { Key = "Version", Value = context.GitVersion.SemVer2, }, } }; context.CreateAssemblyInfo(new FilePath(BuildContext.AssemblyInfoPath), settings); }
public static void UpdateAssemblyInfoVersion( this ICakeContext context, Version version, AssemblyInfoSettings settings) { if (settings is null) { throw new ArgumentNullException(nameof(settings)); } settings.Version = version.ToString(); settings.FileVersion = version.ToString(); settings.InformationalVersion = version.ToString(); }
public AssemblyInfoParserFixture(bool clsCompliant = false, string company = "Company", bool comVisible = false, string configuration = "Debug", string copyright = "Copyright 2015", string description = "Description", string fileVersion = "4.3.2.1", string guid = "ABCEDF", string informationalVersion = "4.2.3.1", string internalsVisibleTo = "Cake.Common.Test", string product = "Cake", string title = "Cake", string trademark = "Trademark", string version = "1.2.3.4", bool createAssemblyInfo = true) { Environment = Substitute.For <ICakeEnvironment>(); Environment.WorkingDirectory.Returns("/Working"); FileSystem = new FakeFileSystem(Environment); FileSystem.CreateDirectory(Environment.WorkingDirectory); if (createAssemblyInfo) { // Set the versions. var settings = new AssemblyInfoSettings(); settings.CLSCompliant = clsCompliant; if (company != null) { settings.Company = company; } settings.ComVisible = comVisible; if (configuration != null) { settings.Configuration = configuration; } if (copyright != null) { settings.Copyright = copyright; } if (description != null) { settings.Description = description; } if (fileVersion != null) { settings.FileVersion = fileVersion; } if (guid != null) { settings.Guid = guid; } if (informationalVersion != null) { settings.InformationalVersion = informationalVersion; } if (internalsVisibleTo != null) { settings.InternalsVisibleTo = new List <string>() { internalsVisibleTo }; } if (product != null) { settings.Product = product; } if (title != null) { settings.Title = title; } if (trademark != null) { settings.Trademark = trademark; } if (version != null) { settings.Version = version; } // Create the assembly info. var creator = new AssemblyInfoCreator(FileSystem, Environment, Substitute.For <ICakeLog>()); creator.Create("./output.cs", settings); } }