public static SemanticVersion GenerateVersion(IPackageDescriptor descriptor, IFile versionFile) { var ver = versionFile.Exists ? versionFile.ReadLines().First() : descriptor.SemanticVersion.ToString(); var lastBuildFile = versionFile.Parent.GetDirectory("wraps") .GetDirectory("_cache") .GetFile("_lastBuild"); var builder = new SemanticVersionGenerator( ver, () => lastBuildFile.Exists ? lastBuildFile.ReadString() : "-1", lastBuildFile.WriteString); return builder.Version(); }
// TODO: Issue with not using the correct IFile when building -from public static SemanticVersion GenerateVersion(IPackageDescriptor descriptor, IFile versionFile, Func<string> incrementalReader = null, Action<string> incrementalWriter = null) { var ver = versionFile.Exists ? versionFile.ReadLines().First() : (descriptor.SemanticVersion != null ? descriptor.SemanticVersion.ToString() : descriptor.Version.ToString()); var lastBuildFile = versionFile.Parent.GetDirectory("wraps") .GetDirectory("_cache") .GetFile("_lastBuild"); var builder = new SemanticVersionGenerator( ver, incrementalReader ?? (() => lastBuildFile.Exists ? lastBuildFile.ReadString() : "-1"), incrementalWriter ?? lastBuildFile.WriteString); return builder.Version(); }
// TODO: Issue with not using the correct IFile when building -from public static SemanticVersion GenerateVersion(IPackageDescriptor descriptor, IFile versionFile, Func <string> incrementalReader = null, Action <string> incrementalWriter = null) { var ver = versionFile.Exists ? versionFile.ReadLines().First() : (descriptor.SemanticVersion != null ? descriptor.SemanticVersion.ToString() : descriptor.Version.ToString()); var lastBuildFile = versionFile.Parent.GetDirectory("wraps") .GetDirectory("_cache") .GetFile("_lastBuild"); var builder = new SemanticVersionGenerator( ver, incrementalReader ?? (() => lastBuildFile.Exists ? lastBuildFile.ReadString() : "-1"), incrementalWriter ?? lastBuildFile.WriteString); return(builder.Version()); }