ant-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 52101] New: Could we please have ant properties in scope in javascript under <script/>
Date Thu, 27 Oct 2011 14:43:41 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=52101

             Bug #: 52101
           Summary: Could we please have ant properties in scope in
                    javascript under <script/>
           Product: Ant
           Version: 1.8.2
          Platform: PC
        OS/Version: Mac OS X 10.4
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Core tasks
        AssignedTo: notifications@ant.apache.org
        ReportedBy: bimargulies@gmail.com
    Classification: Unclassified


In my dreams, the following could just get those properties by something like:

   project.properties["status.result"];

   or even allow

   project.properties["status.result"] = "new value";

I think I know enough Rhino to even code this, if you-all are sympathetic to
the notion.



 <script language="javascript"><![CDATA[
          var fail = controlservices.createTask("fail");
          var result = project.getProperty("status.result");
      var stdout = project.getProperty("status.output");
      var statusproperty = project.getProperty("status.property");
      if (result == 1 && stdout.match(/is not running/)) {
          project.setProperty(statusproperty, "STOPPED");
          } else if (result != 0) {
         var stderr = project.getProperty("status.error");
             fail.setMessage("Failed to obtain status: " + result + "\n" +
stderr);
         fail.perform();
      } else {
         var matches = stdout.match("Java:(.*)$");
             project.setProperty(statusproperty, matches[1]);
          }
      ]]></script>

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

Mime
View raw message