blob: f595b684baf137b28192f4c7ab365462b12ee894 [file] [log] [blame]
Esin Karaman971fb7f2017-12-28 13:44:52 +00001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 ~ Copyright 2018-present Open Networking Foundation
4 ~
5 ~ Licensed under the Apache License, Version 2.0 (the "License");
6 ~ you may not use this file except in compliance with the License.
7 ~ You may obtain a copy of the License at
8 ~
9 ~ http://www.apache.org/licenses/LICENSE-2.0
10 ~
11 ~ Unless required by applicable law or agreed to in writing, software
12 ~ distributed under the License is distributed on an "AS IS" BASIS,
13 ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 ~ See the License for the specific language governing permissions and
15 ~ limitations under the License.
16 ~
17 -->
18
19<project xmlns="http://maven.apache.org/POM/4.0.0"
20 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
21 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
22 <parent>
23 <artifactId>onos-bmv2-protocol</artifactId>
24 <groupId>org.onosproject</groupId>
25 <version>1.13.0-SNAPSHOT</version>
26 </parent>
27
28 <modelVersion>4.0.0</modelVersion>
29
30 <artifactId>onos-bmv2-protocol-thrift-api</artifactId>
31
32 <packaging>bundle</packaging>
33
34 <properties>
35 <!-- BMv2 Commit ID and Thrift version -->
36 <bmv2.commit>8f675d0284e9e014f1b8ed502ba54e61d68108cf</bmv2.commit>
37 <bmv2.thrift.version>0.9.3</bmv2.thrift.version>
38 <bmv2.baseurl>https://cdn.rawgit.com/opennetworkinglab/onos-bmv2/${bmv2.commit}</bmv2.baseurl>
39 <bmv2.thrift.javanamespace>org.onosproject.bmv2.thriftapi</bmv2.thrift.javanamespace>
40 <bmv2.thrift.srcdir>${project.build.directory}/thrift-sources/${bmv2.commit}/</bmv2.thrift.srcdir>
41 <thrift.exedir>${project.build.directory}/thrift-compiler/</thrift.exedir>
42 <thrift.exefilename>thrift-${os.detected.classifier}.exe</thrift.exefilename>
43 </properties>
44
45 <dependencies>
46 <dependency>
47 <groupId>org.apache.thrift</groupId>
48 <artifactId>libthrift</artifactId>
49 <version>0.9.3</version>
50 </dependency>
51 </dependencies>
52
53 <repositories>
54 <!-- Needed for thrift-compiler, which is hosted on GitHub -->
55 <repository>
56 <id>jitpack.io</id>
57 <url>https://jitpack.io</url>
58 </repository>
59 </repositories>
60
61 <build>
62 <extensions>
63 <extension>
64 <groupId>kr.motd.maven</groupId>
65 <artifactId>os-maven-plugin</artifactId>
66 <version>1.4.0.Final</version>
67 </extension>
68 </extensions>
69
70 <plugins>
71 <!-- Download Thrift source files from BMv2 Github repo -->
72 <plugin>
73 <groupId>com.googlecode.maven-download-plugin</groupId>
74 <artifactId>download-maven-plugin</artifactId>
75 <version>1.3.0</version>
76 <executions>
77 <execution>
78 <id>download-bmv2-thrift-standard</id>
79 <phase>initialize</phase>
80 <goals>
81 <goal>wget</goal>
82 </goals>
83 <configuration>
84 <url>${bmv2.baseurl}/thrift_src/standard.thrift</url>
85 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
86 </configuration>
87 </execution>
88 <execution>
89 <id>download-bmv2-thrift-simple_pre</id>
90 <phase>initialize</phase>
91 <goals>
92 <goal>wget</goal>
93 </goals>
94 <configuration>
95 <url>${bmv2.baseurl}/thrift_src/simple_pre.thrift</url>
96 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
97 </configuration>
98 </execution>
99 <execution>
100 <id>download-bmv2-thrift-simple_pre_lag</id>
101 <phase>initialize</phase>
102 <goals>
103 <goal>wget</goal>
104 </goals>
105 <configuration>
106 <url>${bmv2.baseurl}/thrift_src/simple_pre_lag.thrift</url>
107 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
108 </configuration>
109 </execution>
110 <execution>
111 <id>download-bmv2-thrift-simple_switch</id>
112 <phase>initialize</phase>
113 <goals>
114 <goal>wget</goal>
115 </goals>
116 <configuration>
117 <url>${bmv2.baseurl}/targets/simple_switch/thrift/simple_switch.thrift</url>
118 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
119 </configuration>
120 </execution>
121 <execution>
122 <id>download-bmv2-thrift-simple_switch-cpservice</id>
123 <phase>initialize</phase>
124 <goals>
125 <goal>wget</goal>
126 </goals>
127 <configuration>
128 <url>${bmv2.baseurl}/targets/simple_switch/thrift/control_plane.thrift</url>
129 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
130 </configuration>
131 </execution>
132 </executions>
133 </plugin>
134 <!-- Extract Thrift compiler -->
135 <plugin>
136 <groupId>org.apache.maven.plugins</groupId>
137 <artifactId>maven-dependency-plugin</artifactId>
138 <executions>
139 <execution>
140 <id>unpack</id>
141 <phase>initialize</phase>
142 <goals>
143 <goal>unpack</goal>
144 </goals>
145 <configuration>
146 <artifactItems>
147 <artifactItem>
148 <groupId>com.github.ccascone</groupId>
149 <artifactId>mvn-thrift-compiler</artifactId>
150 <version>1.1_${bmv2.thrift.version}</version>
151 <type>jar</type>
152 <includes>${thrift.exefilename}</includes>
153 <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory>
154 </artifactItem>
155 </artifactItems>
156 </configuration>
157 </execution>
158 </executions>
159 </plugin>
160 <!-- Add missing java namespace to Thrift files -->
161 <plugin>
162 <groupId>org.codehaus.mojo</groupId>
163 <artifactId>exec-maven-plugin</artifactId>
164 <version>1.4.0</version>
165 <executions>
166 <execution>
167 <id>add-bmv2-thrift-java-namespace</id>
168 <phase>initialize</phase>
169 <goals>
170 <goal>exec</goal>
171 </goals>
172 <configuration>
173 <executable>${project.basedir}/src/patch.sh</executable>
174 <arguments>
175 <argument>${bmv2.thrift.srcdir}</argument>
176 <argument>${bmv2.thrift.javanamespace}</argument>
177 </arguments>
178 </configuration>
179 </execution>
180 <execution>
181 <id>set-thrift-compiler-permissions</id>
182 <phase>initialize</phase>
183 <goals>
184 <goal>exec</goal>
185 </goals>
186 <configuration>
187 <executable>chmod</executable>
188 <arguments>
189 <argument>+x</argument>
190 <argument>${thrift.exedir}/${thrift.exefilename}</argument>
191 </arguments>
192 </configuration>
193 </execution>
194 </executions>
195 </plugin>
196 <!-- Compile Thrift files -->
197 <plugin>
198 <groupId>org.apache.thrift.tools</groupId>
199 <artifactId>maven-thrift-plugin</artifactId>
200 <version>0.1.11</version>
201 <configuration>
202 <thriftSourceRoot>${bmv2.thrift.srcdir}</thriftSourceRoot>
203 <thriftExecutable>${thrift.exedir}/${thrift.exefilename}</thriftExecutable>
204 <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
205 </configuration>
206 <executions>
207 <execution>
208 <id>thrift-sources</id>
209 <phase>initialize</phase>
210 <goals>
211 <goal>compile</goal>
212 </goals>
213 </execution>
214 </executions>
215 </plugin>
216 <!-- Make generated sources visible -->
217 <plugin>
218 <groupId>org.codehaus.mojo</groupId>
219 <artifactId>build-helper-maven-plugin</artifactId>
220 <version>1.4</version>
221 <executions>
222 <execution>
223 <id>add-thrift-sources-to-path</id>
224 <phase>generate-sources</phase>
225 <goals>
226 <goal>add-source</goal>
227 </goals>
228 <configuration>
229 <sources>
230 <source>
231 ${project.build.directory}/generated-sources
232 </source>
233 </sources>
234 </configuration>
235 </execution>
236 </executions>
237 </plugin>
238 </plugins>
239 </build>
240</project>