ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Ludwig <mil...@gmx.de>
Subject Re: Setting multiple outputproperties
Date Wed, 23 Jun 2010 11:01:53 GMT
Lewis Tsao schrieb am 23.06.2010 um 08:18 (+0000):

> In one of my build setups, I need to run a program first which
> produces some output. From this output I need to get multiple pieces
> of information to be used in later build steps:
> 
> For example:
> 
> <execute step1prog ...../>
> 
> step1prog produces lines of the form
> 
> something
> blah blah info1 blah blah
> more blah...
> di blah di blah info2 di blah
> more something
> 
> later on in my build steps I will need to do somelike
> 
> <execute step2prog -Dxxx=info1>
> 
> <execute step3prog -Dyyy=info2>
> 
> Is there a clever way of doing this, short of sending output from
> step1prog to a file and parsing the file twice to get the 2 pieces of
> info.

At any rate, you should be able to do it in one pass.

> I still have to learn how to tease info1 and info2 out of the output
> yet, but that's another story.

On the contrary, I think this is what this is all about. Can you modify
step1prog to output relevant information in a structured manner, such as
to a property file, or to XML?

If not, you could try some regex hacking such as in this example:

<project>
  <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
  <exec executable="ipconfig" outputproperty="ipconfig-out"/>
  <propertyregex property="ip-number" input="${ipconfig-out}"
    regexp="\d+\.\d+\.\d+\.\d+" select="\0" global="yes" />
  <echo message="${ip-number}"/>
</project>

But <propertyregex> does not appear to support multiple matches, so this
is not exactly an elegant solution.

-- 
Michael Ludwig

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message