I wrote a small build/rebuild/clean functionality for the Introjucer (currently only for VS, but XCode has also the ability for command-line operations )
This tool dramatically speed up things, if you setup something with the introjucer, you don’t have to open the IDE everytime you change something
Next step would be, to jump from the compiler errors directly into the introjucer-text-editor, and voila introjucer feels like a real IDE
Any chance to see something like this in the introjucer?
[attachment=0]introide.png[/attachment]
( compiler-Exe and SolutionFile/Configration are hardcoded, but they could be extracted from the jucer-Project)
class CBuilder : public Component, public Button::Listener, public Timer
{
public:
CBuilder()
: buildButton("Build"), rebuildButton("Rebuild"), cleanButton("Clean"), cancelButton("Cancel")
{
addAndMakeVisible(&buildButton); buildButton.addListener(this);
addAndMakeVisible(&rebuildButton); rebuildButton.addListener(this);
addAndMakeVisible(&cleanButton); cleanButton.addListener(this);
addAndMakeVisible(&cancelButton); cancelButton.addListener(this);
addAndMakeVisible(&statusLine);
addAndMakeVisible(&outputLog);
outputLog.setMultiLine(true,false);
startTimer(500);
outLogStream=new MemoryOutputStream();
};
virtual ~CBuilder()
{
};
void resized()
{
buildButton.setBounds(10,10,80,20);
rebuildButton.setBounds(100,10,80,20);
cleanButton.setBounds(190,10,80,20);
cancelButton.setBounds(280,10,80,20);
statusLine.setBounds(10,40,getWidth()-20,20);
outputLog.setBounds(0,70,getWidth(),getHeight()-70);
};
void buttonClicked(Button* button)
{
// Hard Coded
String compileExe("C:\\Program Files\\Microsoft Visual Studio 9.0\\Common7\\IDE\\devenv.exe");
String solutionFile("C:\\Your Solution File.sln");
String buildConfiguration("Release|Win32");
if (button==&buildButton)
{
clearOutput();
compilerProcess.start("\""+compileExe+"\" \""+solutionFile+"\" /build \""+buildConfiguration+"\" /Out \""+tempFile.getFile().getFullPathName()+"\"");
} else
if (button==&rebuildButton)
{
clearOutput();
compilerProcess.start("\""+compileExe+"\" \""+solutionFile+"\" /rebuild \""+buildConfiguration+"\" /Out \""+tempFile.getFile().getFullPathName()+"\"");
} else
if (button==&cleanButton)
{
clearOutput();
compilerProcess.start("\""+compileExe+"\" \""+solutionFile+"\" /Clean \""+buildConfiguration+"\" /Out \""+tempFile.getFile().getFullPathName()+"\"");
} else
if (button==&cancelButton)
{
jassertfalse;
// not implemented
// sending Ctrl+C or kill the the compilerProcess
}
};
void clearOutput()
{
outLogStream=new MemoryOutputStream();
outputLog.clear();
tempFile.deleteTemporaryFile();
}
void timerCallback()
{
String status;
if (compilerProcess.isRunning())
{
status="Compiler running...";
};
statusLine.setText(status,false);
for (;;)
{
char buffer [512];
const int num = compilerProcess.readProcessOutput (buffer, sizeof (buffer));
if (num <= 0)
break;
outLogStream->write (buffer, num);
};
// not very efficient + just proof-of-concept
outputLog.setText("\nOutputProcess\n"+outLogStream->toString()
+"\nOutputLog\n"+tempFile.getFile().loadFileAsString());
};
private:
ChildProcess compilerProcess;
TextButton buildButton;
TextButton rebuildButton;
TextButton cleanButton;
TextButton cancelButton;
TextEditor outputLog;
Label statusLine;
ScopedPointer<MemoryOutputStream> outLogStream;
TemporaryFile tempFile;
};
class CBuilderWindow : public DocumentWindow
{
public:
CBuilderWindow() : DocumentWindow("Build",Colours::white,DocumentWindow::allButtons,true)
{
setContentOwned(new CBuilder(),false);
};
virtual ~CBuilderWindow()
{
};
};