private bool InvokeNativeTool (INativeToolReporter reporter, string tool, string arguments) { var buildDir = GetNativeBuildDir (reporter); if (buildDir == null) return false; var p = new Process (); var psi = p.StartInfo; psi.UseShellExecute = false; psi.FileName = GetNativeTool (tool); psi.WorkingDirectory = buildDir; psi.Arguments = arguments; psi.RedirectStandardOutput = true; psi.RedirectStandardError = true; reporter.BeginTask (string.Format ("Invoking {0}...", tool)); reporter.WriteLine ("Command: " + psi.FileName + " " + arguments); p.Start (); TizenUtility.Copier.Start (p.StandardOutput, reporter.WriteLine); TizenUtility.Copier.Start (p.StandardError, reporter.WriteLine); p.WaitForExit (); reporter.EndTask (); if (p.ExitCode != 0) { reporter.AddError (string.Format ("{0} failed with code '{1}'", tool, p.ExitCode)); return false; } return true; }
private string GetNativeBuildDir (INativeToolReporter reporter) { var buildDir = GetProjectSubdir ("CommandLineBuild"); if (!Directory.Exists (buildDir)) { reporter.AddError (string.Format ("'{0}' is not a directory.", buildDir)); return null; } return buildDir; }