blob: 96e1c1202c4669e52d4aecc80a0c74251b88606b [file] [log] [blame]
Carmelo Cascone17fc9e42016-05-31 11:29:21 -07001<?xml version="1.0" encoding="UTF-8"?>
2<!--
3 ~ Copyright 2016-present Open Networking Laboratory
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<project xmlns="http://maven.apache.org/POM/4.0.0"
19 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
21 <parent>
22 <artifactId>onos-bmv2-protocol</artifactId>
23 <groupId>org.onosproject</groupId>
Carmelo Cascone0831efb2016-05-31 14:50:19 -070024 <version>1.7.0-SNAPSHOT</version>
25 <relativePath>../pom.xml</relativePath>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070026 </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 -->
Carmelo Cascone25f18882016-06-14 19:16:50 -070036 <bmv2.commit>024aa03e3b52f8d32c26774511e8e5b1dc11ec65</bmv2.commit>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070037 <bmv2.thrift.version>0.9.3</bmv2.thrift.version>
38 <!-- Do not change below -->
39 <bmv2.baseurl>
Carmelo Cascone25f18882016-06-14 19:16:50 -070040 https://raw.githubusercontent.com/opennetworkinglab/behavioral-model/${bmv2.commit}
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070041 </bmv2.baseurl>
42 <bmv2.thrift.srcdir>${project.basedir}/src/main/thrift</bmv2.thrift.srcdir>
43 <thrift.path>${project.build.directory}/thrift-compiler/</thrift.path>
44 <thrift.filename>thrift-${os.detected.classifier}.exe</thrift.filename>
45 </properties>
46
47 <dependencies>
48 <dependency>
49 <groupId>org.apache.thrift</groupId>
50 <artifactId>libthrift</artifactId>
51 <version>0.9.3</version>
52 </dependency>
53 </dependencies>
54
55 <repositories>
56 <!-- Needed for thrift-compiler, which is hosted on GitHub -->
57 <repository>
58 <id>jitpack.io</id>
59 <url>https://jitpack.io</url>
60 </repository>
61 </repositories>
62
63 <build>
64 <extensions>
65 <extension>
66 <groupId>kr.motd.maven</groupId>
67 <artifactId>os-maven-plugin</artifactId>
68 <version>1.4.0.Final</version>
69 </extension>
70 </extensions>
71
72 <plugins>
73 <!-- Download Thrift source files from BMv2 Github repo -->
74 <plugin>
75 <groupId>org.codehaus.mojo</groupId>
76 <artifactId>wagon-maven-plugin</artifactId>
77 <version>1.0</version>
78 <executions>
79 <execution>
80 <id>download-bmv2-thrift-standard</id>
81 <phase>initialize</phase>
82 <goals>
83 <goal>download-single</goal>
84 </goals>
85 <configuration>
86 <url>${bmv2.baseurl}</url>
87 <fromFile>thrift_src/standard.thrift</fromFile>
88 <toDir>${bmv2.thrift.srcdir}</toDir>
89 </configuration>
90 </execution>
91 <execution>
92 <id>download-bmv2-thrift-simple_pre</id>
93 <phase>initialize</phase>
94 <goals>
95 <goal>download-single</goal>
96 </goals>
97 <configuration>
98 <url>${bmv2.baseurl}</url>
99 <fromFile>thrift_src/simple_pre.thrift</fromFile>
100 <toDir>${bmv2.thrift.srcdir}</toDir>
101 </configuration>
102 </execution>
103 <execution>
104 <id>download-bmv2-thrift-simple_pre_lag</id>
105 <phase>initialize</phase>
106 <goals>
107 <goal>download-single</goal>
108 </goals>
109 <configuration>
110 <url>${bmv2.baseurl}</url>
111 <fromFile>thrift_src/simple_pre_lag.thrift
112 </fromFile>
113 <toDir>${bmv2.thrift.srcdir}</toDir>
114 </configuration>
115 </execution>
116 <execution>
117 <id>download-bmv2-thrift-simple_switch</id>
118 <phase>initialize</phase>
119 <goals>
120 <goal>download-single</goal>
121 </goals>
122 <configuration>
123 <url>${bmv2.baseurl}</url>
124 <fromFile>
125 targets/simple_switch/thrift/simple_switch.thrift
126 </fromFile>
127 <toDir>${bmv2.thrift.srcdir}</toDir>
128 </configuration>
129 </execution>
130 <execution>
131 <id>download-bmv2-thrift-simple_switch-cpservice</id>
132 <phase>initialize</phase>
133 <goals>
134 <goal>download-single</goal>
135 </goals>
136 <configuration>
137 <url>${bmv2.baseurl}</url>
138 <fromFile>
139 targets/simple_switch/thrift/control_plane.thrift
140 </fromFile>
141 <toDir>${bmv2.thrift.srcdir}</toDir>
142 </configuration>
143 </execution>
144 </executions>
145 </plugin>
146 <!-- Extract Thrift compiler -->
147 <plugin>
148 <groupId>org.apache.maven.plugins</groupId>
149 <artifactId>maven-dependency-plugin</artifactId>
150 <executions>
151 <execution>
152 <id>unpack</id>
153 <phase>initialize</phase>
154 <goals>
155 <goal>unpack</goal>
156 </goals>
157 <configuration>
158 <artifactItems>
159 <artifactItem>
160 <groupId>com.github.ccascone</groupId>
161 <artifactId>mvn-thrift-compiler</artifactId>
162 <version>1.1_${bmv2.thrift.version}</version>
163 <type>jar</type>
164 <includes>${thrift.filename}</includes>
165 <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory>
166 </artifactItem>
167 </artifactItems>
168 </configuration>
169 </execution>
170 </executions>
171 </plugin>
172 <!-- Add missing java namespace to Thrift files -->
173 <plugin>
174 <groupId>org.codehaus.mojo</groupId>
175 <artifactId>exec-maven-plugin</artifactId>
176 <version>1.4.0</version>
177 <executions>
178 <execution>
179 <id>add-bmv2-thrift-java-namespace</id>
180 <phase>initialize</phase>
181 <goals>
182 <goal>exec</goal>
183 </goals>
184 <configuration>
185 <executable>${bmv2.thrift.srcdir}/patch.sh
186 </executable>
187 </configuration>
188 </execution>
189 <execution>
190 <id>set-thrift-compiler-permissions</id>
191 <phase>initialize</phase>
192 <goals>
193 <goal>exec</goal>
194 </goals>
195 <configuration>
196 <executable>chmod</executable>
197 <arguments>
198 <argument>+x</argument>
199 <argument>${thrift.path}/${thrift.filename}</argument>
200 </arguments>
201 </configuration>
202 </execution>
203 </executions>
204 </plugin>
205 <!-- Compile Thrift files -->
206 <plugin>
207 <groupId>org.apache.thrift.tools</groupId>
208 <artifactId>maven-thrift-plugin</artifactId>
209 <version>0.1.11</version>
210 <configuration>
211 <thriftExecutable>${thrift.path}/${thrift.filename}</thriftExecutable>
212 <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
213 </configuration>
214 <executions>
215 <execution>
216 <id>thrift-sources</id>
217 <phase>initialize</phase>
218 <goals>
219 <goal>compile</goal>
220 </goals>
221 </execution>
222 </executions>
223 </plugin>
224 <!-- Make generated sources visible -->
225 <plugin>
226 <groupId>org.codehaus.mojo</groupId>
227 <artifactId>build-helper-maven-plugin</artifactId>
228 <version>1.4</version>
229 <executions>
230 <execution>
231 <id>add-thrift-sources-to-path</id>
232 <phase>generate-sources</phase>
233 <goals>
234 <goal>add-source</goal>
235 </goals>
236 <configuration>
237 <sources>
238 <source>
239 ${project.build.directory}/generated-sources
240 </source>
241 </sources>
242 </configuration>
243 </execution>
244 </executions>
245 </plugin>
246 </plugins>
247 </build>
248</project>