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