/// ------------------------------------------------------------------------------------ /// <summary> /// Runs Nant. /// </summary> /// <param name="cmdLine">The CMD line.</param> /// ------------------------------------------------------------------------------------ public void RunNant(string cmdLine) { try { string buildFile = string.Empty; string fwroot = string.Empty; RetrieveBuildFile(DTE.Solution.FullName, out buildFile, out fwroot); cmdLine = string.Format("-nologo -e+ -buildfile:\"{0}\" {1}", buildFile, cmdLine); string workingDir = Path.GetFullPath(Path.GetDirectoryName(buildFile)); StartBuild(string.Format("------ Build started: {0} ------\n", cmdLine)); OutputBuild.Activate(); m_nantRunner = new NantRunner(NAnt, cmdLine, workingDir, new AddinLogListener(this, false), new NantRunner.BuildStatusHandler(BuildStatusChange)); m_nantRunner.Run(); } catch (ThreadAbortException) { throw; } catch (Exception e) { if (m_nantRunner != null && m_nantRunner.IsRunning) { m_nantRunner.Abort(); } OutputBuild.Write("\nINTERNAL ERROR\n\t"); OutputBuild.WriteLine(e.Message); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Runs Nant. /// </summary> /// <param name="cmdLine">The CMD line.</param> /// ------------------------------------------------------------------------------------ public void RunNant(string cmdLine) { try { string buildFile = string.Empty; string fwroot = string.Empty; RetrieveBuildFile(DTE.Solution.FullName, out buildFile, out fwroot); cmdLine = string.Format("-nologo -e+ -buildfile:\"{0}\" {1}", buildFile, cmdLine); string workingDir = Path.GetFullPath(Path.GetDirectoryName(buildFile)); StartBuild(string.Format("------ Build started: {0} ------\n", cmdLine)); OutputBuild.Activate(); m_nantRunner = new NantRunner(NAnt, cmdLine, workingDir, new AddinLogListener(this, false), new NantRunner.BuildStatusHandler(BuildStatusChange)); m_nantRunner.Run(); } catch(ThreadAbortException) { throw; } catch (Exception e) { if (m_nantRunner != null && m_nantRunner.IsRunning) m_nantRunner.Abort(); OutputBuild.Write("\nINTERNAL ERROR\n\t"); OutputBuild.WriteLine(e.Message); } }
/// ------------------------------------------------------------------------------------ /// <summary> /// Perform the build with NAnt /// </summary> /// <param name="projectName">Name(s) of the target</param> /// <param name="config">Configuration (Debug/Release...)</param> /// <param name="fRebuild"><c>true</c> to perform a rebuild</param> /// <param name="projectPath">Full path to the project</param> /// <param name="fWait"><c>true</c> to wait for the build to finish</param> /// <returns><c>true</c> if the build was successful</returns> /// <exception cref="TargetException">If target doesn't exist, so that a NAnt build /// can't be performed.</exception> /// ------------------------------------------------------------------------------------ private bool InternalBuildProject(Modifiers mods, string projectName, string config, bool fRebuild, string projectPath, bool fWait) { try { string buildFile = string.Empty; string fwroot = string.Empty; RetrieveBuildFile(projectPath, out buildFile, out fwroot); FindTarget(ref buildFile, ref projectName, fwroot, projectPath); m_buildFile = buildFile; //string cmdLine = string.Format("-buildfile:\"c:\\fwtexp\\bin\\FieldWorks.build\" VSCompile -D:sln=\"{0}\"", string action; if (mods.fClean) { action = "clean"; } else if (mods.fTest) { if (mods.fForceTests) { action = "forcetests test"; } else { action = "test"; } } else { action = "buildtest"; } string cmdLine = string.Format( "-e+ -nologo -buildfile:\"{0}\" {1} {2} {3}", buildFile, action, config, projectName); string workingDirectory = Path.GetFullPath(Path.GetDirectoryName(buildFile)); OutputBuild.Activate(); m_nantRunner = new NantRunner(NAnt, cmdLine, workingDirectory, new AddinLogListener(this, false), new NantRunner.BuildStatusHandler(BuildStatusChange)); if (fWait) { if (m_nantRunner.RunSync() != 0) { return(false); } } else { m_nantRunner.Run(); } } catch (TargetException) { throw; } catch (ThreadAbortException) { throw; } catch (Exception e) { if (m_nantRunner != null && m_nantRunner.IsRunning) { m_nantRunner.Abort(); } OutputBuild.Write("\nINTERNAL ERROR\n\t"); OutputBuild.WriteLine(e.Message); return(false); } return(true); }
/// ------------------------------------------------------------------------------------ /// <summary> /// Perform the build with NAnt /// </summary> /// <param name="projectName">Name(s) of the target</param> /// <param name="config">Configuration (Debug/Release...)</param> /// <param name="fRebuild"><c>true</c> to perform a rebuild</param> /// <param name="projectPath">Full path to the project</param> /// <param name="fWait"><c>true</c> to wait for the build to finish</param> /// <returns><c>true</c> if the build was successful</returns> /// <exception cref="TargetException">If target doesn't exist, so that a NAnt build /// can't be performed.</exception> /// ------------------------------------------------------------------------------------ private bool InternalBuildProject(Modifiers mods, string projectName, string config, bool fRebuild, string projectPath, bool fWait) { try { string buildFile = string.Empty; string fwroot = string.Empty; RetrieveBuildFile(projectPath, out buildFile, out fwroot); FindTarget(ref buildFile, ref projectName, fwroot, projectPath); m_buildFile = buildFile; //string cmdLine = string.Format("-buildfile:\"c:\\fwtexp\\bin\\FieldWorks.build\" VSCompile -D:sln=\"{0}\"", string action; if (mods.fClean) action = "clean"; else if (mods.fTest) { if (mods.fForceTests) action = "forcetests test"; else action = "test"; } else action = "buildtest"; string cmdLine = string.Format( "-e+ -nologo -buildfile:\"{0}\" {1} {2} {3}", buildFile, action, config, projectName); string workingDirectory = Path.GetFullPath(Path.GetDirectoryName(buildFile)); OutputBuild.Activate(); m_nantRunner = new NantRunner(NAnt, cmdLine, workingDirectory, new AddinLogListener(this, false), new NantRunner.BuildStatusHandler(BuildStatusChange)); if (fWait) { if (m_nantRunner.RunSync() != 0) { return false; } } else m_nantRunner.Run(); } catch(TargetException) { throw; } catch(ThreadAbortException) { throw; } catch (Exception e) { if (m_nantRunner != null && m_nantRunner.IsRunning) m_nantRunner.Abort(); OutputBuild.Write("\nINTERNAL ERROR\n\t"); OutputBuild.WriteLine(e.Message); return false; } return true; }