private string GetLoggerArgs(IIntegrationResult result) { ProcessArgumentBuilder builder = new ProcessArgumentBuilder(); builder.Append("/l:"); builder.Append(Logger); builder.Append(";"); builder.Append(MsBuildOutputFile(result)); return builder.ToString(); }
public static ProcessResult RunSvnProcess(SvnOptions svnLoginOptions, ProcessArgumentBuilder argBuilder) { argBuilder.AddArgument("--non-interactive"); argBuilder.AddArgument("--no-auth-cache"); ProcessInfo info = new ProcessInfo("svn.exe", argBuilder.ToString()); ProcessExecutor executor = new ProcessExecutor(); ProcessResult result = executor.Execute(info); return result; }
public override string ToString() { ProcessArgumentBuilder argsBuilder = new ProcessArgumentBuilder(); argsBuilder.AddArgument("/xml", "=", outputfile); argsBuilder.AddArgument("/nologo"); foreach (string assemblyName in assemblies) { argsBuilder.AddArgument(assemblyName); } return argsBuilder.ToString(); }
/// <summary> /// Appends the categories, with value not an empty string nor a whitespace, /// to the excluded or included categories lists. /// </summary> /// <param name="argsBuilder">The args builder.</param> private void AppendCategoriesArg(ProcessArgumentBuilder argsBuilder) { if (ExcludedCategories != null && ExcludedCategories.Length != 0) { string[] excludedCategories = System.Array.FindAll(ExcludedCategories, IsNotWhitespace); argsBuilder.AddArgument("/exclude", "=", string.Join(",", excludedCategories)); } if (IncludedCategories != null && IncludedCategories.Length != 0) { string[] includedCategories = System.Array.FindAll(IncludedCategories, IsNotWhitespace); argsBuilder.AddArgument("/include", "=", string.Join(",", includedCategories)); } }
private string Args(IIntegrationResult result) { ProcessArgumentBuilder builder = new ProcessArgumentBuilder(); builder.AddArgument("/nologo"); if (! StringUtil.IsBlank(Targets)) builder.AddArgument("/t:" + Targets); builder.AddArgument(GetPropertyArgs(result)); builder.AppendArgument(BuildArgs); builder.AddArgument(ProjectFile); builder.AddArgument(GetLoggerArgs(result)); return builder.ToString(); }
public static int GetSvnRevision(SvnOptions svnOptions) { ProcessArgumentBuilder argBuilder = new ProcessArgumentBuilder(); argBuilder.AppendArgument("log"); argBuilder.AppendArgument("--xml"); argBuilder.AppendArgument("--limit 1"); argBuilder.AddArgument(StringHelper.Quote(svnOptions.Url)); ProcessResult result = RunSvnProcess(svnOptions, argBuilder); XmlDocument xml = new XmlDocument(); xml.LoadXml(result.StandardOutput); XmlNode node = xml.SelectSingleNode("/log/logentry/@revision"); return Convert.ToInt32(node.InnerText); }
private string BuildPushProcessArgs() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("push"); return buffer.ToString(); }
private string BuildGetSourceArguments() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.Append("pull"); return buffer.ToString(); }
private void RemoveReadOnlyAttribute() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("-R"); buffer.AddArgument("/s", SandboxRoot + "\\*"); Execute(new ProcessInfo("attrib", buffer.ToString())); }
//RESYNC_TEMPLATE = "resync --overwriteChanged --restoreTimestamp-R -S {SandboxRoot\SandboxFile} --user={user} --password={password} --quiet" private string BuildResyncCommand() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("resync"); buffer.AppendArgument("--overwriteChanged"); buffer.AppendArgument("--restoreTimestamp"); buffer.AppendArgument("--forceConfirm=yes"); buffer.AppendArgument("--includeDropped"); AppendCommonArguments(buffer, true); return buffer.ToString(); }
private string BuildDisconnectCommand() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("disconnect"); buffer.AppendArgument("--user={0}", User); buffer.AppendArgument("--password={0}", Password); buffer.AppendArgument("--quiet"); buffer.AppendArgument("--forceConfirm=yes"); return buffer.ToString(); }
private void AppendCommonArguments(ProcessArgumentBuilder buffer, bool recurse, bool omitSandbox) { if (recurse) { buffer.AppendArgument("-R"); } if (!omitSandbox) { buffer.AddArgument("-S", Path.Combine(SandboxRoot, SandboxFile)); } buffer.AppendArgument("--user={0}", User); buffer.AppendArgument("--password={0}", Password); buffer.AppendArgument("--quiet"); }
/// <summary> /// Call "git config --get 'name'" to get the value of a local repository property. /// The command returns error code 1 if the key was not found and error code 2 if multiple key values were found. /// </summary> /// <param name="name">Name of the config parameter.</param> /// <param name="result">IIntegrationResult of the current build.</param> /// <returns>Result of the "git config --get 'name'" command.</returns> private string GitConfigGet(string name, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("config"); buffer.AddArgument("--get"); buffer.AddArgument(name); return Execute(NewProcessInfo(buffer.ToString(), result, ProcessPriorityClass.Normal, new int[] {0, 1, 2})). StandardOutput.Trim(); }
/// <summary> /// Call "git config 'name' 'value'" to set local repository properties. /// </summary> /// <param name="name">Name of the config parameter.</param> /// <param name="value">Value of the config parameter.</param> /// <param name="result">IIntegrationResult of the current build.</param> private void GitConfigSet(string name, string value, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("config"); buffer.AddArgument(name); buffer.AddArgument(value); Execute(NewProcessInfo(buffer.ToString(), result)); }
/// <summary> /// Clone a repository into a new directory with "git clone 'repository' 'working directory'". /// </summary> /// <param name="result">IIntegrationResult of the current build.</param> private void GitClone(IIntegrationResult result) { string wd = BaseWorkingDirectory(result); ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("clone"); buffer.AddArgument(Repository); buffer.AddArgument(wd); // initialize progress information var bpi = GetBuildProgressInformation(result); bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString())); // enable Stdout monitoring ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput; ProcessInfo pi = NewProcessInfo(buffer.ToString(), result); // Use upper level of the working directory, because the // working directory currently does not exist and // will be created by "git clone". "git clone" will fail if // the working directory already exist. pi.WorkingDirectory = Path.GetDirectoryName(wd.Trim().TrimEnd(Path.DirectorySeparatorChar)); Execute(pi); // remove Stdout monitoring ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput; }
/// <summary> /// Updates and fetches git submodules. /// </summary> /// <param name="result"></param> private void GitUpdateSubmodules(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("submodule"); buffer.AddArgument("update"); // initialize progress information var bpi = GetBuildProgressInformation(result); bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString())); // enable Stdout monitoring ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput; Execute(NewProcessInfo(buffer.ToString(), result)); // remove Stdout monitoring ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput; }
private void AppendCommonArguments(ProcessArgumentBuilder buffer, bool recurse) { AppendCommonArguments(buffer, recurse, false); }
/// <summary> /// Checkout a remote branch or revision with the "git checkout -q -f 'origin/branchName'" or "git checkout -q -f 'revision'" command. /// </summary> /// <param name="branchOrRevision">Name of the branch to checkout.</param> /// <param name="result">IIntegrationResult of the current build.</param> private void GitCheckoutRemoteBranch(string branchOrRevision, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("checkout"); buffer.AddArgument("-q"); buffer.AddArgument("-f"); buffer.AddArgument(branchOrRevision); // initialize progress information var bpi = GetBuildProgressInformation(result); bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString())); // enable Stdout monitoring ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput; Execute(NewProcessInfo(buffer.ToString(), result)); // remove Stdout monitoring ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput; }
//CHECKPOINT_TEMPLATE = "checkpoint -d "Cruise Control.Net Build -{lebel}" -L "CCNET Build - {lebel}" -R -S {SandboxRoot\SandboxFile} --user={user} --password={password} --quiet" private string BuildCheckpointCommand(string label) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("checkpoint"); buffer.AppendArgument("-d \"Cruise Control.Net Build - {0}\"", label); buffer.AppendArgument("-L \"Build - {0}\"", label); AppendCommonArguments(buffer, true); return buffer.ToString(); }
/// <summary> /// Clean the working tree with "git clean -d -f -x". /// </summary> /// <param name="result">IIntegrationResult of the current build.</param> private void GitClean(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("clean"); buffer.AddArgument("-d"); buffer.AddArgument("-f"); buffer.AddArgument("-x"); Execute(NewProcessInfo(buffer.ToString(), result)); }
//MEMBER_INFO_TEMPLATE = "memberinfo -S {SandboxRoot\SandboxFile} --user={user} --password={password} {member}" private string BuildMemberInfoCommandXml(Modification modification) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("memberinfo --xmlapi"); AppendCommonArguments(buffer, false, true); string modificationPath = (modification.FolderName == null) ? SandboxRoot : Path.Combine(SandboxRoot, modification.FolderName); buffer.AddArgument(Path.Combine(modificationPath, modification.FileName)); return buffer.ToString(); }
/// <summary> /// Automatically stage files that have been modified and deleted /// and commit them with the "git commit --all --allow-empty -m 'message'" /// command. /// </summary> /// <param name="commitMessage">Commit message.</param> /// <param name="result">IIntegrationResult of the current build.</param> private void GitCommitAll(string commitMessage, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("commit"); buffer.AddArgument("--all"); buffer.AddArgument("--allow-empty"); buffer.AddArgument("-m", commitMessage); Execute(NewProcessInfo(buffer.ToString(), result)); }
//VIEEWSANDBOX_TEMPLATE = "viewsandbox -R {SandboxRoot\SandboxFile} --user={user} --password={password} --quiet --xmlapi" private string BuildSandboxModsCommand() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("viewsandbox --nopersist --filter=changed:all --xmlapi"); AppendCommonArguments(buffer, true); return buffer.ToString(); }
/// <summary> /// Add all modified and all untracked files that are not ignored by .gitignore /// to the git index with the "git add --all" command. /// </summary> /// <param name="result">IIntegrationResult of the current build.</param> private void GitAddAll(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("add"); buffer.AddArgument("--all"); Execute(NewProcessInfo(buffer.ToString(), result)); }
private string BuildCloneToArguments() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("clone"); buffer.AppendArgument("."); buffer.AppendArgument(CloneTo); return buffer.ToString(); }
/// <summary> /// Create a unsigned tag with "git tag -a -m 'message' 'tag name'". /// </summary> /// <param name="tagName">Name of the tag.</param> /// <param name="tagMessage">Tag commit message.</param> /// <param name="result">IIntegrationResult of the current build.</param> private void GitCreateTag(string tagName, string tagMessage, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("tag"); buffer.AddArgument("-a"); buffer.AddArgument("-m", tagMessage); buffer.AddArgument(tagName); Execute(NewProcessInfo(buffer.ToString(), result)); }
private string BuildHistoryProcessArgs() { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("changes"); buffer.AppendArgument("-R"); if (FileHistory) buffer.AppendArgument("-v"); return buffer.ToString(); }
/// <summary> /// Push a specific tag with "git push origin tag 'tag name'". /// </summary> /// <param name="tagName">Naem of the tag to push.</param> /// <param name="result">IIntegrationResult of the current build.</param> private void GitPushTag(string tagName, IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("push"); buffer.AddArgument("origin"); buffer.AddArgument("tag"); buffer.AddArgument(tagName); // initialize progress information var bpi = GetBuildProgressInformation(result); bpi.SignalStartRunTask(string.Concat("git ", buffer.ToString())); // enable Stdout monitoring ProcessExecutor.ProcessOutput += ProcessExecutor_ProcessOutput; Execute(NewProcessInfo(buffer.ToString(), result)); // remove Stdout monitoring ProcessExecutor.ProcessOutput -= ProcessExecutor_ProcessOutput; }
private string BuildTagProcessArgs(string label) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AppendArgument("tag"); buffer.AppendArgument(label); return buffer.ToString(); }
/// <summary> /// Initialize the git submodules. /// </summary> /// <param name="result">IIntegrationResult of the current build.</param> private void GitInitSubmodules(IIntegrationResult result) { ProcessArgumentBuilder buffer = new ProcessArgumentBuilder(); buffer.AddArgument("submodule"); buffer.AddArgument("init"); Execute(NewProcessInfo(buffer.ToString(), result)); }