private String invokeWorkflow(IBuildDetail BuildDetail, String SonarRunnerPath = null, String LocalSolutionPath = null, bool GeneratePropertiesIfMissing = false, String TemplatePropertiesPath = null, bool FailBuildOnError = true, bool FailBuildOnAlert = false, String RunnerCmdFile = "fake-runner.cmd", StringList SonarProperties = null, String BinariesDirectory = "BinDir") { // Default values that work if (SonarRunnerPath == null) SonarRunnerPath = Path.Combine(TestContext.DeploymentDirectory, RunnerCmdFile); if (LocalSolutionPath == null) LocalSolutionPath = Path.Combine(TestContext.DeploymentDirectory, "Dummy.sln"); if (TemplatePropertiesPath == null) TemplatePropertiesPath = Path.Combine(TestContext.DeploymentDirectory, "sonar-properties.template"); ShimWorkspace workpace = new ShimWorkspace() { GetLocalItemForServerItemString = (s) => LocalSolutionPath }; // constants (literals) var activity = new Sonar { SonarRunnerPath = SonarRunnerPath, FailBuildOnError = FailBuildOnError, GeneratePropertiesIfMissing = GeneratePropertiesIfMissing, SonarPropertiesTemplatePath = TemplatePropertiesPath, FailBuildOnAlert = FailBuildOnAlert, BinariesDirectory = BinariesDirectory }; // object variables var parameters = new Dictionary<string, object> { { "BuildWorkspace", workpace.Instance }, { "ProjectsToAnalyze", new StringList("dummy.sln") } }; if (SonarProperties == null) SonarProperties = new StringList(); if (SonarProperties != null) parameters.Add("SonarProperties", SonarProperties); var workflowLogger = new BuildMessageTrackingParticipant(); // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(activity); invoker.Extensions.Add(BuildDetail); invoker.Extensions.Add(workflowLogger); invoker.Invoke(parameters); return workflowLogger.ToString(); }
private String invokeWorkflow(IBuildDetail BuildDetail, String SonarRunnerPath = null, String LocalSolutionPath = null, bool GeneratePropertiesIfMissing = false, String TemplatePropertiesPath = null, bool FailBuildOnError = true, bool FailBuildOnAlert = false, String RunnerCmdFile = "fake-runner.cmd", StringList SonarProperties = null, String BinariesDirectory = "BinDir") { // Default values that work if (SonarRunnerPath == null) { SonarRunnerPath = Path.Combine(TestContext.DeploymentDirectory, RunnerCmdFile); } if (LocalSolutionPath == null) { LocalSolutionPath = Path.Combine(TestContext.DeploymentDirectory, "Dummy.sln"); } if (TemplatePropertiesPath == null) { TemplatePropertiesPath = Path.Combine(TestContext.DeploymentDirectory, "sonar-properties.template"); } ShimWorkspace workpace = new ShimWorkspace() { GetLocalItemForServerItemString = (s) => LocalSolutionPath }; // constants (literals) var activity = new Sonar { SonarRunnerPath = SonarRunnerPath, FailBuildOnError = FailBuildOnError, GeneratePropertiesIfMissing = GeneratePropertiesIfMissing, SonarPropertiesTemplatePath = TemplatePropertiesPath, FailBuildOnAlert = FailBuildOnAlert, BinariesDirectory = BinariesDirectory }; // object variables var parameters = new Dictionary <string, object> { { "BuildWorkspace", workpace.Instance }, { "ProjectsToAnalyze", new StringList("dummy.sln") } }; if (SonarProperties == null) { SonarProperties = new StringList(); } if (SonarProperties != null) { parameters.Add("SonarProperties", SonarProperties); } var workflowLogger = new BuildMessageTrackingParticipant(); // Create a WorkflowInvoker and add the IBuildDetail Extension WorkflowInvoker invoker = new WorkflowInvoker(activity); invoker.Extensions.Add(BuildDetail); invoker.Extensions.Add(workflowLogger); invoker.Invoke(parameters); return(workflowLogger.ToString()); }