Example #1
0
        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);
        }
Example #2
0
        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();
        }
        private string Args(IIntegrationResult result)
        {
            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

            builder.AppendArgument("-nologo");
            builder.AppendArgument("-NoProfile");
            builder.AppendArgument("-NonInteractive");

            builder.AppendArgument("-file");

            if (!string.IsNullOrEmpty(Script))
            {

                if (Script.IndexOf(":") == 1) //drive letter specified, so it's not a relative path
                {
                    builder.AppendArgument(@"""" + Script + @"""");
                }
                else
                {

                    if (ConfiguredScriptsDirectory.EndsWith("\\"))
                    {
                        builder.AppendArgument(@"""" + ConfiguredScriptsDirectory + Script + @"""");
                    }
                    else
                    {
                        builder.AppendArgument(@"""" + ConfiguredScriptsDirectory + "\\" + Script + @"""");
                    }
                }
            }


            if (!string.IsNullOrEmpty(BuildArgs)) builder.AppendArgument(BuildArgs);

            return builder.ToString();
        }
Example #4
0
 private string BuildPushProcessArgs()
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument("push");
     return buffer.ToString();
 }
Example #5
0
 private string BuildCloneToArguments()
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument("clone");
     buffer.AppendArgument(".");
     buffer.AppendArgument(CloneTo);
     return buffer.ToString();
 }
Example #6
0
 //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();
 }
Example #7
0
 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();
 }
Example #8
0
        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>
        /// Retrieve the arguments
        /// </summary>
        /// <param name="result">The result to use.</param>
        /// <returns>The arguments to pass to the process.</returns>
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            var buffer = new ProcessArgumentBuilder();
            buffer.AppendIf(this.Recurse, "-r");
            buffer.AppendArgument("-t" + this.Threshold.ToString(CultureInfo.CurrentCulture));
            buffer.AppendArgument("-w" + this.Width.ToString(CultureInfo.CurrentCulture));
            buffer.AppendArgument("-oConsole");

            // Add the focus
            if (!string.IsNullOrEmpty(this.Focus))
            {
                buffer.AppendArgument("-f" + this.QuoteSpaces(this.Focus));
            }

            // Add the lines to exclude
            foreach (var line in this.LinesToExclude ?? new string[0])
            {
                buffer.AppendArgument("-x" + this.QuoteSpaces(line));
            }

            // Add the lines to exclude
            foreach (var line in this.FilesToExclude ?? new string[0])
            {
                buffer.AppendArgument("-e" + this.QuoteSpaces(line));
            }

            buffer.AppendArgument(this.FileMask);
            return buffer.ToString();
        }
Example #10
0
 // cvs [-d :ext:mycvsserver:/cvsroot/myrepo] -q log -N "-d>2004-12-24 12:00:00 GMT" -rmy_branch (with branch)
 // cvs [-d :ext:mycvsserver:/cvsroot/myrepo] -q log -Nb "-d>2004-12-24 12:00:00 GMT" (without branch)
 //        public const string HISTORY_COMMAND_FORMAT = @"{0}-q log -N{3} ""-d>{1}""{2}";		// -N means 'do not show tags'
 private string BuildLogProcessInfoArgs(DateTime from)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     AppendCvsRoot(buffer);
     buffer.AddArgument("-q"); // quiet
     buffer.AddArgument("rlog");
     buffer.AddArgument("-N"); // do not show tags
     buffer.AppendIf(SuppressRevisionHeader, "-S");
     if (string.IsNullOrEmpty(Branch))
     {
         buffer.AddArgument("-b"); // only list revisions on HEAD
     }
     else
     {
         buffer.AppendArgument("-r{0}", Branch); // list revisions on branch
     }
     buffer.AppendArgument(@"""-d>{0}""", FormatCommandDate(from));
     if (!string.IsNullOrEmpty(RestrictLogins))
     {
         foreach (string login in RestrictLogins.Split(','))
         {
             buffer.AppendArgument("-w{0}", login.Trim());
         }
     }
     buffer.AddArgument(Module);
     return buffer.ToString();
 }
