forked from arunaryan/OG-RStats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
163 lines (141 loc) · 6.47 KB
/
build.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
<project name="og-rstats" default="compile">
<import file="${basedir}/build-core.xml" />
<import file="${basedir}/build-core-deploy.xml" />
<path id="cc.build.path">
<pathelement path="${solution.dir}/Client" />
</path>
<path id="cctest.build.path">
<pathelement path="${solution.dir}/ClientTest" />
</path>
<target name="resolve" depends="core.resolve,deploy-og-language" />
<!--
Feel free to remove this 'docs' task if it causes problems.
The default 'docs' task tries to run javadocs which fails here.
This way we run r docs instead.
-->
<target name="docs" depends="rdocs" />
<target name="rdocs" description="Task which builds traditional-style PDF R docs (not dexy docs). Requires latex.">
<property name="docfile" value="OpenGamma-RStats.pdf"/>
<exec executable="R">
<arg value="CMD" />
<arg value="Rd2pdf" />
<arg value="--no-preview"/>
<arg value="--force"/>
<arg value="--output=${docfile}"/>
<arg value="package/"/>
</exec>
<echo message="R docs have been saved to ${docfile}" />
</target>
<target name="config" depends="core.config,deploy-config">
<copy todir="${build.dir}/ext" file="${solution.dir}/config/R.xml" />
<subant buildpath="package" target="config" inheritrefs="true" inheritall="true" />
</target>
<target name="exists-OpenGammaR" unless="replace.OpenGammaR">
<condition property="exists.OpenGammaR">
<or>
<available file="${user.home}/etc/OpenGammaLtd/OpenGammaR" />
<os family="Windows" />
</or>
</condition>
</target>
<target name="deploy-OpenGammaR" depends="exists-OpenGammaR" unless="exists.OpenGammaR">
<echo file="${user.home}/etc/OpenGammaLtd/OpenGammaR"># Local build defaults
connectorLogConfiguration=${basedir}/config/log4cxx.properties
serviceExecutable=${basedir}/build/Debug/ServiceRunner
</echo>
</target>
<target name="deploy-config" depends="core-deploy.deploy-config,deploy-OpenGammaR" />
<target name="test-batch-cpp" depends="jar,core.test-batch-cpp" />
<target name="test-batch" depends="core.test-batch,dist-source-impl,test-dist-impl" />
<target name="dist-publish" depends="core.dist-publish">
<delete dir="${package.dir}" />
<mkdir dir="${dist.dir}/config/ext" />
<copy file="${solution.dir}/config/R.xml" todir="${dist.dir}/config/ext" />
<zip destfile="${dist.dir}/${ant.project.name}-config.zip" basedir="${dist.dir}/config" whenempty="create" />
<delete dir="${dist.dir}/config" />
</target>
<target name="dist-source" depends="dist-source-impl">
<!-- Note that this is only a source dist on a clean environment. After the binary has been
built the package will contain build artifacts (e.g. object files) -->
<zip destfile="${dist.dir}/${ant.project.name}-R.zip" basedir="${package.dir}" />
</target>
<target name="dist-source-impl">
<mkdir dir="${package.dir}/${package.name}" />
<subant buildpath="package" target="dist" inheritrefs="true" inheritall="true" />
<subant buildpathref="cc.build.path" target="dist" inheritrefs="true" inheritall="true" />
<mkdir dir="${package.dir}/${package.name}/src/build" />
<copy file="${build.dir}/version.h" todir="${package.dir}/${package.name}/src/build" />
</target>
<target name="dist-binary" depends="dist-source,r-present" if="r.present">
<exec executable="R" failonerror="true">
<arg value="CMD" />
<arg value="build" />
<arg value="--binary" />
<arg value="${package.dir}/${package.name}" />
</exec>
<move todir="${dist.dir}">
<fileset dir="${basedir}">
<include name="${package.name}_*.zip" />
<include name="${package.name}_*.tar.gz" />
</fileset>
</move>
</target>
<target name="binary-rename">
<copy tofile="${dist.dir}/${package.name}.zip" failonerror="false">
<fileset dir="${dist.dir}">
<include name="${package.name}_*.zip" />
</fileset>
</copy>
</target>
<target name="compile-msm" depends="dist-binary,core.compile-msm" />
<target name="compile-msm-impl" depends="binary-rename">
<installer-make file="R.aip" />
<delete file="${dist.dir}/${package.name}.zip" failonerror="false" />
</target>
<target name="installer-impl">
<installer-make build-id="${ai.build.all}" />
</target>
<target name="cpp-compile-check" unless="cpp.headers.present">
<available property="cpp.headers.present" file="${build.dir}/.cpp.compile" />
</target>
<target name="r-present-check" depends="cpp-compile-check" unless="r.present" if="cpp.headers.present">
<exec executable="${R.command}" failonerror="true" failifexecutionfails="false" resultproperty="r.present.result">
<arg value="--version" />
</exec>
<condition property="r.present">
<equals arg1="${r.present.result}" arg2="0" />
</condition>
</target>
<target name="r-present" depends="r-present-check" unless="r.present">
<echo>R or dependent libraries not installed - cannot build or test the distribution</echo>
</target>
<target name="test-dist" depends="clean-dist,core.dist-publish,test-dist-impl" description="Tests the R package distribution using 'R CMD check'" />
<target name="test-dist-impl" depends="r-present" if="r.present">
<exec executable="${R.command}" failonerror="true">
<arg value="CMD" />
<arg value="check" />
<arg value="${package.dir}/${package.name}" />
</exec>
</target>
<target name="install-check" unless="og.build.invoked">
<antcall target="clean-dist" inheritrefs="true" inheritall="true" />
<antcall target="core.dist-publish" inheritrefs="true" inheritall="true" />
</target>
<target name="install" depends="install-check,core.install,r-present" if="r.present" description="Installs the R package using 'R CMD INSTALL'">
<exec executable="${R.command}" failonerror="false">
<arg value="CMD" />
<arg value="INSTALL" />
<arg value="${package.dir}/${package.name}" />
</exec>
</target>
<target name="manual" depends="core.dist-publish,r-present" if="r.present" description="Generates default R documentation using 'R CMD Rd2pdf'">
<exec executable="${R.command}" failonerror="true">
<arg value="CMD" />
<arg value="Rd2pdf" />
<arg value="${package.dir}/${package.name}" />
</exec>
</target>
<target name="clean-tests" depends="common.clean-tests">
<delete includeemptydirs="true" failonerror="false" dir="${basedir}/${package.name}.Rcheck" />
</target>
</project>