Ignore:
Timestamp:
2018-08-14T20:38:17+12:00 (6 years ago)
Author:
ak19
Message:

Tidying up

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone3/build.xml

    r32339 r32340  
    102102  </if>
    103103
    104 <!-- Use macrodef task from ant 1.6+ to define a macro https://ant.apache.org/manual/Tasks/macrodef.html -->
    105 <macrodef name="propertycopy">
    106   <attribute name="name"/>
    107   <attribute name="from"/>
    108   <sequential>
    109     <property name="@{name}" value="${@{from}}"/>
    110   </sequential>
    111 </macrodef>
    112104
    113105  <!-- If internal.tomcat.port not yet set, work it out based on server.protocol
     
    153145    </if>
    154146
     147    <!--
     148     1. Using the macrodef task from ant 1.6+ (https://ant.apache.org/manual/Tasks/macrodef.html)
     149     to define "propertycopy" macro that then allows us to use nested variables in build.xml
     150     (Is there any way to use nested variables in build.properties?)
     151     Defining the propertycopy macro:
     152     http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
     153    -->
     154    <macrodef name="propertycopy">
     155      <attribute name="name"/>
     156      <attribute name="from"/>
     157      <sequential>
     158    <property name="@{name}" value="${@{from}}"/>
     159      </sequential>
     160    </macrodef>
    155161    <!--
    156     Now use the macro to use a propertyvalue (server.protocol) as a part of the name for a property
     162    2. Now can use the 'propertycopy' macro defined above to allow us to use a property's value
     163    (e.g. server.protocol's value) as a part of the name for a property.
    157164    So we want do something like ${tomcat.port.${server.protocol}}, which, if server.protocol=http,
    158     we want it to turn into tomcat.port.http. Then we want to use the constructed variable name
    159     to assign its value to a new variable. Use as follows:
    160     propertycopy name="tomcat.port.protocol" from="tomcat.port.${server.protocol}"
    161     http://ant.apache.org/faq.html#propertyvalue-as-name-for-property
     165    we'd like it to turn into tomcat.port.http. Then we want to use the constructed variable name
     166    to assign its value to a new variable. Use is as follows:
     167       propertycopy name="tomcat.port.protocol" from="tomcat.port.${server.protocol}"
    162168    http://ant.1045680.n5.nabble.com/Property-expansion-in-macrodef-attributes-td5476406.html
    163169    -->
    164170    <propertycopy name="internal.tomcat.port" from="tomcat.port.${server.protocol}"/>
    165171    <if>
    166       <bool><matches string="${internal.tomcat.port}" pattern="tomcat"/></bool>
     172      <bool><matches string="${internal.tomcat.port}" pattern="tomcat\.port"/></bool>
    167173      <fail>...
    168174      ********* ERROR: Unable to set tomcat.port:
     
    170176      matching tomcat.port.${server.protocol} property line is enabled and set to a valid port number.</fail>
    171177    </if>
    172 
    173     <echo>### PORT PROTOCOL: ${internal.tomcat.port}</echo>
    174 
    175178
    176179  <!-- If we got here, we got a valid tomcat port. Set tomcat.port in build.properties
     
    183186       even though we can write it back out again to build.properties.
    184187  -->
     188  <echo>Using tomcat port: ${internal.tomcat.port}</echo>
    185189  <propertyfile file="build.properties">
    186190    <entry key="tomcat.port" value="${internal.tomcat.port}"/>
Note: See TracChangeset for help on using the changeset viewer.