javajvx

ANT task for update of reactUI of JVx application


I configured my JVx application for using reactUI and saw that there are nightly builds. I want to update my application automatically with latest nightly build. Is there an ant task for this use-case? I'm using ant to build my application.


Solution

  • <target name="start.updateReactUI.nightly" description="Updates reactUI with nightly build">
        
      <tstamp>
        <format property="datepattern" pattern="dd_MM_yyyy"/>
        <!-- one day earlier
        <format property="datepattern" pattern="dd_MM_yyyy" offset="-1" unit="day" /> 
         -->
      </tstamp>
        
      <get src="https://github.com/sibvisions/reactUI/releases/download/build-${datepattern}/reactBuild_${datepattern}.zip" dest="${build}/nightly.zip" usetimestamp="true"/>
        
      <delete file="${build}/nightly" />
        
      <unzip src="${build}/nightly.zip" dest="${build}/nightly">
        <!-- extract only sub directory to dest directory -->
        <patternset>
          <include name="build/*"/>
        </patternset>
        <mapper>
          <globmapper from="build/*" to="*"/>
        </mapper>
      </unzip>
    
      <!-- Delete old files -->
      <delete includeEmptyDirs="true">
        <fileset dir="${basedir}/WebContent/ui">
          <!-- keep additional project fonts -->
          <exclude name="*.ttf"/>
          <!-- keep css of project -->
          <exclude name="*.css"/>
          <!-- keep fav icon of project -->
          <exclude name="favicon.ico"/>
        </fileset>
      </delete>
        
      <!-- Copy new files -->
      <copy todir="${basedir}/WebContent/ui">
        <fileset dir="${build}/nightly">
          <!-- ignore css of build -->
          <exclude name="*.css" />
          <!-- ignore fav icon of build -->
          <exclude name="favicon.ico" />
        </fileset>
      </copy>
        
    </target>
    

    But be careful, because there are no nightly builds on Saturday or Sunday, but the date is one day ahead! Saturday build is with source code of Friday. No build on Sunday and Monday. The Tuesday build is with source code of Monday. Looks like they build after midnight.