home *** CD-ROM | disk | FTP | other *** search
/ io Programmo 67 / IOPROG_67A.ISO / soft / Tools / mwsppv4.exe / ANTBUILD.SCRIPT < prev    next >
Encoding:
Text File  |  2002-11-25  |  2.1 KB  |  88 lines

  1. !!Script
  2.  
  3. //
  4. // header - edit "Data/yourScriptHeader" to customize
  5. // contents - edit "EventHandlers/Script file/onCreate" to customize
  6. //
  7. function DoCommand()
  8. {
  9.     var project = getCurrentProject();
  10.     if (project != null)
  11.     {
  12.         var resOutput = getOutput("Results");
  13.         resOutput.clear();
  14.         
  15.         var gOutput = getOutput("Build");
  16.         gOutput.clear();
  17.         
  18.         saveAll();
  19.         
  20.         var antUtilities = getScriptObject("\\Ant\\antUtilities");
  21.         var buildFileString = antUtilities.GetDefaultBuildFileAsString(project);
  22.         
  23.         if (buildFileString == null || buildFileString == "")
  24.         {
  25.             alert("No default build file set! See \"Ant\\Select Default Build File\" in the menu.");
  26.             return;
  27.         }
  28.         
  29.         var target = antUtilities.GetDefaultBuildTargetAsString(project, buildFileString);
  30.         
  31.         if (target == null)
  32.         {
  33.             target = "";
  34.         }
  35.         
  36.         if (target == "<default>")
  37.         {
  38.             target = "";
  39.         }
  40.         else
  41.         {
  42.             var defIndex = target.indexOf("<default>");
  43.             if (defIndex != -1)
  44.             {
  45.                 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.");
  46.                 gOutput.writeLine("Build stopped due to configuration problems.");
  47.                 
  48.                 return;
  49.             }
  50.         }
  51.         
  52.         var helperMap = getMapFile("ApplicationHelpers");
  53.         var antDirectory = helperMap.lookup("ant-dir", "");
  54.         
  55.         if (antDirectory == "")
  56.         {
  57.             alert("Ant root directory not set! See \"Ant\\Select Ant Directory\" in the menu.");
  58.             return;
  59.         }
  60.         
  61.         var antCommand = antDirectory + "\\bin\\ant.bat";
  62.         antCommand += " -buildfile " + buildFileString;
  63.         antCommand += " " + target;
  64.         
  65.         gOutput.writeLine("Building...");
  66.         
  67.         var runbatch = File.getApplicationPath() + "\\Ide\\Programs\\runbatch.exe";
  68.         
  69.         var myTool = newTool(gOutput);
  70.         myTool.async = true;
  71.         
  72.         var myCommand = runbatch + " " + antCommand;
  73.         
  74.         gOutput.writeLine("Command Line: " + myCommand);
  75.         
  76.         var exitStatus = myTool.run(myCommand);
  77.         //  Application.showOutputPanel(true);
  78.         
  79.     }
  80.     else
  81.     {
  82.         alert("You can not build without an open project.");
  83.     }
  84. }
  85.  
  86. !!/Script
  87.  
  88.