forked from HL7/JIRA-Spec-Artifacts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.xml
80 lines (80 loc) · 4.58 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
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<project name="org.hl7.spec.jira" basedir="." default="test">
<path id="saxon.path">
<fileset dir="tools/saxon" includes="*.jar"/>
</path>
<target name="validate" description="Validates files, includinging generating workgroup schema">
<!-- Check that the workgroups file is valid and if so generate a schema for it to use in subsequent validation -->
<schemavalidate noNamespaceFile="schemas/workgroupList.xsd" file="xml/_workgroups.xml"/>
<schemavalidate noNamespaceFile="schemas/acceleratorList.xsd" file="xml/_accelerators.xml"/>
<dependset>
<srcfilelist dir="tools" files="buildWGschema.xslt"/>
<targetfilelist dir="schemas" files="workgroups.xsd"/>
</dependset>
<xslt in="xml/_workgroups.xml" out="schemas/workgroups.xsd" style="tools/buildWGschema.xslt"/>
<dependset>
<srcfilelist dir="tools" files="buildAcceleratorSchema.xslt"/>
<targetfilelist dir="schemas" files="accelerators.xsd"/>
</dependset>
<xslt in="xml/_accelerators.xml" out="schemas/accelerators.xsd" style="tools/buildAcceleratorSchema.xslt"/>
<!-- Validate remaining files -->
<schemavalidate noNamespaceFile="schemas/familyList.xsd" file="xml/_families.xml"/>
<schemavalidate noNamespaceFile="schemas/specificationList.xsd">
<fileset dir="xml" includes="SPECS-*.xml"/>
</schemavalidate>
<schemavalidate noNamespaceFile="schemas/specification.xsd">
<fileset dir="xml" includes="*.xml" excludes="SPECS-*.xml,_accelerators.xml,_workgroups.xml,_families.xml"/>
</schemavalidate>
<resourcecount property="count.cda">
<fileset dir="xml" includes="CDA-*.xml"/>
</resourcecount>
<resourcecount property="count.fhir">
<fileset dir="xml" includes="FHIR-*.xml"/>
</resourcecount>
<resourcecount property="count.other">
<fileset dir="xml" includes="OTHER-*.xml"/>
</resourcecount>
<resourcecount property="count.v2">
<fileset dir="xml" includes="V2-*.xml"/>
</resourcecount>
</target>
<target name="genJson" depends="validate" description="Generates json files for JIRA and comparison XML file">
<mkdir dir="json"/>
<mkdir dir="tools/temp"/>
<!-- Generate JSON files and comparison XML file -->
<dependset>
<srcfilelist dir="tools" files="xmlToJson.xslt"/>
<targetfileset dir="json" includes="*.json"/>
</dependset>
<xslt in="xml/_families.xml" out="json/families.json" style="tools/xmlToJson.xslt"/>
<xslt in="xml/_workgroups.xml" out="json/workgroups.json" style="tools/xmlToJson.xslt"/>
<xslt in="xml/_accelerators.xml" out="json/accelerators.json" style="tools/xmlToJson.xslt"/>
<get src="https://hl7.github.io/JIRA-Spec-Artifacts/SPECS.xml" dest="tools/temp/SPECS.xml" usetimestamp="true"/>
<dependset>
<srcfilelist dir="tools/temp" files="SPECS.xml"/>
<srcfileset dir="xml" includes="*.xml" excludes="_accelerators.xml,_workgroups.xml,_families.xml"/>
<targetfileset dir="json" includes="SPECS*.json"/>
</dependset>
<xslt in="xml/_families.xml" out="json/SPECS.json" style="tools/buildSpecJSON.xslt" classpathref="saxon.path">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<echo file="tools/temp/actualcount.txt" message="CDA-${count.cda}
"/>
<echo file="tools/temp/actualcount.txt" message="FHIR-${count.fhir}
" append="true"/>
<echo file="tools/temp/actualcount.txt" message="OTHER-${count.other}
" append="true"/>
<echo file="tools/temp/actualcount.txt" message="V2-${count.v2}
" append="true"/>
<xslt in="json/SPECS.xml" out="tools/temp/definedcount.txt" style="tools/countSpecs.xslt" classpathref="saxon.path">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
<fail message="The number of spec files found in the XML folder doesn't match the number of files defined in the SPECS-*.xml files. Check the tools/temp/actualcount.txt (files in the folder) and definedcount.txt (files listed in SPECS-*.xml files) files. Typically this happens when file is committed to the XML folder, but no row is added to the appropriate SPECS-*.xml files.">
<condition>
<not>
<filesmatch file1="tools/temp/actualcount.txt" file2="tools/temp/definedcount.txt" textfile="true"/>
</not>
</condition>
</fail>
<xslt in="json/SPECS.xml" out="tools/temp/rules.txt" style="tools/checkRules.xslt" classpathref="saxon.path">
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
</xslt>
</target>
<target name="test" depends="genJson" description="Default task Travis looks for"/>
</project>