-
Notifications
You must be signed in to change notification settings - Fork 8
/
build-addNarratives.xml
63 lines (54 loc) · 3.26 KB
/
build-addNarratives.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
<?xml version="1.0" encoding="UTF-8"?>
<project basedir="." name="generateTestScriptsForProject" default="build">
<!-- Add narratives to all examples in the Examples folder. -->
<dirset id="in.dirs" dir="Examples"/>
<property name="tool.reponame" value="HL7-mappings"/>
<property name="tool.name" value="fhir-narrativegenerator"/>
<property name="tool.version" value="fhir-narrativegenerator-0.10.0"/>
<property name="tool.antfile" value="build/build.xml"/>
<property name="tool.localdir" value=""/>
<!-- Relative paths turn out to be a nightmare to get right, so let's convert it to an absolute path. -->
<property name="tool.localdir.abs" location="${tool.localdir}"/>
<!-- Tell the main build script where to find common asserts and place the build scripts. -->
<property name="lib.dir" location="${basedir}/lib"/>
<!-- Construct the path to the test scripts, either the locally defined dir or a new dir under "lib". -->
<property name="testscripttools.repo.dir" location="${lib.dir}/${tool.reponame}/${tool.name}/${tool.version}"/>
<condition property="testscripttools.dir" value="${tool.localdir.abs}" else="${testscripttools.repo.dir}">
<length string="${tool.localdir}" trim="true" when="greater" length="0"/>
</condition>
<!-- Check if we need to download the test script tools repo from Github, which is needed if we don't have it
already and if we didn't specify to use a local copy (we never download anything when using a local copy so we
cannot accidentally override it). -->
<target name="checkForRepoDownload">
<condition property="download.repo">
<and>
<length string="${tool.localdir}" trim="true" when="equal" length="0"/>
<not>
<available file="${testscripttools.dir}"/>
</not>
</and>
</condition>
</target>
<!-- Download and extract the Nictiz test script tools from Github if we don't have them already. -->
<target name="get.toolrepo" depends="checkForRepoDownload" if="download.repo">
<sequential>
<echo>Downloading the test script tools repo from Github</echo>
<echo>If you want to use a local copy for debugging, specify it with the -Dtestscripttools.local=... parameter</echo>
<echo/>
<mkdir dir="${testscripttools.dir}/"/>
<local name="zip.name"/>
<property name="zip.name" value="${testscripttools.dir}/package.zip"/>
<get src="https://github.com/Nictiz/${tool.reponame}/releases/download/${tool.version}/${tool.version}.zip"
dest="${zip.name}"/>
<unzip src="${zip.name}" dest="${testscripttools.dir}" failOnEmptyArchive="true">
<mapper type="regexp" from="^.*?/(.*)" to="\1"/>
</unzip>
<delete file="${zip.name}"/>
<property name="hastestscripttools" value="true" />
</sequential>
</target>
<!-- Handover control to the build file in the lib cache. -->
<target name="build" depends="get.toolrepo">
<ant antfile="${testscripttools.dir}/${tool.antfile}" inheritAll="true" inheritRefs="true"/>
</target>
</project>