Added caching for bmv2 thrift sources
No need for internet connectivity after the first maven build. Also switched to rawgit.com hosting (no throttling of requests). Minor polishing of the patch script and module structure. Change-Id: I065a62bddc779c698f4b76865525bf4d973ad2ab
Showing
3 changed files
with
38 additions
and
45 deletions
... | @@ -34,13 +34,11 @@ | ... | @@ -34,13 +34,11 @@ |
34 | <!-- BMv2 Commit ID and Thrift version --> | 34 | <!-- BMv2 Commit ID and Thrift version --> |
35 | <bmv2.commit>024aa03e3b52f8d32c26774511e8e5b1dc11ec65</bmv2.commit> | 35 | <bmv2.commit>024aa03e3b52f8d32c26774511e8e5b1dc11ec65</bmv2.commit> |
36 | <bmv2.thrift.version>0.9.3</bmv2.thrift.version> | 36 | <bmv2.thrift.version>0.9.3</bmv2.thrift.version> |
37 | - <!-- Do not change below --> | 37 | + <bmv2.baseurl>https://cdn.rawgit.com/opennetworkinglab/behavioral-model/${bmv2.commit}</bmv2.baseurl> |
38 | - <bmv2.baseurl> | 38 | + <bmv2.thrift.javanamespace>org.onosproject.bmv2.thriftapi</bmv2.thrift.javanamespace> |
39 | - https://raw.githubusercontent.com/opennetworkinglab/behavioral-model/${bmv2.commit} | 39 | + <bmv2.thrift.srcdir>${project.build.directory}/thrift-sources/${bmv2.commit}/</bmv2.thrift.srcdir> |
40 | - </bmv2.baseurl> | 40 | + <thrift.exedir>${project.build.directory}/thrift-compiler/</thrift.exedir> |
41 | - <bmv2.thrift.srcdir>${project.basedir}/src/main/thrift</bmv2.thrift.srcdir> | 41 | + <thrift.exefilename>thrift-${os.detected.classifier}.exe</thrift.exefilename> |
42 | - <thrift.path>${project.build.directory}/thrift-compiler/</thrift.path> | ||
43 | - <thrift.filename>thrift-${os.detected.classifier}.exe</thrift.filename> | ||
44 | </properties> | 42 | </properties> |
45 | 43 | ||
46 | <dependencies> | 44 | <dependencies> |
... | @@ -71,73 +69,63 @@ | ... | @@ -71,73 +69,63 @@ |
71 | <plugins> | 69 | <plugins> |
72 | <!-- Download Thrift source files from BMv2 Github repo --> | 70 | <!-- Download Thrift source files from BMv2 Github repo --> |
73 | <plugin> | 71 | <plugin> |
74 | - <groupId>org.codehaus.mojo</groupId> | 72 | + <groupId>com.googlecode.maven-download-plugin</groupId> |
75 | - <artifactId>wagon-maven-plugin</artifactId> | 73 | + <artifactId>download-maven-plugin</artifactId> |
76 | - <version>1.0</version> | 74 | + <version>1.3.0</version> |
77 | <executions> | 75 | <executions> |
78 | <execution> | 76 | <execution> |
79 | <id>download-bmv2-thrift-standard</id> | 77 | <id>download-bmv2-thrift-standard</id> |
80 | <phase>initialize</phase> | 78 | <phase>initialize</phase> |
81 | <goals> | 79 | <goals> |
82 | - <goal>download-single</goal> | 80 | + <goal>wget</goal> |
83 | </goals> | 81 | </goals> |
84 | <configuration> | 82 | <configuration> |
85 | - <url>${bmv2.baseurl}</url> | 83 | + <url>${bmv2.baseurl}/thrift_src/standard.thrift</url> |
86 | - <fromFile>thrift_src/standard.thrift</fromFile> | 84 | + <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory> |
87 | - <toDir>${bmv2.thrift.srcdir}</toDir> | ||
88 | </configuration> | 85 | </configuration> |
89 | </execution> | 86 | </execution> |
90 | <execution> | 87 | <execution> |
91 | <id>download-bmv2-thrift-simple_pre</id> | 88 | <id>download-bmv2-thrift-simple_pre</id> |
92 | <phase>initialize</phase> | 89 | <phase>initialize</phase> |
93 | <goals> | 90 | <goals> |
94 | - <goal>download-single</goal> | 91 | + <goal>wget</goal> |
95 | </goals> | 92 | </goals> |
96 | <configuration> | 93 | <configuration> |
97 | - <url>${bmv2.baseurl}</url> | 94 | + <url>${bmv2.baseurl}/thrift_src/simple_pre.thrift</url> |
98 | - <fromFile>thrift_src/simple_pre.thrift</fromFile> | 95 | + <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory> |
99 | - <toDir>${bmv2.thrift.srcdir}</toDir> | ||
100 | </configuration> | 96 | </configuration> |
101 | </execution> | 97 | </execution> |
102 | <execution> | 98 | <execution> |
103 | <id>download-bmv2-thrift-simple_pre_lag</id> | 99 | <id>download-bmv2-thrift-simple_pre_lag</id> |
104 | <phase>initialize</phase> | 100 | <phase>initialize</phase> |
105 | <goals> | 101 | <goals> |
106 | - <goal>download-single</goal> | 102 | + <goal>wget</goal> |
107 | </goals> | 103 | </goals> |
108 | <configuration> | 104 | <configuration> |
109 | - <url>${bmv2.baseurl}</url> | 105 | + <url>${bmv2.baseurl}/thrift_src/simple_pre_lag.thrift</url> |
110 | - <fromFile>thrift_src/simple_pre_lag.thrift | 106 | + <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory> |
111 | - </fromFile> | ||
112 | - <toDir>${bmv2.thrift.srcdir}</toDir> | ||
113 | </configuration> | 107 | </configuration> |
114 | </execution> | 108 | </execution> |
115 | <execution> | 109 | <execution> |
116 | <id>download-bmv2-thrift-simple_switch</id> | 110 | <id>download-bmv2-thrift-simple_switch</id> |
117 | <phase>initialize</phase> | 111 | <phase>initialize</phase> |
118 | <goals> | 112 | <goals> |
119 | - <goal>download-single</goal> | 113 | + <goal>wget</goal> |
120 | </goals> | 114 | </goals> |
121 | <configuration> | 115 | <configuration> |
122 | - <url>${bmv2.baseurl}</url> | 116 | + <url>${bmv2.baseurl}/targets/simple_switch/thrift/simple_switch.thrift</url> |
123 | - <fromFile> | 117 | + <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory> |
124 | - targets/simple_switch/thrift/simple_switch.thrift | ||
125 | - </fromFile> | ||
126 | - <toDir>${bmv2.thrift.srcdir}</toDir> | ||
127 | </configuration> | 118 | </configuration> |
128 | </execution> | 119 | </execution> |
129 | <execution> | 120 | <execution> |
130 | <id>download-bmv2-thrift-simple_switch-cpservice</id> | 121 | <id>download-bmv2-thrift-simple_switch-cpservice</id> |
131 | <phase>initialize</phase> | 122 | <phase>initialize</phase> |
132 | <goals> | 123 | <goals> |
133 | - <goal>download-single</goal> | 124 | + <goal>wget</goal> |
134 | </goals> | 125 | </goals> |
135 | <configuration> | 126 | <configuration> |
136 | - <url>${bmv2.baseurl}</url> | 127 | + <url>${bmv2.baseurl}/targets/simple_switch/thrift/control_plane.thrift</url> |
137 | - <fromFile> | 128 | + <outputDirectory>${bmv2.thrift.srcdir}</outputDirectory> |
138 | - targets/simple_switch/thrift/control_plane.thrift | ||
139 | - </fromFile> | ||
140 | - <toDir>${bmv2.thrift.srcdir}</toDir> | ||
141 | </configuration> | 129 | </configuration> |
142 | </execution> | 130 | </execution> |
143 | </executions> | 131 | </executions> |
... | @@ -160,7 +148,7 @@ | ... | @@ -160,7 +148,7 @@ |
160 | <artifactId>mvn-thrift-compiler</artifactId> | 148 | <artifactId>mvn-thrift-compiler</artifactId> |
161 | <version>1.1_${bmv2.thrift.version}</version> | 149 | <version>1.1_${bmv2.thrift.version}</version> |
162 | <type>jar</type> | 150 | <type>jar</type> |
163 | - <includes>${thrift.filename}</includes> | 151 | + <includes>${thrift.exefilename}</includes> |
164 | <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory> | 152 | <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory> |
165 | </artifactItem> | 153 | </artifactItem> |
166 | </artifactItems> | 154 | </artifactItems> |
... | @@ -181,8 +169,11 @@ | ... | @@ -181,8 +169,11 @@ |
181 | <goal>exec</goal> | 169 | <goal>exec</goal> |
182 | </goals> | 170 | </goals> |
183 | <configuration> | 171 | <configuration> |
184 | - <executable>${bmv2.thrift.srcdir}/patch.sh | 172 | + <executable>${project.basedir}/src/patch.sh</executable> |
185 | - </executable> | 173 | + <arguments> |
174 | + <argument>${bmv2.thrift.srcdir}</argument> | ||
175 | + <argument>${bmv2.thrift.javanamespace}</argument> | ||
176 | + </arguments> | ||
186 | </configuration> | 177 | </configuration> |
187 | </execution> | 178 | </execution> |
188 | <execution> | 179 | <execution> |
... | @@ -195,7 +186,7 @@ | ... | @@ -195,7 +186,7 @@ |
195 | <executable>chmod</executable> | 186 | <executable>chmod</executable> |
196 | <arguments> | 187 | <arguments> |
197 | <argument>+x</argument> | 188 | <argument>+x</argument> |
198 | - <argument>${thrift.path}/${thrift.filename}</argument> | 189 | + <argument>${thrift.exedir}/${thrift.exefilename}</argument> |
199 | </arguments> | 190 | </arguments> |
200 | </configuration> | 191 | </configuration> |
201 | </execution> | 192 | </execution> |
... | @@ -207,7 +198,8 @@ | ... | @@ -207,7 +198,8 @@ |
207 | <artifactId>maven-thrift-plugin</artifactId> | 198 | <artifactId>maven-thrift-plugin</artifactId> |
208 | <version>0.1.11</version> | 199 | <version>0.1.11</version> |
209 | <configuration> | 200 | <configuration> |
210 | - <thriftExecutable>${thrift.path}/${thrift.filename}</thriftExecutable> | 201 | + <thriftSourceRoot>${bmv2.thrift.srcdir}</thriftSourceRoot> |
202 | + <thriftExecutable>${thrift.exedir}/${thrift.exefilename}</thriftExecutable> | ||
211 | <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> | 203 | <outputDirectory>${project.build.directory}/generated-sources</outputDirectory> |
212 | </configuration> | 204 | </configuration> |
213 | <executions> | 205 | <executions> | ... | ... |
1 | -*.thrift | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
... | @@ -17,11 +17,13 @@ | ... | @@ -17,11 +17,13 @@ |
17 | # exit on errors | 17 | # exit on errors |
18 | set -e | 18 | set -e |
19 | 19 | ||
20 | -basedir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" | 20 | +srcdir=$1 |
21 | -ns="org.onosproject.bmv2.thriftapi" | 21 | +ns=$2 |
22 | 22 | ||
23 | # add java namespace at beginning of file | 23 | # add java namespace at beginning of file |
24 | -for f in ${basedir}/*.thrift | 24 | +for f in ${srcdir}/*.thrift |
25 | do | 25 | do |
26 | - echo "namespace java ${ns}" | cat - ${f} > temp && mv temp ${f} | 26 | + if ! grep -q ${ns} ${f}; then |
27 | + echo "namespace java ${ns}" | cat - ${f} > temp && mv temp ${f} | ||
28 | + fi | ||
27 | done | 29 | done |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or login to post a comment