18eaed98ec17c35d3847746677c0e704e3fe8bde
[controller.git] / opendaylight / northbound / swagger-ui / pom.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3   <modelVersion>4.0.0</modelVersion>
4   <parent>
5     <groupId>org.opendaylight.controller</groupId>
6     <artifactId>commons.opendaylight</artifactId>
7     <version>1.4.2-SNAPSHOT</version>
8     <relativePath>../../commons/opendaylight</relativePath>
9   </parent>
10
11   <artifactId>swagger-ui</artifactId>
12   <version>0.0.1-SNAPSHOT</version>
13   <packaging>bundle</packaging>
14
15   <properties>
16     <api.dir>${resource.dir}/apis</api.dir>
17     <resource.dir>${project.build.directory}/classes</resource.dir>
18   </properties>
19
20   <dependencies>
21     <dependency>
22       <groupId>com.google.code.gson</groupId>
23       <artifactId>gson</artifactId>
24     </dependency>
25     <dependency>
26       <groupId>equinoxSDK381</groupId>
27       <artifactId>javax.servlet</artifactId>
28     </dependency>
29     <!-- add dependency on all northbound bundles -->
30     <dependency>
31       <groupId>org.opendaylight.controller</groupId>
32       <artifactId>connectionmanager.northbound</artifactId>
33     </dependency>
34     <dependency>
35       <groupId>org.opendaylight.controller</groupId>
36       <artifactId>controllermanager.northbound</artifactId>
37     </dependency>
38     <dependency>
39       <groupId>org.opendaylight.controller</groupId>
40       <artifactId>flowprogrammer.northbound</artifactId>
41     </dependency>
42     <dependency>
43       <groupId>org.opendaylight.controller</groupId>
44       <artifactId>forwarding.staticrouting.northbound</artifactId>
45     </dependency>
46     <dependency>
47       <groupId>org.opendaylight.controller</groupId>
48       <artifactId>hosttracker.northbound</artifactId>
49     </dependency>
50     <dependency>
51       <groupId>org.opendaylight.controller</groupId>
52       <artifactId>networkconfig.bridgedomain.northbound</artifactId>
53     </dependency>
54     <dependency>
55       <groupId>org.opendaylight.controller</groupId>
56       <artifactId>statistics.northbound</artifactId>
57     </dependency>
58     <dependency>
59       <groupId>org.opendaylight.controller</groupId>
60       <artifactId>subnets.northbound</artifactId>
61     </dependency>
62     <dependency>
63       <groupId>org.opendaylight.controller</groupId>
64       <artifactId>switchmanager.northbound</artifactId>
65     </dependency>
66     <dependency>
67       <groupId>org.opendaylight.controller</groupId>
68       <artifactId>topology.northbound</artifactId>
69     </dependency>
70     <dependency>
71       <groupId>org.opendaylight.controller</groupId>
72       <artifactId>usermanager.northbound</artifactId>
73     </dependency>
74     <dependency>
75       <groupId>org.slf4j</groupId>
76       <artifactId>slf4j-api</artifactId>
77     </dependency>
78   </dependencies>
79
80   <build>
81     <plugins>
82       <plugin>
83         <groupId>org.apache.felix</groupId>
84         <artifactId>maven-bundle-plugin</artifactId>
85         <extensions>true</extensions>
86         <configuration>
87           <instructions>
88             <Export-Package></Export-Package>
89             <Import-Package>org.slf4j,
90               javax.annotation,
91               javax.naming,
92               javax.servlet,
93               javax.servlet.annotation,
94               javax.servlet.http,
95               com.google.gson,</Import-Package>
96             <Export-Package></Export-Package>
97             <Include-Resource>apis=target/classes/apis,
98                 index.html=target/classes/index.html,
99                 apilist.json=target/classes/apilist.json,
100                 css=target/classes/css,
101                 lib=target/classes/lib,
102                 swagger-ui.min.js=target/classes/swagger-ui.min.js,
103                 swagger-ui.js=target/classes/swagger-ui.js,
104                 images=target/classes/images,
105                 WEB-INF/web.xml=target/classes/WEB-INF/web.xml</Include-Resource>
106             <Web-ContextPath>/swagger</Web-ContextPath>
107           </instructions>
108         </configuration>
109       </plugin>
110       <plugin>
111         <groupId>org.apache.maven.plugins</groupId>
112         <artifactId>maven-antrun-plugin</artifactId>
113         <version>1.7</version>
114         <dependencies>
115           <dependency>
116             <groupId>ant-contrib</groupId>
117             <artifactId>ant-contrib</artifactId>
118             <version>1.0b3</version>
119             <exclusions>
120               <exclusion>
121                 <groupId>ant</groupId>
122                 <artifactId>ant</artifactId>
123               </exclusion>
124             </exclusions>
125           </dependency>
126         </dependencies>
127         <executions>
128           <execution>
129             <goals>
130               <goal>run</goal>
131             </goals>
132             <phase>generate-sources</phase>
133             <configuration>
134               <target>
135                 <taskdef classpathref="maven.plugin.classpath" resource="net/sf/antcontrib/antlib.xml"></taskdef>
136                 <patternset id="rest.paths">
137                   <include name="**/enunciate/generate/swagger/ui/*.json"></include>
138                   <exclude name="**/java-client/**"></exclude>
139                   <exclude name="**/swagger-ui/**"></exclude>
140                 </patternset>
141
142                 <echo message="======== Assembling swagger docs ========"></echo>
143                 <!-- make api directory -->
144                 <mkdir dir="${api.dir}"></mkdir>
145                 <!--  copy swagger libs -->
146                 <copy todir="${resource.dir}">
147                   <fileset dir="../subnets/target/enunciate/generate/swagger/ui">
148                     <exclude name="**/*.json"></exclude>
149                     <exclude name="**/*.png"></exclude>
150                     <exclude name="**/index.html"></exclude>
151                   </fileset>
152                 </copy>
153                 <!--  Copy NorthBound json files into ui directory-->
154                 <copy todir="${api.dir}">
155                   <fileset dir="${basedir}/../../..">
156                     <patternset refid="rest.paths"></patternset>
157                   </fileset>
158                   <mapper>
159                     <regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*Northbound).*$$" to="\3"></regexpmapper>
160                     <regexpmapper from="^(.*)/([^/]+)/*/target/enunciate/generate/swagger/ui/(.*resource-list.json)$$" to="\2-\3"></regexpmapper>
161                   </mapper>
162                 </copy>
163
164                 <!--  Correct base path -->
165                 <replaceregexp match="/full" replace="">
166                   <fileset dir="${api.dir}">
167                     <include name="**/*Northbound"></include>
168                   </fileset>
169                 </replaceregexp>
170                 <!--  Merge Resource list -->
171                 <echo append="false" file="${resource.dir}/apilist.json">{
172   "swaggerVersion": "1.1",
173   "basePath": "http://localhost:8080/swagger/apis",
174   "apis": [</echo>
175                 <for param="file">
176                   <path>
177                     <fileset dir="${api.dir}">
178                       <include name="**/*resource-list.json"></include>
179                       <exclude name="**/neutron*"></exclude>
180                     </fileset>
181                   </path>
182                   <sequential>
183                     <echo message="Processing json resource @{file}"></echo>
184                     <loadfile property="jsoncontent" srcfile="@{file}">
185                       <filterchain>
186                         <headfilter lines="10"></headfilter>
187                         <tailfilter lines="6"></tailfilter>
188                       </filterchain>
189                     </loadfile>
190                     <echo append="true" file="${resource.dir}/apilist.json" message="${jsoncontent},"></echo>
191                     <var name="jsoncontent" unset="true"></var>
192                   </sequential>
193                 </for>
194                 <sequential>
195                   <loadfile property="jsoncontent" srcfile="${api.dir}/neutron-resource-list.json">
196                     <filterchain>
197                       <headfilter lines="46"></headfilter>
198                       <tailfilter lines="42"></tailfilter>
199                     </filterchain>
200                   </loadfile>
201                   <echo append="true" file="${resource.dir}/apilist.json" message="${jsoncontent},"></echo>
202                   <var name="jsoncontent" unset="true"></var>
203                 </sequential>
204                 <echo append="true" file="${resource.dir}/apilist.json">{ }
205   ]
206 }</echo>
207
208                 <!-- Remove .json from api paths -->
209                 <replaceregexp file="${resource.dir}/apilist.json" flags="g" match=".json" replace=""></replaceregexp>
210                 <replaceregexp file="${resource.dir}/apilist.json" flags="g" match="JAXRS" replace=""></replaceregexp>
211
212                 <!-- cleanup resource files as we don't need them -->
213                 <delete>
214                   <fileset dir="${api.dir}" includes="**/*resource-list.json"></fileset>
215                 </delete>
216                 <echo message="======== Build successful ========"></echo>
217               </target>
218             </configuration>
219           </execution>
220         </executions>
221       </plugin>
222     </plugins>
223   </build>
224   <scm>
225     <connection>scm:git:ssh://git.opendaylight.org:29418/controller.git</connection>
226     <developerConnection>scm:git:ssh://git.opendaylight.org:29418/controller.git</developerConnection>
227     <tag>HEAD</tag>
228     <url>https://wiki.opendaylight.org/view/OpenDaylight_Controller:Main</url>
229   </scm>
230 </project>