This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.xml
169 lines (135 loc) · 7.76 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
164
165
166
167
168
169
<project name="validation-configuration" default="dist" basedir=".">
<!-- set global properties for this build -->
<!-- main build directories -->
<property name="src.dir" location="${basedir}/src"/>
<property name="lib.dir" location="${basedir}/lib"/>
<property name="build.dir" location="${basedir}/build"/>
<property name="download.dir" location="${build.dir}/download"/>
<property name="dist.dir" location="${basedir}/dist"/>
<property name="test.src.dir" location="${src.dir}/test"/>
<property name="test.build.dir" location="${build.dir}/test"/>
<!-- Naming -->
<property name="dist.name" value="xgewerbeanzeige-validator-configuration"/>
<property name="validationtool.jar" value="validationtool-1.0.1-standalone.jar"/>
<property name="saxon.jar" value="saxon9he.jar"/>
<property name="xgewerbeanzeige.download.url.prefix" value="http://www.xgewerbeanzeige.de/files/files_standard/"/>
<!-- root/work directory where KoSIT validationtool expects Schema(s)-and trons -->
<property name="repository.dir" location="${build.dir}"/>
<property name="resource.dir" location="${repository.dir}/resources"/>
<property name="schematron.url" value="https://github.com/Schematron/schematron/releases/download/2017-02-09/iso-schematron-xslt2.zip"/>
<!-- Resource directories -->
<property name="reports.schema.dir" location="${resource.dir}/xsd"/>
<property name="test.docs.dir" location="${test.src.dir}/instances"/>
<property name="reports.dir" location="${basedir}/reports"/>
<target name="init" description="Initializes build directory structure and ISO timestamp">
<!-- Create timestamps -->
<tstamp>
<format property="build.date" pattern="yyyy-MM-dd"/>
</tstamp>
<echo>Build date: ${build.date}</echo>
<!-- Create the build directory structure used by compile -->
<mkdir dir="${build.dir}"/>
<mkdir dir="${download.dir}"/>
<mkdir dir="${lib.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="prepare-saxon" depends="init"
description="Download Saxon-HE and add jar to library directory">
<get
src="https://sourceforge.net/projects/saxon/files/Saxon-HE/9.8/SaxonHE9-8-0-8J.zip/download"
dest="${download.dir}/SaxonHE9-8-0-8J.zip" skipexisting="true"
usetimestamp="true"/>
<unzip src="${download.dir}/SaxonHE9-8-0-8J.zip" dest="${lib.dir}">
<patternset>
<include name="**/${saxon.jar}"/>
</patternset>
<flattenmapper/>
</unzip>
</target>
<target name="prepare-validationtool" depends="init"
description="Download KoSIT validation tool and add jar to library directory">
<get
src="https://github.com/itplr-kosit/validationtool/releases/download/validationtool-1_0_1/validationtool-dist-1.0.1-standalone.zip"
dest="${download.dir}" skipexisting="true" usetimestamp="true"/>
<unzip src="${download.dir}/validationtool-dist-1.0.1-standalone.zip" dest="${lib.dir}">
<patternset>
<include name="**/${validationtool.jar}"/>
</patternset>
<flattenmapper/>
</unzip>
</target>
<target name="prepare-schematron" depends="init">
<mkdir dir="${download.dir}/schematron"/>
<get
src="${schematron.url}"
dest="${download.dir}/schematron.zip" skipexisting="true" usetimestamp="true"/>
<unzip src="${download.dir}/schematron.zip" dest="${download.dir}/schematron/"/>
</target>
<target name="retrieve" depends="init">
<mkdir dir="${download.dir}/xgewerbeanzeige-2.2"/>
<get src="https://www.xrepository.de/api/xrepository/urn:xoev-de:kosit:standard:xgewerbeanzeige_2.2:dokument:Xml_Schemata_inklusive_Abh_ngigkeiten"
dest="${download.dir}/xgewerbeanzeige-2.2-xsd.zip" skipexisting="true" usetimestamp="true"/>
<get src="https://www.xrepository.de/api/xrepository/urn:xoev-de:kosit:standard:xgewerbeanzeige_2.2:dokument:Schematron__09.03.2021_"
dest="${download.dir}/xgewerbeanzeige-2.2-sch.zip" skipexisting="true" usetimestamp="true"/>
<unzip src="${download.dir}/xgewerbeanzeige-2.2-xsd.zip" dest="${download.dir}/xgewerbeanzeige-2.2"/>
<unzip src="${download.dir}/xgewerbeanzeige-2.2-sch.zip" dest="${download.dir}/xgewerbeanzeige-2.2"/>
<mkdir dir="${download.dir}/xgewerbeordnung-1.0"/>
<copy todir="${download.dir}/xgewerbeordnung-1.0">
<fileset dir="c:/fb/git/xgewerbeordnung-spezifikation/build/xsd" includes="*.xsd"/>
<fileset dir="c:/fb/git/xgewerbeordnung-spezifikation/build/sch" includes="*.sch"/>
</copy>
</target>
<target name="compile-scenario" depends="init">
<filter token="build.date" value="${build.date}"/>
<copy file="${src.dir}/scenarios.xml" todir="${repository.dir}" failonerror="true" filtering="true"/>
</target>
<target name="compile"
depends="compile-scenario,retrieve,prepare-validationtool,prepare-saxon,prepare-schematron">
<echo>Compiling Schemas and XSLTs ...</echo>
<copy file="${src.dir}/default-report.xsl" todir="${resource.dir}"/>
<!-- Following unzip also creates ${resource.dir}/xsd directory-->
<unzip src="${lib.dir}/${validationtool.jar}" dest="${build.dir}">
<patternset>
<include name="xsd/scenarios.xsd"/>
</patternset>
</unzip>
<copy file="${src.dir}/report.xsd" todir="${build.dir}/xsd"/>
<copy todir="${resource.dir}/xgewerbeanzeige-2.2" flatten="true">
<fileset dir="${download.dir}/xgewerbeanzeige-2.2" >
<include name="**/*.xsd"/>
<include name="**/*.sch"/>
</fileset>
</copy>
<xslt in="${download.dir}/xgewerbeanzeige-2.2/spezifikation.sch" out="${resource.dir}/xgewerbeanzeige-2.2/spezifikation.xsl" style="${download.dir}/schematron/iso_svrl_for_xslt2.xsl">
<classpath location="${lib.dir}/${saxon.jar}"/>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<param name="generate-fired-rule" expression="false"/>
<param name="full-path-notation" expression="3"/>
</xslt>
<copy todir="${resource.dir}/xgewerbeordnung-1.0" flatten="true">
<fileset dir="${download.dir}/xgewerbeordnung-1.0">
<include name="**/*.xsd"/>
<include name="**/*.sch"/>
</fileset>
</copy>
<xslt in="${download.dir}/xgewerbeordnung-1.0/spezifikation.sch" out="${resource.dir}/xgewerbeordnung-1.0/spezifikation.xsl" style="${download.dir}/schematron/iso_svrl_for_xslt2.xsl">
<classpath location="${lib.dir}/${saxon.jar}"/>
<factory name="net.sf.saxon.TransformerFactoryImpl"/>
<param name="generate-fired-rule" expression="false"/>
<param name="full-path-notation" expression="3"/>
</xslt>
<copy todir="${build.dir}">
<fileset dir="." includes="beispiele/**/*"/>
</copy>
</target>
<target name="dist" depends="compile" description="Generate the distribution">
<zip destfile="${dist.dir}/validator-configuration-xgewerbeordnung_${build.date}.zip" basedir="${build.dir}"
excludes="download/**,test"/>
</target>
<target name="clean" description="clean up">
<!-- Delete the ${build} and ${dist} directory trees -->
<delete dir="${build.dir}" verbose="true" includeEmptyDirs="true"/>
<delete dir="${dist.dir}"/>
<delete dir="${reports.dir}"/>
</target>
</project>