Example #11
0
		private void CreateAssemblyList(ProcessArgumentBuilder buffer)
		{
			if (string.IsNullOrEmpty(AssemblyListFile) && (Assemblies == null || Assemblies.Length == 0))
				throw new ConfigurationException("[GendarmeTask] Neither 'assemblyListFile' nor 'assemblies' are specified. Please specify one of them.");

			// append the assembly list file if set
			if (!string.IsNullOrEmpty(AssemblyListFile))
				buffer.AppendArgument(string.Concat("@", StringUtil.AutoDoubleQuoteString(AssemblyListFile)));

			// build the assembly list by the assembly match collection
			foreach (AssemblyMatch asm in Assemblies)
				buffer.AppendArgument(asm.Expression);
		}
Example #12
0
        /// <summary>
        /// Gets the process arguments.	
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        /// <remarks></remarks>
		protected override string GetProcessArguments(IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AppendIf(!string.IsNullOrEmpty(ConfigFile), "--config {0}", StringUtil.AutoDoubleQuoteString(ConfigFile));
			buffer.AppendIf(!string.IsNullOrEmpty(RuleSet), "--set {0}", RuleSet);
			buffer.AppendIf(!string.IsNullOrEmpty(IgnoreFile), "--ignore {0}", StringUtil.AutoDoubleQuoteString(IgnoreFile));
			buffer.AppendIf(Limit > 0, "--limit {0}", Limit.ToString(CultureInfo.CurrentCulture));
			buffer.AppendIf(!string.IsNullOrEmpty(Severity), "--severity {0}", Severity);
			buffer.AppendIf(!string.IsNullOrEmpty(Confidence), "--confidence {0}", Confidence);
			buffer.AppendIf(Quiet, "--quiet");
			buffer.AppendIf(Verbose, "--verbose");

			// append output xml file
			buffer.AppendArgument("--xml {0}", StringUtil.AutoDoubleQuoteString(GetGendarmeOutputFile(result)));

			// append assembly list or list file
			CreateAssemblyList(buffer);

			return buffer.ToString();
		}
 /// <summary>
 /// Gets the process arguments.
 /// </summary>
 /// <param name="result">The result.</param>
 /// <returns></returns>
 protected override string GetProcessArguments(IIntegrationResult result)
 {
     var builder = new ProcessArgumentBuilder();
     builder.Append("\"" + this.fileToValidate + "\"");
     builder.AppendArgument("-n");
     builder.AppendArgument("-f=x");
     builder.AppendArgument("-l=\"{0}\"", this.validationLogFile);
     return builder.ToString();
 }
