-
Notifications
You must be signed in to change notification settings - Fork 4
/
process_swagger.xml
81 lines (73 loc) · 2.08 KB
/
process_swagger.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
<?xml version="1.0" encoding="UTF-8"?>
<!--ant-->
<!--
This file is part of the DITA-OT Swagger Plug-in project.
See the accompanying LICENSE file for applicable licenses.
-->
<project
name="fox.jason.passthrough.swagger"
default="swagger.process"
xmlns:swagger="antlib:fox.jason.passthrough.swagger"
xmlns:if="ant:if"
xmlns:unless="ant:unless"
>
<target name="swagger.css.copy">
<loadfile
property="swagger.css"
srcFile="${dita.plugin.fox.jason.passthrough.swagger.dir}/css/swagger.css"
/>
<echo
append="true"
message="${line.separator}${swagger.css}"
file="${extend.css.file}"
/>
</target>
<!--
Iterate across all files marked format="swagger" and process them
-->
<target name="swagger.process">
<property name="passthrough.input" value=""/>
<property name="passthrough.output" value=""/>
<local name="swagger.temp.file"/>
<local name="swagger.result"/>
<local name="swagger.output"/>
<local name="swagger.error"/>
<local name="swagger.isError"/>
<java
taskname="swagger-gen"
outputproperty="swagger.output"
resultproperty="swagger.result"
errorproperty="swagger.error"
jar="${basedir}/lib/swagger2markup-cli-2.0.0.jar"
fork="true"
failonerror="false"
maxmemory="128m"
>
<arg value="convert"/>
<arg value="-i"/>
<arg value="${passthrough.input}"/>
<arg value="-f"/>
<arg value="${passthrough.output}"/>
<arg value="-c"/>
<arg value="${basedir}/cfg/config.properties"/>
</java>
<condition property="swagger.isError">
<not>
<equals arg1="${swagger.result}" arg2="0"/>
</not>
</condition>
<echo
taskname="swagger-gen"
if:set="swagger.isError"
level="error"
message="${swagger.error}"
/>
<fail
if:set="swagger.isError"
id="SWAG001F"
message="SwaggerGen failed to generate documentation:

 ${passthrough.input}"
/>
<swagger:format-markdown file="${passthrough.output}.md"/>
<move file="${passthrough.output}.md" tofile="${passthrough.output}"/>
</target>
</project>