public static API_MSBuild waitForBuildCompletion(this API_MSBuild msBuild) { if (msBuild.MSBuild_Process.notNull()) { msBuild.MSBuild_Process.WaitForExit(); msBuild.BuildDuration = msBuild.BuildStartTime - DateTime.Now; } return(msBuild); }
public static bool build_Ok(this API_MSBuild msBuild, string compilationTarget) { msBuild.build(compilationTarget) .waitForBuildCompletion(); var buildResult = msBuild.ConsoleOut.str().contains("Build succeeded."); if (buildResult) { "[API_MSBuild] Project build OK: {0}".debug(compilationTarget); } else { "[API_MSBuild] Project Failed to build: {0}".error(compilationTarget); } return(buildResult); }
public static API_MSBuild build(this API_MSBuild msBuild, string compilationTarget) { msBuild.CompilationTarget = compilationTarget; if (compilationTarget.fileExists()) { var arguments = "\"{0}\" {1}".format(msBuild.CompilationTarget, msBuild.ExtraBuildArguments); if (msBuild.PlatformTarget.valid()) { arguments += " /p:PlatformTarget=\"{0}\"".format(msBuild.PlatformTarget); } msBuild.ConsoleOut = new StringBuilder(); msBuild.BuildStartTime = DateTime.Now; msBuild.MSBuild_Process = msBuild.MSBuild_Exe.startProcess(arguments, msBuild.OnConsoleOut); } else { "[API_MSBuild] in build, provided compilationTarget file doesn't exists: {0}".error(compilationTarget); } return(msBuild); }
public API_MSBuild_Gui buildGui(Panel _topPanel) { topPanel = _topPanel; msBuild = new API_MSBuild(); buildEnabled = true; consoleOut_TextArea = topPanel.insert_Right(300).add_GroupBox("Console Out details").add_TextArea_With_SearchPanel().wordWrap(false); tableList = topPanel.clear().add_TableList("VisualStudio MSBuild results"); tableList.add_Columns("Project", "Path", "Status", "Time", "Console Out"); startBuild = (pathToProject) => { var buildStatus = "SKIPPED"; var buildResult = false; if (buildEnabled) { buildResult = msBuild.build_Ok(pathToProject); buildStatus = buildResult ? "OK" : "FAILED"; } else { "buildEnabled was set to false, so skipping build for: {0}".error(pathToProject); msBuild.ConsoleOut = new StringBuilder(); } tableList.add_ListViewItem( pathToProject.fileName(), pathToProject, buildStatus, msBuild.BuildDuration.timeSpan_ToString(), msBuild.ConsoleOut.str()) .foreColor(buildResult, Color.Green, Color.Red); }; tableList.afterSelect_get_Cell(4, (value)=>consoleOut_TextArea.set_Text(value)); buildEnabled_CheckBox = tableList.insert_Below(50,"Config") .add_CheckBox("Build Enabled",3,0,(value) => buildEnabled = value).check(); //currentTarget_TextBox = buildEnabled_CheckBox.append_Label("Current Target").top(8).autoSize().append_TextBox("").width(300); status_Label = buildEnabled_CheckBox.append_Label("...").autoSize().top(8); tableList.add_ContextMenu() .add_MenuItem("Recompile project" , true , ()=>{ startBuild(tableList.selected().values().second()); }) .add_MenuItem("Open Project folder" , true, ()=>{ tableList.selected().values() .second() .directoryName() .startProcess(); }) .add_MenuItem("Clear table" , ()=> tableList.clearRows() ); //tableList.onDoubleClick_get_Row((row)=> buildProject(row.values().second())); tableList.columns_Width(200,200,50, 100,-2); buildProjects = (fileOrFolder, onBuildComplete)=> { //currentTarget_TextBox.set_Text(fileOrFolder); O2Thread.mtaThread( ()=>{ var start = DateTime.Now; tableList.listView().backColor(Color.Azure); "Loading file(s) from: {0}".info(fileOrFolder); if (fileOrFolder.fileExists()) { status_Label.set_Text("[1/1] Building: {0}".format(fileOrFolder.fileName())); startBuild(fileOrFolder); } else { var files = fileOrFolder.csproj_Files(); "Found {0} csproj files to process: {0}".debug(files.size()); var processed = 1; foreach(var file in files) { status_Label.set_Text("[{0}/{1}] Building: {2}".format(processed ++, files.size(), file.fileName())); startBuild(file); } } status_Label.set_Text("Build complete"); tableList.listView().backColor(Color.White); "Build Projects action was completed in: {0}".info(start.timeSpan_ToString()); onBuildComplete(); }); }; tableList.listView().onDrop((fileOrFolder)=> buildProjects(fileOrFolder, ()=>{})); return this; }
public static API_MSBuild build(this API_MSBuild msBuild) { return(msBuild.build(msBuild.CompilationTarget)); }
public static API_MSBuild start(this API_MSBuild msBuild) { return(msBuild.build()); }
public API_MSBuild_Gui buildGui(Panel _topPanel) { topPanel = _topPanel; msBuild = new API_MSBuild(); buildEnabled = true; consoleOut_TextArea = topPanel.insert_Right(300).add_GroupBox("Console Out details").add_TextArea_With_SearchPanel().wordWrap(false); tableList = topPanel.clear().add_TableList("VisualStudio MSBuild results"); tableList.add_Columns("Project", "Path", "Status", "Time", "Console Out"); startBuild = (pathToProject) => { var buildStatus = "SKIPPED"; var buildResult = false; if (buildEnabled) { buildResult = msBuild.build_Ok(pathToProject); buildStatus = buildResult ? "OK" : "FAILED"; } else { "buildEnabled was set to false, so skipping build for: {0}".error(pathToProject); msBuild.ConsoleOut = new StringBuilder(); } tableList.add_ListViewItem(pathToProject.fileName(), pathToProject, buildStatus, msBuild.BuildDuration.timeSpan_ToString(), msBuild.ConsoleOut.str()) .foreColor(buildResult, Color.Green, Color.Red); }; tableList.afterSelect_get_Cell(4, (value) => consoleOut_TextArea.set_Text(value)); buildEnabled_CheckBox = tableList.insert_Below(50, "Config") .add_CheckBox("Build Enabled", 3, 0, (value) => buildEnabled = value).check(); //currentTarget_TextBox = buildEnabled_CheckBox.append_Label("Current Target").top(8).autoSize().append_TextBox("").width(300); status_Label = buildEnabled_CheckBox.append_Label("...").autoSize().top(8); tableList.add_ContextMenu() .add_MenuItem("Recompile project", true, () => { startBuild(tableList.selected().values().second()); }) .add_MenuItem("Open Project folder", true, () => { tableList.selected().values() .second() .directoryName() .startProcess(); }) .add_MenuItem("Clear table", () => tableList.clearRows()); //tableList.onDoubleClick_get_Row((row)=> buildProject(row.values().second())); tableList.columns_Width(200, 200, 50, 100, -2); buildProjects = (fileOrFolder, onBuildComplete) => { //currentTarget_TextBox.set_Text(fileOrFolder); O2Thread.mtaThread( () => { var start = DateTime.Now; tableList.listView().backColor(Color.Azure); "Loading file(s) from: {0}".info(fileOrFolder); if (fileOrFolder.fileExists()) { status_Label.set_Text("[1/1] Building: {0}".format(fileOrFolder.fileName())); startBuild(fileOrFolder); } else { var files = fileOrFolder.csproj_Files(); "Found {0} csproj files to process: {0}".debug(files.size()); var processed = 1; foreach (var file in files) { status_Label.set_Text("[{0}/{1}] Building: {2}".format(processed++, files.size(), file.fileName())); startBuild(file); } } status_Label.set_Text("Build complete"); tableList.listView().backColor(Color.White); "Build Projects action was completed in: {0}".info(start.timeSpan_ToString()); onBuildComplete(); }); }; tableList.listView().onDrop((fileOrFolder) => buildProjects(fileOrFolder, () => {})); return(this); }