public BuildProject ( string fileName, string args, string workDirectory, string &err, string &time ) : string | ||
fileName | string | 隐式运行的文件名 |
args | string | 执行的语句 |
workDirectory | string | 工程工作路径 |
err | string | |
time | string | |
Résultat | string |
/// <summary> /// 执行编译程序 /// </summary> /// <param name="buildcommand">编译语句</param> /// <param name="workdirectory">程序工作路径</param> /// <param name="buildResult">记录程序运行的结果</param> /// <param name="err">输出错误信息</param> /// <returns>程序编译结果的日志</returns> public string Build(string buildcommand, string workdirectory, out string buildResult,out string err,out string time) { Tools tools = new Tools(); string args = "/C" + " " + buildcommand; string filename = "cmd.exe"; string buildLog = ""; buildLog = tools.BuildProject(filename, args, workdirectory, out err,out time); try { if (buildLog.Contains("BUILD SUCCESSFUL") || buildLog.Contains("已成功生成") || buildLog.Contains("build succeed")) { buildResult = "successful"; } else { buildResult = "failed"; } return buildLog; } catch(Exception ex) { buildResult = "failed"; buildLog = ex.Message; return buildLog; } }
/// <summary> /// 执行检出操作 /// </summary> /// <param name="repositoryPath">svn服务器路径</param> /// <param name="workDirectory">工程本地工作路径</param> /// <param name="svnPath">本地svn路径</param> /// <param name="checkResult">检出操作的结果</param> /// <returns>返回检出操作的日志</returns> public string CheckOut(string repositoryPath,string workDirectory,out string checkResult,string xmlConfigPath) { string err; string time; XmlDao xmlDao = new XmlDao(); XmlNodeList xmlNodeList=xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath); string svnPath=xmlNodeList[0].InnerText; using (SvnClient client = new SvnClient()) { Tools tools = new Tools(); string checkOutLog = ""; try { client.CheckOut(new Uri(repositoryPath), workDirectory); string args = "checkout " + repositoryPath + " " + workDirectory; checkOutLog = tools.BuildProject(svnPath, args, null, out err, out time); checkResult = "successful"; return checkOutLog; } catch (Exception ex) { checkResult = " failed"; checkOutLog = ex.Message; return checkOutLog; } } }
/// <summary> /// 执行清理操作 /// </summary> /// <param name="workingDirectory">工程本地工作路径</param> /// <param name="svnPath">svn程序的路径</param> /// <param name="cleanResult">清理操作的结果</param> /// <returns>返回清理操作的日志</returns> public string CleanUp(string workingDirectory, string svnPath, out string cleanResult) { string err; string time; Tools tools = new Tools(); string cleanLog = ""; try { string args = "cleanup" + " " + workingDirectory; cleanLog = tools.BuildProject(svnPath, args, null,out err,out time); cleanResult = "successful"; return cleanLog; } catch (Exception ex) { cleanResult = "failed"; cleanLog = ex.Message; return cleanLog; } }
/// <summary> /// 执行更新操作 /// </summary> /// <param name="workDirectory">工程本地工作路径</param> /// <param name="svnPath">svn程序的路径</param> /// <param name="updateResult">更新操作的结果</param> /// <returns>返回更新操作的日志</returns> public string Update(string workDirectory,out string updateResult,string xmlConfigPath) { string err; string time; Tools tools = new Tools(); XmlDao xmlDao = new XmlDao(); XmlNodeList xmlNodeList = xmlDao.XmlQuery("config/preferences/SvnPath", xmlConfigPath); string svnPath = xmlNodeList[0].InnerText; string updateLog = ""; try { string args = "update --accept tf" + " " + workDirectory; updateLog = tools.BuildProject(svnPath, args, null, out err, out time); updateResult = "successful"; return updateLog; } catch (Exception ex) { updateResult = "failed"; updateLog = ex.Message; return updateLog; } }