Bruce Leggett wrote:

It would be nice if call target could accept parameters. Also if you could
specify a file the target is located in then there would be increased
encapsulation. Then code would be easier to maintain. Also if the target
could return a value. If there is something like this already then let me
know.

Example:
<property name="BuildReturnValue" />
<call target="build" fromfile="BuildTarget.build" return="BuildReturnValue">
        <parameter name="strSolutionFile" value="MySolution.sln">
</call>

<ifnot test=${BuildReturnValue= 'true'}>
        ...
</ifnot>

BuildTarget.build file contents:
<!-- maybe not have the project for root element? -->
<target name="build">
        <parameter name="strSolutionFile" />
        <solution configuration="debug" solutionfile="${strSolutionFile}"/>
        <return value="true"/>
</target>

I haven't gave this much thought but I think you will get the idea. Maybe
make a function target? Anyways I just want to get somebodies wheels
turning.

Thanks,
Bruce Leggett
Software Engineer
Advanced Systems Technology, Inc.
850.475.4006

This has been discussed previously, and I personally like the idea.

It was (rightly) looked at as something that should be fully explored and done properly if/when it's done... but I forget where the discussion was left.

As a comment on the above, I'd suggest being able to specify parameters as read/write so the calling target will be able to pick up any changes made to the parameter by the called target, instead of using returns:

<call target="build">
  <call-parameters>
    <parameter name="solution" value="MySolution.sln" />
    <parameter name="result" property="BuildResult" />
  </call-parameters>
</call>
<fail unless="${BuildResult == 'success'}">No good!</fail>

[...]

<target name="build">
  <expected-parameters>
    <parameter name="solution" required="true" />
    <parameter name="result" return="true" />
  </expected-parameters>
  <do-stuff with="${solution}" />
  <property name="result" value="success" />
</target>


Regards,

-- Troy


PS- If your target is in another build file, then the <nant> task can be used, which already supports calling a target with extra properties!



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. http://productguide.itmanagersjournal.com/
_______________________________________________
nant-developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/nant-developers

Reply via email to