private void TestPackageVersioning() { IUnpackZipToolSupport support = new UnpackZipToolTestSupport(); string version1 = TestFilesDir.GetTestPath("TestPackageVersioning.zip"); var retval = ToolInstaller.UnpackZipTool(version1, support); Assert.AreEqual(1, retval.Installations.Count); ProgramPathContainer ppc = new ProgramPathContainer("BogusProgram", "3.0.0"); var ListPackages = retval.Installations[ppc]; Assert.AreEqual(3, ListPackages.Count); Assert.AreEqual("TestPAckages", ListPackages[0].Name); Assert.AreEqual("7.3-28", ListPackages[0].Version); Assert.AreEqual("TestOtherPAckage", ListPackages[1].Name); Assert.AreEqual("3.2.3", ListPackages[1].Version); Assert.AreEqual("noVersionPackage", ListPackages[2].Name); Assert.AreEqual(null, ListPackages[2].Version); }
public override void Setup(Context context) { // Arguments context.Target = context.Argument <string>("target", "Default"); context.Configuration = context.Argument <string>("configuration", "Release"); context.ForcePublish = context.Argument <bool>("forcepublish", false); context.MyGetSource = GetEnvironmentValueOrArgument(context, "FROSTING_MYGET_SOURCE", "mygetsource"); context.MyGetApiKey = GetEnvironmentValueOrArgument(context, "FROSTING_MYGET_API_KEY", "mygetapikey"); // Directories context.Artifacts = new DirectoryPath("./artifacts"); // Build system information. var buildSystem = context.BuildSystem(); context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor; context.IsLocalBuild = buildSystem.IsLocalBuild; context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("cake-build/frosting", buildSystem.AppVeyor.Environment.Repository.Name); context.IsTagged = IsBuildTagged(buildSystem); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch); // Install tools context.Information("Installing tools..."); ToolInstaller.Install(context, "GitVersion.CommandLine", "3.6.2"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); context.Version.Version = context.Argument <string>("version", context.Version.Version); context.Version.SemVersion = context.Argument <string>("suffix", context.Version.SemVersion); // MSBuild Settings context.MSBuildSettings = new DotNetCoreMSBuildSettings() .WithProperty("Version", context.Version.SemVersion) .WithProperty("AssemblyVersion", context.Version.Version) .WithProperty("FileVersion", context.Version.Version); context.Information("Version: {0}", context.Version); context.Information("Sem version: {0}", context.Version.SemVersion); context.Information("Configuration: {0}", context.Configuration); context.Information("Target: {0}", context.Target); context.Information("AppVeyor: {0}", context.AppVeyor); }
/// <summary> /// Copy a zip file's contents to the tools folder and loop through its .properties /// files adding the tools to the tools menu. /// </summary> /// <param name="parent">Parent window for alerts and forms</param> /// <param name="fullpath">The full path to the zipped folder containing the tools</param> /// <param name="install">Installation function</param> public static void InstallZipTool(Control parent, string fullpath, InstallProgram install) { ToolInstaller.UnzipToolReturnAccumulator result = null; var toolListStart = ToolList.CopyTools(Settings.Default.ToolList); Exception xFailure = null; try { result = ToolInstaller.UnpackZipTool(fullpath, new InstallZipToolHelper(parent, install)); } catch (ToolExecutionException x) { MessageDlg.ShowException(parent, x); } catch (Exception x) { xFailure = x; } if (xFailure != null) { MessageDlg.ShowWithException(parent, TextUtil.LineSeparate(String.Format(Resources.ConfigureToolsDlg_UnpackZipTool_Failed_attempting_to_extract_the_tool_from__0_, Path.GetFileName(fullpath)), xFailure.Message), xFailure); } if (result != null) { foreach (var message in result.MessagesThrown) { MessageDlg.Show(parent, message); } } else { // If result is Null, then we want to discard changes made to the ToolsList Settings.Default.ToolList = toolListStart; } }
public override void Setup(Context context) { context.Target = context.Argument("target", "Default"); context.Configuration = context.Argument("configuration", "Release"); context.LinkSources = context.Argument("linkSources", false); context.CoreOnly = context.Argument("CoreOnly", !context.IsRunningOnWindows()); context.Artifacts = "./packaging/"; // Build system information. var buildSystem = context.BuildSystem(); context.IsLocalBuild = buildSystem.IsLocalBuild; if (context.CoreOnly && !context.IsLocalBuild) { context.Warning("CoreOnly was specified on a non-local build. Artifacts may be versioned incorrectly!"); } context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor; context.TravisCI = buildSystem.TravisCI.IsRunningOnTravisCI; context.IsTagged = IsBuildTagged(buildSystem); if (context.AppVeyor) { context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.AppVeyor.Environment.Repository.Name); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.AppVeyor.Environment.Repository.Branch); } else if (context.TravisCI) { context.IsPullRequest = !string.IsNullOrEmpty(buildSystem.TravisCI.Environment.Repository.PullRequest); context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.TravisCI.Environment.Repository.Slug); context.IsMasterBranch = StringComparer.OrdinalIgnoreCase.Equals("master", buildSystem.TravisCI.Environment.Build.Branch); } // Force publish? context.ForcePublish = context.Argument <bool>("forcepublish", false); // Setup projects. context.Projects = new Project[] { new Project { Name = "Octokit", Path = "./Octokit/Octokit.csproj", Publish = true }, new Project { Name = "Octokit.Reactive", Path = "./Octokit.Reactive/Octokit.Reactive.csproj", Publish = true }, new Project { Name = "Octokit.Tests", Path = "./Octokit.Tests/Octokit.Tests.csproj", UnitTests = true }, new Project { Name = "Octokit.Tests.Conventions", Path = "./Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj", ConventionTests = true }, new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true } }; // Install tools if (context.CoreOnly) { context.Information("Skipping tool installation for core-only build"); } else { context.Information("Installing tools..."); ToolInstaller.Install(context, "Octokit.CodeFormatter", "1.0.0-preview"); } context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.0.0", "dotnet-gitversion"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); context.Version.Prefix = context.Argument <string>("version", context.Version.Prefix); context.Version.Suffix = context.Argument <string>("suffix", context.Version.Suffix); context.Information("Version: {0}", context.Version.Prefix); context.Information("Version suffix: {0}", context.Version.Suffix); context.Information("Configuration: {0}", context.Configuration); context.Information("LinkSources: {0}", context.LinkSources); context.Information("CoreOnly: {0}", context.CoreOnly); context.Information("Target: {0}", context.Target); context.Information("AppVeyor: {0}", context.AppVeyor); context.Information("TravisCI: {0}", context.TravisCI); }
public ToolInstaller.UnzipToolReturnAccumulator UnpackZipTool(string pathToZip, IUnpackZipToolSupport unpackSupport) { return(ToolInstaller.UnpackZipTool(pathToZip, unpackSupport)); }
public override void Setup(Context context) { context.Target = context.Argument("target", "Default"); context.Configuration = context.Argument("configuration", "Release"); context.LinkSources = context.Argument("linkSources", false); context.FormatCode = context.Argument("formatCode", false); context.Artifacts = "./packaging/"; context.CodeCoverage = "./coverage-results/"; // Build system information. var buildSystem = context.BuildSystem(); context.IsLocalBuild = buildSystem.IsLocalBuild; context.GitHubActions = buildSystem.GitHubActions.IsRunningOnGitHubActions; context.AppVeyor = buildSystem.AppVeyor.IsRunningOnAppVeyor; context.IsTagged = IsBuildTagged(buildSystem); if (context.AppVeyor) { context.IsPullRequest = buildSystem.AppVeyor.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.AppVeyor.Environment.Repository.Name); context.IsMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildSystem.AppVeyor.Environment.Repository.Branch); } else if (context.GitHubActions) { context.IsPullRequest = buildSystem.GitHubActions.Environment.PullRequest.IsPullRequest; context.IsOriginalRepo = StringComparer.OrdinalIgnoreCase.Equals("octokit/octokit.net", buildSystem.GitHubActions.Environment.Workflow.Repository); context.IsMainBranch = StringComparer.OrdinalIgnoreCase.Equals("main", buildSystem.GitHubActions.Environment.Workflow.Ref); } // Force publish? context.ForcePublish = context.Argument <bool>("forcepublish", false); // Setup projects. context.Projects = new Project[] { new Project { Name = "Octokit", Path = "./Octokit/Octokit.csproj", Publish = true }, new Project { Name = "Octokit.Reactive", Path = "./Octokit.Reactive/Octokit.Reactive.csproj", Publish = true }, new Project { Name = "Octokit.Tests", Path = "./Octokit.Tests/Octokit.Tests.csproj", UnitTests = true }, new Project { Name = "Octokit.Tests.Conventions", Path = "./Octokit.Tests.Conventions/Octokit.Tests.Conventions.csproj", ConventionTests = true }, new Project { Name = "Octokit.Tests.Integration", Path = "./Octokit.Tests.Integration/Octokit.Tests.Integration.csproj", IntegrationTests = true } }; context.GitVersionToolPath = ToolInstaller.DotNetCoreToolInstall(context, "GitVersion.Tool", "5.1.3", "dotnet-gitversion"); // Calculate semantic version. context.Version = BuildVersion.Calculate(context); context.Version.Prefix = context.Argument <string>("version", context.Version.Prefix); context.Version.Suffix = context.Argument <string>("suffix", context.Version.Suffix); context.Information("Version: {0}", context.Version.Prefix); context.Information("Version suffix: {0}", context.Version.Suffix); context.Information("Configuration: {0}", context.Configuration); context.Information("LinkSources: {0}", context.LinkSources); context.Information("Target: {0}", context.Target); context.Information("AppVeyor: {0}", context.AppVeyor); context.Information("GitHub Actions: {0}", context.GitHubActions); }
private string GetTitle(string title) { return(ToolList.Any(item => Equals(item.Title, title)) ? ToolInstaller.GetUniqueName(title, value => !ToolList.Any(item => Equals(item.Title, value))) : title); }
/// <summary> /// Return a unique title for a New Tool. (eg. [New Tool1]) /// </summary> private string GetTitle() { return(ToolInstaller.GetUniqueFormat(Resources.ConfigureToolsDlg_GetTitle__New_Tool_0__, value => !ToolList.Any(item => Equals(item.Title, value)))); }