-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.xml
158 lines (126 loc) · 4.13 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
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<loadproperties srcFile="DESCRIPTION" />
<property name="tarfile" value="provDebugR_${Version}.tar.gz" />
<!-- === BUILD ========================================================= -->
<target name="roxygenize">
<exec executable="Rscript" >
<arg line="-e roxygen2::roxygenise()"/>
</exec>
</target>
<target name="build" depends="roxygenize">
<exec executable="R" >
<arg line="CMD build ."/>
</exec>
</target>
<!-- === INSTALL ======================================================= -->
<target name="install" depends="check">
<exec executable="R" >
<arg line="CMD INSTALL ${tarfile}"/>
</exec>
</target>
<target name="install-no-check" depends="build">
<exec executable="R" >
<arg line="CMD INSTALL ${tarfile}"/>
</exec>
</target>
<!-- === CLEAN ========================================================= -->
<target name="clean">
<delete dir="provDebugR.Rcheck" verbose="false"/>
<delete file="${tarfile}" verbose="false"/>
</target>
<!-- === CREATE JSON =================================================== -->
<!--
Creates up-to-date json files for testing.
Does not include sourced files.
-->
<target name="create-json">
<!-- empty -->
<antcall target="json">
<param name="theFile" value="empty.R"/>
</antcall>
<!-- errors, warnings -->
<antcall target="json">
<param name="theFile" value="exceptions.R"/>
</antcall>
<!-- fromEnv -->
<antcall target="json">
<param name="theFile" value="fromEnv.R"/>
<param name="console.mode" value="true"/>
</antcall>
<delete file="inst/plot.pdf"/>
<!-- no data nodes -->
<antcall target="json">
<param name="theFile" value="noDataNodes.R"/>
</antcall>
<!-- no variables -->
<antcall target="json">
<param name="theFile" value="noVars.R"/>
</antcall>
<!-- type changes -->
<antcall target="json">
<param name="theFile" value="typeChanges.R"/>
</antcall>
<delete file="inst/Rplots.pdf"/>
<!-- view -->
<antcall target="json">
<param name="theFile" value="view.R"/>
</antcall>
<delete file="inst/plot.pdf"/>
</target>
<target name="json">
<!-- default: values of parameters to prov.run -->
<condition property="snapshot.size" value='0'>
<not><isset property="snapshot.size"/></not>
</condition>
<!-- default: delete prov folder after it is created -->
<condition property="delete.dir" value="true">
<not><isset property="delete.dir"/></not>
</condition>
<!-- default: console mode is false -->
<condition property="console.mode" value="false">
<not><isset property="console.mode"/></not>
</condition>
<!-- run script -->
<echo message="${theFile}"/>
<exec if:true="${console.mode}" executable="Rscript" dir="inst">
<arg line="testscripts/${theFile}"/>
</exec>
<exec unless:true="${console.mode}" executable="Rscript" dir="inst">
<arg line="-e "rdtLite::prov.run('testscripts/${theFile}', prov.dir='testdata', snapshot.size=${snapshot.size})""/>
</exec>
<basename property="scriptname" file="${theFile}" suffix="R" />
<!-- move prov.json file to testdata folder -->
<move if:true="${console.mode}"
file="inst/testdata/prov_console/prov.json"
tofile="inst/testdata/${scriptname}.json"
/>
<move unless:true="${console.mode}"
file="inst/testdata/prov_${scriptname}/prov.json"
tofile="inst/testdata/${scriptname}.json"
/>
<!-- delete prov directory if it is not needed anymore -->
<antcall if:true="${delete.dir}" target="delete.prov.dir"/>
</target>
<!-- delete prov directory -->
<target name="delete.prov.dir">
<delete if:true="${console.mode}"
dir="inst/testdata/prov_console"
/>
<delete unless:true="${console.mode}"
dir="inst/testdata/prov_${scriptname}"
/>
</target>
<!-- === CHECK ========================================================= -->
<target name="check" depends="build">
<exec executable="R" >
<arg line="CMD check ${tarfile}"/>
</exec>
</target>
<target name="cran-check" depends="build">
<exec executable="R" >
<arg line="CMD check --as-cran ${tarfile}"/>
</exec>
</target>
</project>