Ant: Difference between revisions

From Chorke Wiki
Jump to navigation Jump to search
Line 42: Line 42:
<source lang="xml">
<source lang="xml">
<replaceregexp match="\s+" replace=" " flags="g" byline="true">
<replaceregexp match="\s+" replace=" " flags="g" byline="true">
     <fileset dir="${html.dir}" includes="**/*.html"/>
     <fileset dir="${ext.app.build.dir}" includes="**/*.html"/>
</replaceregexp>
</replaceregexp>
</source>
</source>
Line 49: Line 49:
<replaceregexp match="((\[&quot;app.js&quot;,&quot;){1}([a-z0-9]{32})(&quot;\]){1})"
<replaceregexp match="((\[&quot;app.js&quot;,&quot;){1}([a-z0-9]{32})(&quot;\]){1})"
     replace="[&quot;app.js&quot;,&quot;c9ce971e28fa90ec960ef343ef10e754&quot;]" flags="g" byline="true">
     replace="[&quot;app.js&quot;,&quot;c9ce971e28fa90ec960ef343ef10e754&quot;]" flags="g" byline="true">
         <fileset dir="${ext.app.build.dir}" includes="service-worker.js"/>
         <fileset dir="${target.classes.meta.static.dir}" includes="service-worker.js"/>
</replaceregexp>
</replaceregexp>
</source>
</source>
Line 55: Line 55:
<source lang="xml">
<source lang="xml">
<replaceregexp byline="true">
<replaceregexp byline="true">
     <regexp pattern="app.js&quot;,&quot;(.*)"/>
     <regexp pattern="((\[&quot;app.js&quot;,&quot;){1}([a-z0-9]{32})(&quot;\]){1})"/>
     <substitution expression="app.js&quot;,&quot;d41e83413e1a73b46c799124dadab883"/>
     <substitution expression="[&quot;app.js&quot;,&quot;c9ce971e28fa90ec960ef343ef10e754&quot;]"/>
     <fileset dir=".">
     <fileset dir="${target.classes.meta.static.dir}">
         <include name="service-worker.js"/>
         <include name="service-worker.js"/>
     </fileset>
     </fileset>

Revision as of 04:02, 26 February 2020

Running Ant via Java If you have installed Ant in the do-it-yourself way, Ant can be started from one of two entry points:

java -Dant.home=c:\ant org.apache.tools.ant.Main [options] [target]
java -Dant.home=c:\ant org.apache.tools.ant.launch.Launcher [options] [target]

Checksum

<checksum file="${build.dir}/${jarname}.jar" algorithm="md5"  property="jarname.jar.md5" />
<checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" property="jarname.jar.sha1"/>

<checksum file="${build.dir}/${jarname}.jar" algorithm="md5"  fileext="md5" />
<checksum file="${build.dir}/${jarname}.jar" algorithm="sha1" fileext="sha1"/>

DateTime

<tstamp>
    <format property="built.on" pattern="EEE, MMM dd yyyy, HH:mm Z" locale="en,GB"/>
</tstamp>

Filtering

<filter token="built.on" value="${built.on}"/>
    <copy todir="${target.vendor.antrun.dir}" filtering="true">
    <filelist dir="${ext.app.vendor.antrun.dir}">
        <file name="header.js"/>
    </filelist>
</copy>

Replace

<replace dir="${src}" value="[&quot;app.js&quot;,&quot;d41e83413e1a73b46c799124dadab883&quot;]">
  <include name="service-worker.js"/>
  <replacetoken><![CDATA["app.js","d41e83413e1a73b46c799124dadab883"]]></replacetoken>
</replace>

Replace RexExp

<replaceregexp match="\s+" replace=" " flags="g" byline="true">
    <fileset dir="${ext.app.build.dir}" includes="**/*.html"/>
</replaceregexp>
<replaceregexp match="((\[&quot;app.js&quot;,&quot;){1}([a-z0-9]{32})(&quot;\]){1})"
    replace="[&quot;app.js&quot;,&quot;c9ce971e28fa90ec960ef343ef10e754&quot;]" flags="g" byline="true">
        <fileset dir="${target.classes.meta.static.dir}" includes="service-worker.js"/>
</replaceregexp>
<replaceregexp byline="true">
    <regexp pattern="((\[&quot;app.js&quot;,&quot;){1}([a-z0-9]{32})(&quot;\]){1})"/>
    <substitution expression="[&quot;app.js&quot;,&quot;c9ce971e28fa90ec960ef343ef10e754&quot;]"/>
    <fileset dir="${target.classes.meta.static.dir}">
        <include name="service-worker.js"/>
    </fileset>
</replaceregexp>

References