Example #14
0
 private void AppendBuildArguments(ProcessArgumentBuilder buffer)
 {
     var args = System.Text.RegularExpressions.Regex.Split(BuildArgs, @"\n");
     foreach (string t in args)
     {
         if (!string.IsNullOrEmpty(t.Trim())) buffer.AppendArgument(t);
     }
 }
		private string CreateHistoryArguments(string fromDate)
		{
			ProcessArgumentBuilder builder = new ProcessArgumentBuilder();
			builder.AppendArgument("lshist -r -nco");
			builder.AppendIf(Branch != null, "-branch \"{0}\"", Branch);
			builder.AppendArgument("-since {0}", fromDate);
			builder.AppendArgument("-fmt \"%u{0}%Vd{0}%En{0}%Vn{0}%o{0}!%l{0}!%a{0}%Nc", ClearCaseHistoryParser.DELIMITER);
			builder.Append(ClearCaseHistoryParser.END_OF_LINE_DELIMITER + "\\n\"");
			builder.AppendArgument("\"{0}\"", ViewPath);
			return builder.ToString();
		}
        /// <summary>
        /// Retrieve the arguments
        /// </summary>
        /// <param name="result"></param>
        /// <returns></returns>
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
            var coverageFile = string.IsNullOrEmpty(CoverageFile) ? "coverage.xml" : CoverageFile;
            buffer.AppendArgument(RootPath(coverageFile, true));

            // Add all the NCover arguments
            buffer.AppendIf(ClearCoverageFilters, "//ccf");
            foreach (var filter in CoverageFilters ?? new CoverageFilter[0])
            {
                buffer.AppendArgument("//cf {0}", filter.ToParamString());
            }
            foreach (var threshold in MinimumThresholds ?? new CoverageThreshold[0])
            {
                buffer.AppendArgument("//mc {0}", threshold.ToParamString());
            }
            buffer.AppendIf(UseMinimumCoverage, "//mcsc");
            buffer.AppendIf(XmlReportFilter != NCoverReportFilter.Default, "//rdf {0}", XmlReportFilter.ToString());
            foreach (var threshold in SatisfactoryThresholds ?? new CoverageThreshold[0])
            {
                buffer.AppendArgument("//sct {0}", threshold.ToParamString());
            }
            buffer.AppendIf(NumberToReport > 0, "//smf {0}", NumberToReport.ToString());
            buffer.AppendIf(!string.IsNullOrEmpty(TrendOutputFile), "//at \"{0}\"", RootPath(TrendOutputFile, false));
            buffer.AppendArgument("//bi \"{0}\"", string.IsNullOrEmpty(BuildId) ? result.Label : BuildId);
            buffer.AppendIf(!string.IsNullOrEmpty(HideElements), "//hi \"{0}\"", HideElements);
            buffer.AppendIf(!string.IsNullOrEmpty(TrendInputFile), "//lt \"{0}\"", RootPath(TrendInputFile, false));
            GenerateReportList(buffer);
            buffer.AppendIf(!string.IsNullOrEmpty(ProjectName), "//p \"{0}\"", ProjectName);
            buffer.AppendIf(SortBy != NCoverSortBy.None, "//so \"{0}\"", SortBy.ToString());
            buffer.AppendIf(TopUncoveredAmount > 0, "//tu \"{0}\"", TopUncoveredAmount.ToString());
            buffer.AppendIf(MergeMode != NCoverMergeMode.Default, "//mfm \"{0}\"", MergeMode.ToString());
            buffer.AppendIf(!string.IsNullOrEmpty(MergeFile), "//s \"{0}\"", RootPath(MergeFile, false));
            buffer.AppendIf(!string.IsNullOrEmpty(WorkingDirectory), "//w \"{0}\"", RootPath(WorkingDirectory, false));

            return buffer.ToString();
        }
 /// <summary>
 /// Generate the list of reports to generate.
 /// </summary>
 /// <param name="buffer"></param>
 private void GenerateReportList(ProcessArgumentBuilder buffer)
 {
     var reportList = new List<NCoverReportType>();
     if ((Reports != null) && (Reports.Length > 0))
     {
         reportList.AddRange(Reports);
     }
     else
     {
         reportList.Add(NCoverReportType.FullCoverageReport);
     }
     foreach (var report in reportList)
     {
         var path = OutputDir;
         if (report == NCoverReportType.FullCoverageReport)
         {
             path = RootPath(path, false);
         }
         else
         {
             path = RootPath(string.Format("{0}.html", report), false);
         }
         buffer.AppendArgument("//or \"{0}\"", string.Format("{0}:Html:{1}", report, path));
     }
 }
Example #18
0
        private ProcessInfo NewGetSourceProcessInfo(IIntegrationResult result)
        {
            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();
            AppendCvsRoot(builder);
            builder.AppendArgument("-q update -d -P"); // build directories, prune empty directories
            builder.AppendIf(CleanCopy, "-C");
            builder.AddArgument("-r", Branch);

            return NewProcessInfoWithArgs(result, builder.ToString());
        }
Example #19
0
        protected override string GetProcessArguments(IIntegrationResult result)
        {
            ProcessArgumentBuilder args = new ProcessArgumentBuilder();
            args.AddArgument("--rakefile", Rakefile);

            if (Silent)
                args.AddArgument("--silent");
            else if (Quiet)
                args.AddArgument("--quiet");

            if (Trace)
                args.AddArgument("--trace");

            args.AppendArgument(BuildArgs);

            foreach (string t in Targets)
                args.AppendArgument(t);

            return args.ToString();
        }
