Changeset 850d3cc


Ignore:
Timestamp:
12/18/11 14:33:41 (5 months ago)
Author:
mrook
Branches:
master
Children:
ddec066
Parents:
8c44f33
git-author:
Michiel Rook <mrook@…> (12/18/11 14:33:41)
git-committer:
Michiel Rook <mrook@…> (12/18/11 14:33:41)
Message:

Fixes #674 - discuss property scope in phingcall blocks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • docs/phing_guide/book/chapters/appendixes/AppendixB-CoreTasks.html

    rf47b545 r850d3cc  
    18851885        </h2> 
    18861886        <p> 
    1887                 The PhingCallTask calls a target from the same Phing project. A <em>&lt;phingcall&gt;</em> 
    1888                 tag may contain <em>&lt;property&gt;</em> tags that define new 
    1889                 properties. In the following example, the properties <em>property1</em> 
    1890                 and <em>foo</em> are defined and only accessible inside the called 
    1891                 target. 
    1892         </p> 
    1893         <p> 
    1894                 However, this will only work if the properties are not yet set outside 
     1887                The PhingCallTask calls a target within the same Phing project. 
     1888        </p> 
     1889         
     1890        <p> 
     1891        A <em>&lt;phingcall&gt;</em> tag may contain <em>&lt;property&gt;</em> 
     1892        tags that define new properties. These properties are only set if properties 
     1893        of the same name have not been set outside 
    18951894                the 
    18961895                <code>&quot;phingcall&quot;</code> 
    18971896                tag. 
    18981897        </p> 
     1898         
     1899        <p> 
     1900           <b>Important note about scope:</b> every <em>&lt;phingcall&gt;</em> tag 
     1901           creates a new local scope. Thus, any properties or other variables set inside 
     1902           that scope will cease to exist (or revert to their previous value) once 
     1903           the <em>&lt;phingcall&gt;</em> tag completes.  
     1904        </p> 
     1905         
    18991906        <h3>Example</h3> 
    19001907        <pre>&lt;target name=&quot;foo&quot;&gt; 
     
    19031910        &lt;property name=&quot;foo&quot; value=&quot;baz&quot; /&gt; 
    19041911    &lt;/phingcall&gt; 
    1905 &lt;/target&gt; 
    1906  
    1907 &lt;target name=&quot;bar&quot; depends=&quot;init&quot;&gt; 
     1912&lt;/target&gt;</pre> 
     1913 
     1914    <p> 
     1915        In the example above, the properties <em>property1</em> 
     1916        and <em>foo</em> are defined and only accessible inside the called 
     1917        target. 
     1918    </p> 
     1919 
     1920<pre>&lt;target name=&quot;bar&quot; depends=&quot;init&quot;&gt; 
    19081921    &lt;echo message=&quot;prop is ${property1} ${foo}&quot; /&gt; 
    19091922&lt;/target&gt;</pre> 
     
    20252038                build file. 
    20262039        </p> 
     2040         
     2041        <p> 
     2042       <b>Important note about scope:</b> when the <em>&lt;property&gt;</em> tag 
     2043       is called inside a <em>&lt;phingcall&gt;</em> tag, any properties are 
     2044       set in a new local scope. Thus, any properties or other variables set inside 
     2045       that scope will cease to exist (or revert to their previous value) once 
     2046       the parent <em>&lt;phingcall&gt;</em> tag completes.  
     2047    </p> 
     2048         
    20272049        <h3>Example</h3> 
    20282050        <pre>&lt;property name=&quot;strings.test&quot; value=&quot;Harr harr, more power!&quot; /&gt; 
Note: See TracChangeset for help on using the changeset viewer.