blob: 3514bed403f543b85afd6c969bb422912974e02e [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>
Ray Milkey08b03a92017-05-15 11:26:33 -070024 <version>1.11.0-SNAPSHOT</version>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070025 </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 -->
Carmelo Cascone62f1e1e2016-06-22 01:43:49 -070035 <bmv2.commit>8f675d0284e9e014f1b8ed502ba54e61d68108cf</bmv2.commit>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070036 <bmv2.thrift.version>0.9.3</bmv2.thrift.version>
Carmelo Cascone62f1e1e2016-06-22 01:43:49 -070037 <bmv2.baseurl>https://cdn.rawgit.com/opennetworkinglab/onos-bmv2/${bmv2.commit}</bmv2.baseurl>
Carmelo Cascone3f856842016-06-15 11:20:28 -070038 <bmv2.thrift.javanamespace>org.onosproject.bmv2.thriftapi</bmv2.thrift.javanamespace>
39 <bmv2.thrift.srcdir>${project.build.directory}/thrift-sources/${bmv2.commit}/</bmv2.thrift.srcdir>
40 <thrift.exedir>${project.build.directory}/thrift-compiler/</thrift.exedir>
41 <thrift.exefilename>thrift-${os.detected.classifier}.exe</thrift.exefilename>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070042 </properties>
43
44 <dependencies>
45 <dependency>
46 <groupId>org.apache.thrift</groupId>
47 <artifactId>libthrift</artifactId>
48 <version>0.9.3</version>
49 </dependency>
50 </dependencies>
51
52 <repositories>
53 <!-- Needed for thrift-compiler, which is hosted on GitHub -->
54 <repository>
55 <id>jitpack.io</id>
56 <url>https://jitpack.io</url>
57 </repository>
58 </repositories>
59
60 <build>
61 <extensions>
62 <extension>
63 <groupId>kr.motd.maven</groupId>
64 <artifactId>os-maven-plugin</artifactId>
65 <version>1.4.0.Final</version>
66 </extension>
67 </extensions>
68
69 <plugins>
70 <!-- Download Thrift source files from BMv2 Github repo -->
71 <plugin>
Carmelo Cascone3f856842016-06-15 11:20:28 -070072 <groupId>com.googlecode.maven-download-plugin</groupId>
73 <artifactId>download-maven-plugin</artifactId>
74 <version>1.3.0</version>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070075 <executions>
76 <execution>
77 <id>download-bmv2-thrift-standard</id>
78 <phase>initialize</phase>
79 <goals>
Carmelo Cascone3f856842016-06-15 11:20:28 -070080 <goal>wget</goal>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070081 </goals>
82 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -070083 <url>${bmv2.baseurl}/thrift_src/standard.thrift</url>
84 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070085 </configuration>
86 </execution>
87 <execution>
88 <id>download-bmv2-thrift-simple_pre</id>
89 <phase>initialize</phase>
90 <goals>
Carmelo Cascone3f856842016-06-15 11:20:28 -070091 <goal>wget</goal>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070092 </goals>
93 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -070094 <url>${bmv2.baseurl}/thrift_src/simple_pre.thrift</url>
95 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -070096 </configuration>
97 </execution>
98 <execution>
99 <id>download-bmv2-thrift-simple_pre_lag</id>
100 <phase>initialize</phase>
101 <goals>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700102 <goal>wget</goal>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700103 </goals>
104 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700105 <url>${bmv2.baseurl}/thrift_src/simple_pre_lag.thrift</url>
106 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700107 </configuration>
108 </execution>
109 <execution>
110 <id>download-bmv2-thrift-simple_switch</id>
111 <phase>initialize</phase>
112 <goals>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700113 <goal>wget</goal>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700114 </goals>
115 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700116 <url>${bmv2.baseurl}/targets/simple_switch/thrift/simple_switch.thrift</url>
117 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700118 </configuration>
119 </execution>
120 <execution>
121 <id>download-bmv2-thrift-simple_switch-cpservice</id>
122 <phase>initialize</phase>
123 <goals>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700124 <goal>wget</goal>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700125 </goals>
126 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700127 <url>${bmv2.baseurl}/targets/simple_switch/thrift/control_plane.thrift</url>
128 <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700129 </configuration>
130 </execution>
131 </executions>
132 </plugin>
133 <!-- Extract Thrift compiler -->
134 <plugin>
135 <groupId>org.apache.maven.plugins</groupId>
136 <artifactId>maven-dependency-plugin</artifactId>
137 <executions>
138 <execution>
139 <id>unpack</id>
140 <phase>initialize</phase>
141 <goals>
142 <goal>unpack</goal>
143 </goals>
144 <configuration>
145 <artifactItems>
146 <artifactItem>
147 <groupId>com.github.ccascone</groupId>
148 <artifactId>mvn-thrift-compiler</artifactId>
149 <version>1.1_${bmv2.thrift.version}</version>
150 <type>jar</type>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700151 <includes>${thrift.exefilename}</includes>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700152 <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory>
153 </artifactItem>
154 </artifactItems>
155 </configuration>
156 </execution>
157 </executions>
158 </plugin>
159 <!-- Add missing java namespace to Thrift files -->
160 <plugin>
161 <groupId>org.codehaus.mojo</groupId>
162 <artifactId>exec-maven-plugin</artifactId>
163 <version>1.4.0</version>
164 <executions>
165 <execution>
166 <id>add-bmv2-thrift-java-namespace</id>
167 <phase>initialize</phase>
168 <goals>
169 <goal>exec</goal>
170 </goals>
171 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700172 <executable>${project.basedir}/src/patch.sh</executable>
173 <arguments>
174 <argument>${bmv2.thrift.srcdir}</argument>
175 <argument>${bmv2.thrift.javanamespace}</argument>
176 </arguments>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700177 </configuration>
178 </execution>
179 <execution>
180 <id>set-thrift-compiler-permissions</id>
181 <phase>initialize</phase>
182 <goals>
183 <goal>exec</goal>
184 </goals>
185 <configuration>
186 <executable>chmod</executable>
187 <arguments>
188 <argument>+x</argument>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700189 <argument>${thrift.exedir}/${thrift.exefilename}</argument>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700190 </arguments>
191 </configuration>
192 </execution>
193 </executions>
194 </plugin>
195 <!-- Compile Thrift files -->
196 <plugin>
197 <groupId>org.apache.thrift.tools</groupId>
198 <artifactId>maven-thrift-plugin</artifactId>
199 <version>0.1.11</version>
200 <configuration>
Carmelo Cascone3f856842016-06-15 11:20:28 -0700201 <thriftSourceRoot>${bmv2.thrift.srcdir}</thriftSourceRoot>
202 <thriftExecutable>${thrift.exedir}/${thrift.exefilename}</thriftExecutable>
Carmelo Cascone17fc9e42016-05-31 11:29:21 -0700203 <outputDirectory>${project.build.directory}/generated-sources</outputDirectory>
204 </configuration>
205 <executions>
206 <execution>
207 <id>thrift-sources</id>
208 <phase>initialize</phase>
209 <goals>
210 <goal>compile</goal>
211 </goals>
212 </execution>
213 </executions>
214 </plugin>
215 <!-- Make generated sources visible -->
216 <plugin>
217 <groupId>org.codehaus.mojo</groupId>
218 <artifactId>build-helper-maven-plugin</artifactId>
219 <version>1.4</version>
220 <executions>
221 <execution>
222 <id>add-thrift-sources-to-path</id>
223 <phase>generate-sources</phase>
224 <goals>
225 <goal>add-source</goal>
226 </goals>
227 <configuration>
228 <sources>
229 <source>
230 ${project.build.directory}/generated-sources
231 </source>
232 </sources>
233 </configuration>
234 </execution>
235 </executions>
236 </plugin>
237 </plugins>
238 </build>
239</project>