forked from End-to-end-provenance/provBookR
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
114 lines (99 loc) · 3.51 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
<project
xmlns:if="ant:if"
xmlns:unless="ant:unless">
<loadproperties srcFile="DESCRIPTION" />
<property name="tarfile" value="provBookR_${Version}.tar.gz" />
<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 --no-build-vignettes ."/>
</exec>
</target>
<target name="check" depends="build">
<exec executable="R" >
<arg line="CMD check --no-vignettes --no-build-vignettes ${tarfile}"/>
</exec>
</target>
<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>
<target name="create-json">
<!-- If you include R scripts to test with, you would add a rule
like this for each of them that can re-generate the json, so
they can be updated as rdtLite output changes. -->
<!--<antcall target="create-one-json">
<param name="script" value="console"/>
</antcall>-->
</target>
<target name="create-one-json">
<antcall target="json">
<param name="theFile" value="${script}.R"/>
</antcall>
<antcall target="create-book">
<param name="theFile" value="${script}.json"/>
</antcall>
</target>
<target name="create-book">
<basename property="scriptname" file="${theFile}" suffix="json" />
<exec executable="Rscript" dir="inst/testdata" output="${scriptname}.book">
<arg line="-e "provBookR::prov.book.file('${theFile}')"" />
</exec>
<echo> Comparing books </echo>
<exec executable="diff">
<arg value="--strip-trailing-cr"/>
<arg file="inst/testbooks/${scriptname}.expected"/>
<arg file="${scriptname}.book"/>
</exec>
<input
message="Do you want to update the expected book for ${scriptname}?"
validargs="y,n"
addproperty="answer"
/>
<condition property="do.update">
<equals arg1="y" arg2="${answer}"/>
</condition>
<antcall target="update-book">
<param name="script" value="${scriptname}"/>
</antcall>
<antcall target="delete-book">
<param name="script" value="${scriptname}"/>
</antcall>
</target>
<target name="update-book" if="do.update">
<echo> Updating the book </echo>
<move file="${script}.book" tofile="inst/testbooks/${script}.expected" />
</target>
<target name="delete-book" unless="do.update">
<echo> Deleting the new book </echo>
<delete file="${script}.book"/>
</target>
<target name="json">
<echo message="${theFile}"/>
<exec executable="Rscript" dir="inst/testscripts">
<arg line="-e "rdtLite::prov.run('${theFile}', prov.dir='.')""/>
</exec>
<basename property="scriptname" file="${theFile}" suffix="R" />
<move file="inst/testscripts/prov_${scriptname}/prov.json" tofile="inst/testdata/${scriptname}.json" />
<delete dir="inst/testscripts/prov_${scriptname}" />
</target>
<target name="cran-check" depends="build, create-json">
<exec executable="R" >
<arg line="CMD check --as-cran --no-vignettes --no-build-vignettes ${tarfile}"/>
</exec>
</target>
<target name="clean">
<delete dir="provBookR.Rcheck" verbose="false"/>
<delete file="${tarfile}" verbose="false"/>
</target>
</project>