Example #20
0
 private ProcessInfo NewLabelProcessInfo(IIntegrationResult result)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     AppendCvsRoot(buffer);
     buffer.AppendArgument(string.Format("tag {0}{1}", TagPrefix, ConvertIllegalCharactersInLabel(result)));
     return NewProcessInfoWithArgs(result, buffer.ToString());
 }
Example #21
0
 //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();
 }
Example #22
0
        /// <summary>
        /// Gets the process arguments.	
        /// </summary>
        /// <param name="result">The result.</param>
        /// <returns></returns>
        /// <remarks></remarks>
		protected override string GetProcessArguments(IIntegrationResult result)
		{
			ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
			buffer.AppendIf(NoLogo, "-nologo");
			buffer.AppendArgument(@"-buildfile:{0}", StringUtil.AutoDoubleQuoteString(BuildFile));
			buffer.AppendArgument("-logger:{0}", Logger);
			buffer.AppendArgument("-logfile:{0}", StringUtil.AutoDoubleQuoteString(GetNantOutputFile(result)));
			buffer.AppendArgument("-listener:{0}", Listener);
			buffer.AppendArgument(BuildArgs);
			AppendIntegrationResultProperties(buffer, result);
			AppendTargets(buffer);
			return buffer.ToString();
		}
Example #23
0
 //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();
 }
Example #24
0
		private void AppendTargets(ProcessArgumentBuilder buffer)
		{
			foreach(string t in Targets)
			{
				buffer.AppendArgument(t);
			}
		}
Example #25
0
 //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();
 }
Example #26
0
 /// <summary>
 /// Gets the process arguments.	
 /// </summary>
 /// <param name="result">The result.</param>
 /// <returns></returns>
 /// <remarks></remarks>
 protected override string GetProcessArguments(IIntegrationResult result)
 {
     var buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument(StringUtil.AutoDoubleQuoteString(BuildFile));
     buffer.AppendArgument("logfile={0}", StringUtil.AutoDoubleQuoteString(GetFakeOutputFile(result)));
     AppendIntegrationResultProperties(buffer, result);
     return buffer.ToString();
 }
Example #27
0
 private string BuildHistoryProcessArgs()
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument("changes");
     buffer.AppendArgument("-R");
     if (FileHistory)
         buffer.AppendArgument("-v");
     return buffer.ToString();
 }
Example #28
0
 private static void AppendIntegrationResultProperties(ProcessArgumentBuilder buffer, IIntegrationResult result)
 {
     // We have to sort this alphabetically, else the unit tests
     // that expect args in a certain order are unpredictable
     IDictionary properties = result.IntegrationProperties;
     foreach (string key in properties.Keys)
     {
         object value = result.IntegrationProperties[key];
         if (value != null)
             buffer.AppendArgument(string.Format(System.Globalization.CultureInfo.CurrentCulture,"{0}={1}", key, StringUtil.AutoDoubleQuoteString(StringUtil.RemoveTrailingPathDelimeter(StringUtil.IntegrationPropertyToString(value)))));
     }
 }
Example #29
0
 private string BuildTagProcessArgs(string label)
 {
     ProcessArgumentBuilder buffer = new ProcessArgumentBuilder();
     buffer.AppendArgument("tag");
     buffer.AppendArgument(label);
     return buffer.ToString();
 }
Example #30
0
        private string Args(IIntegrationResult result)
        {
            ProcessArgumentBuilder builder = new ProcessArgumentBuilder();

            if (!string.IsNullOrEmpty(Script))
            {
                if (ConfiguredScriptsDirectory.EndsWith("\\"))
                {
                    builder.AppendArgument(ConfiguredScriptsDirectory + Script);
                }
                else
                {
                    builder.AppendArgument(ConfiguredScriptsDirectory + "\\" + Script);
                }
            }

            if (!string.IsNullOrEmpty(BuildArgs)) builder.AppendArgument(BuildArgs);
            return builder.ToString();
        }