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