// header - edit "Data/yourScriptHeader" to customize
// contents - edit "EventHandlers/Script file/onCreate" to customize
//
function DoCommand()
{
var project = getCurrentProject();
if (project != null)
{
var resOutput = getOutput("Results");
resOutput.clear();
var gOutput = getOutput("Build");
gOutput.clear();
saveAll();
var antUtilities = getScriptObject("\\Ant\\antUtilities");
var buildFileString = antUtilities.GetDefaultBuildFileAsString(project);
if (buildFileString == null || buildFileString == "")
{
alert("No default build file set! See \"Ant\\Select Default Build File\" in the menu.");
return;
}
var target = antUtilities.GetDefaultBuildTargetAsString(project, buildFileString);
if (target == null)
{
target = "";
}
if (target == "<default>")
{
target = "";
}
else
{
var defIndex = target.indexOf("<default>");
if (defIndex != -1)
{
alert("The target \"<default>\" is not allowed in a multi-target set. You need to change the default target for this build file. Stopping the build.");
gOutput.writeLine("Build stopped due to configuration problems.");
return;
}
}
var helperMap = getMapFile("ApplicationHelpers");
var antDirectory = helperMap.lookup("ant-dir", "");
if (antDirectory == "")
{
alert("Ant root directory not set! See \"Ant\\Select Ant Directory\" in the menu.");
return;
}
var antCommand = antDirectory + "\\bin\\ant.bat";
antCommand += " -buildfile " + buildFileString;
antCommand += " " + target;
gOutput.writeLine("Building...");
var runbatch = File.getApplicationPath() + "\\Ide\\Programs\\runbatch.exe";
var myTool = newTool(gOutput);
myTool.async = true;
var myCommand = runbatch + " " + antCommand;
gOutput.writeLine("Command Line: " + myCommand);
var exitStatus = myTool.run(myCommand);
// Application.showOutputPanel(true);
}
else
{
alert("You can not build without an open project.");