Permalink
Fetching contributors…
Cannot retrieve contributors at this time
300 lines (232 sloc) 9.36 KB
<?xml version="1.0"?>
<!-- ===================================================== -->
<!-- RF-SRC CRAN Build File Apache Ant version 1.10.0 -->
<!-- ===================================================== -->
<project name="RF-SRC CRAN" basedir="." >
<!--
========================================================================
SOURCE-CRAN target, Entry Point
========================================================================
-->
<target name="source-cran" depends="init, clean-cran">
<!--delete dir="target/cran"/-->
<mkdir dir="target/cran"/>
<mkdir dir="target/cran/${project.pkg.name}"/>
<mkdir dir="target/cran/${project.pkg.name}/inst"/>
<mkdir dir="target/cran/${project.pkg.name}/data"/>
<mkdir dir="target/cran/${project.pkg.name}/man"/>
<mkdir dir="target/cran/${project.pkg.name}/R"/>
<mkdir dir="target/cran/${project.pkg.name}/src"/>
<property name="ppsc" value="src/main/resources/cran"/>
<property name="pptc" value="target/cran/${project.pkg.name}"/>
<copy todir="${pptc}">
<fileset dir="${ppsc}">
<include name="NAMESPACE"/>
<include name="DESCRIPTION"/>
<include name="configure.ac"/>
<include name="cleanup"/>
</fileset>
<filterchain>
<tokenfilter>
<replacestring from="_PROJECT_PACKAGE_NAME_" to="${project.pkg.name}"/>
<replacestring from="@PROJECT_VERSION@" to="${project.version}"/>
<replacestring from="_PROJECT_DSTAMP_" to="${DSTAMP}"/>
</tokenfilter>
</filterchain>
</copy>
<chmod file="${pptc}/cleanup" perm="ugo+x"/>
<copy todir="${pptc}/inst">
<fileset dir="${ppsc}/inst">
<include name="*"/>
</fileset>
<filterchain>
<tokenfilter>
<replacestring from="_PROJECT_PACKAGE_NAME_" to="${project.pkg.name}"/>
<replacestring from="@PROJECT_VERSION@" to="${project.version}"/>
<replacestring from="@PROJECT_BUILD@" to="${project.build}"/>
<replacestring from="_PROJECT_DSTAMP_" to="${DSTAMP}"/>
</tokenfilter>
</filterchain>
</copy>
<copy todir="${pptc}/src">
<fileset dir="${ppsc}/src">
<include name="*"/>
</fileset>
</copy>
<!--
Compress Data Files ...
-->
<mkdir dir="${pptc}/staged"/>
<copy file="src/main/resources/cran/scripts/compressData.R" todir="${pptc}/staged"/>
<copy todir="${pptc}/staged">
<fileset dir="${ppsc}/data">
<include name="*.txt"/>
<include name="*.csv"/>
</fileset>
</copy>
<mkdir dir="${pptc}/staged/tmp"/>
<copy file="src/main/resources/cran/scripts/nutrigenomic.conv.R" todir="${pptc}/staged/tmp"/>
<move file="${pptc}/staged/nutrigenomic.txt" toDir="${pptc}/staged/tmp"/>
<exec dir="${pptc}/staged/tmp" executable="R" failonerror="TRUE">
<arg line="CMD BATCH"/>
<arg line="--no-restore"/>
<arg line="--no-save"/>
<arg line="nutrigenomic.conv.R"/>
<arg line="nutrigenomic.conv.log"/>
</exec>
<move file="${pptc}/staged/tmp/nutrigenomic.rda"
toDir="${pptc}/staged"/>
<exec dir="${pptc}/staged" executable="R" failonerror="TRUE">
<arg line="CMD BATCH"/>
<arg line="--no-restore"/>
<arg line="--no-save"/>
<arg line="compressData.R"/>
<arg line="compressData.log"/>
</exec>
<copy todir="${pptc}/data">
<fileset dir="${pptc}/staged">
<include name="*.rda"/>
</fileset>
</copy>
<delete dir="${pptc}/staged" />
<copy todir="${pptc}/man">
<fileset dir="${ppsc}/man">
<include name="*.Rd"/>
</fileset>
<filterchain>
<tokenfilter>
<replacestring from="_HTTP_PREFIX_" to="${http.prefix}"/>
<replacestring from="_HTTP__PREFIX_" to="${https.prefix}"/>
</tokenfilter>
</filterchain>
<filterchain>
<tokenfilter>
<replacestring from="_PROJECT_PACKAGE_NAME_" to="${project.pkg.name}"/>
</tokenfilter>
</filterchain>
</copy>
<copy todir="${pptc}/R">
<fileset dir="${ppsc}/R">
<include name="*.R"/>
</fileset>
<!-- This targets rfsrc.R and generic.predict.R -->
<filterchain>
<tokenfilter>
<replacestring from="@PROJECT_VERSION@" to="${project.version}"/>
<replacestring from="@MINIMUM_VERSION@" to="${minimum.version}"/>
</tokenfilter>
</filterchain>
<!-- This targets rfsrc.news.R -->
<filterchain>
<tokenfilter>
<replacestring from="_PROJECT_PACKAGE_NAME_" to="${project.pkg.name}"/>
</tokenfilter>
</filterchain>
</copy>
<concat destfile="${pptc}/src/randomForestSRC.h" append="false">
<fileset dir="src/main/c"
includes="randomForestSRC.h"/>
<fileset dir="src/main/c/cran"
includes="randomForestSRC.cran.h"/>
<filterchain>
<tokenfilter>
<replacestring from="@RF_CRANX_BEG@" to=""/>
<replacestring from="@RF_CRANX_END@" to=""/>
<replacestring from="@RF_JAVAX_BEG@" to="@START_DELETE@"/>
<replacestring from="@RF_JAVAX_END@" to="@END_DELETE@"/>
</tokenfilter>
</filterchain>
</concat>
<!-- CRAN/JAVA Exclusion. -->
<replaceregexp byline="false" flags="gs" match ="@START_DELETE@(.*?)@END_DELETE@" replace =" ">
<fileset dir="${pptc}/src">
<include name="randomForestSRC.h"/>
</fileset>
</replaceregexp>
<concat destfile="${pptc}/src/randomForestSRC.c" append="false">
<fileset dir="src/main/c"
includes="randomForestSRC.c"/>
<fileset dir="src/main/c/cran"
includes="randomForestSRC.cran.c"/>
<filterchain>
<tokenfilter>
<replacestring from="@RF_CRANX_BEG@" to=""/>
<replacestring from="@RF_CRANX_END@" to=""/>
<replacestring from="@RF_JAVAX_BEG@" to="@START_DELETE@"/>
<replacestring from="@RF_JAVAX_END@" to="@END_DELETE@"/>
</tokenfilter>
</filterchain>
</concat>
<!-- CRAN/JAVA Exclusion. -->
<replaceregexp byline="false" flags="gs" match ="@START_DELETE@(.*?)@END_DELETE@" replace =" ">
<fileset dir="${pptc}/src">
<include name="randomForestSRC.c"/>
</fileset>
</replaceregexp>
<copy todir="${pptc}/src/">
<fileset dir="src/main/c">
<include name="splitCustom.*"/>
</fileset>
</copy>
<copy todir="${pptc}/src">
<fileset dir="src/main/c/cran">
<include name="R_init_randomForestSRC.c"/>
</fileset>
</copy>
<delete dir="target/cran/staged"/>
<mkdir dir="target/cran/staged"/>
<copy todir="target/cran/staged/${project.pkg.name}">
<fileset dir="target/cran/${project.pkg.name}"/>
</copy>
<chmod file="target/cran/staged/${project.pkg.name}/cleanup" perm="ugo+x"/>
<exec dir="target/cran/staged/${project.pkg.name}" executable="autoconf" failonerror="TRUE" os="Linux,Mac OS X"/>
<exec dir="target" executable="cp" failonerror="TRUE" os="Linux,Mac OS X">
<arg line="cran/staged/${project.pkg.name}/configure"/>
<arg line="cran/${project.pkg.name}/configure"/>
</exec>
<chmod file="target/cran/${project.pkg.name}/configure" perm="ugo+x" os="Linux,Mac OS X"/>
<exec dir="target/cran/staged" executable="R" failonerror="TRUE">
<arg line="CMD check"/>
<!--arg line="- -as-cran"/ -->
<arg line="${project.pkg.name}"/>
</exec>
<exec dir="target/cran/staged" executable="R" failonerror="TRUE">
<arg line="CMD build"/>
<arg line="--resave-data"/>
<arg line="${project.pkg.name}"/>
</exec>
<copy file="target/cran/staged/${project.pkg.name}_${project.version}.tar.gz" todir="target/cran"/>
<!-- delete dir="target/cran/staged"/-->
</target>
<!--
========================================================================
INSTALL-CRAN-xxx target, Entry Point
========================================================================
-->
<target name="install-cran-mac" depends="os-prep, source-cran, install-cran-generic"/>
<target name="install-cran-lin" depends="os-prep, source-cran, install-cran-generic"/>
<target name="install-cran-win" depends="os-prep, source-cran, install-cran-generic"/>
<!--
========================================================================
Internal target, install-cran-generic
========================================================================
-->
<target name="install-cran-generic">
<delete dir="target/cran/staged"/>
<mkdir dir="target/cran/staged"/>
<copy todir="target/cran/staged/${project.pkg.name}">
<fileset dir="target/cran/${project.pkg.name}"/>
</copy>
<chmod file="target/cran/staged/${project.pkg.name}/cleanup" perm="ugo+x"/>
<chmod file="target/cran/staged/${project.pkg.name}/configure" perm="ugo+x" os="Linux,Mac OS X"/>
<exec dir="target/cran/staged" executable="R" failonerror="TRUE">
<arg line="CMD INSTALL"/>
<arg line="--clean"/>
<arg line="--preclean"/>
<arg line="--build"/>
<arg line="${project.pkg.name}"/>
</exec>
<copy file="target/cran/staged/${project.pkg.name}_${project.version}${cranArchive}" todir="target/cran"/>
<delete dir="target/cran/staged"/>
</target>
</project>