netty-incubator-codec-native-quic-0.0.70.Final.pom 58 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. ~ Copyright 2021 The Netty Project
  4. ~
  5. ~ The Netty Project licenses this file to you under the Apache License,
  6. ~ version 2.0 (the "License"); you may not use this file except in compliance
  7. ~ with the License. You may obtain a copy of the License at:
  8. ~
  9. ~ https://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, WITHOUT
  13. ~ WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  14. ~ License for the specific language governing permissions and limitations
  15. ~ under the License.
  16. -->
  17. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/maven-v4_0_0.xsd">
  18. <modelVersion>4.0.0</modelVersion>
  19. <parent>
  20. <groupId>io.netty.incubator</groupId>
  21. <artifactId>netty-incubator-codec-parent-quic</artifactId>
  22. <version>0.0.70.Final</version>
  23. </parent>
  24. <artifactId>netty-incubator-codec-native-quic</artifactId>
  25. <version>0.0.70.Final</version>
  26. <name>Netty/Incubator/Codec/Native/Quic</name>
  27. <packaging>${packaging.type}</packaging>
  28. <properties>
  29. <javaModuleNameClassifier>${os.detected.name}.${os.detected.arch}</javaModuleNameClassifier>
  30. <javaModuleNameWithClassifier>${javaModuleName}.${javaModuleNameClassifier}</javaModuleNameWithClassifier>
  31. <javaModuleName>io.netty.incubator.codec.quic</javaModuleName>
  32. <fragmentHost>io.netty.incubator.netty-incubator-codec-classes-quic</fragmentHost>
  33. <nativeSourceDirectory>${project.basedir}/src/main/c</nativeSourceDirectory>
  34. <nativeLibOnlyDir>${project.build.directory}/native-lib-only</nativeLibOnlyDir>
  35. <skipTests>false</skipTests>
  36. <packaging.type>jar</packaging.type>
  37. <jni.classifier>${os.detected.name}-${os.detected.arch}</jni.classifier>
  38. <jniLibName>netty_quiche_${os.detected.name}_${os.detected.arch}</jniLibName>
  39. <jniUtilIncludeDir>${project.build.directory}/netty-jni-util/</jniUtilIncludeDir>
  40. <boringsslSourceDir>${project.build.directory}/boringssl-source</boringsslSourceDir>
  41. <boringsslBuildDir>${boringsslSourceDir}/build-target</boringsslBuildDir>
  42. <boringsslHomeDir>${project.build.directory}/boringssl</boringsslHomeDir>
  43. <boringsslHomeBuildDir>${boringsslHomeDir}/build</boringsslHomeBuildDir>
  44. <boringsslHomeIncludeDir>${boringsslHomeDir}/include</boringsslHomeIncludeDir>
  45. <boringsslRepository>https://boringssl.googlesource.com/boringssl</boringsslRepository>
  46. <!-- Lets use what we use in netty-tcnative-boringssl-static -->
  47. <boringsslBranch>master</boringsslBranch>
  48. <boringsslCommitSha>b8c97f5b4bc5d4758612a0430e5c2792d0f9ca7f</boringsslCommitSha>
  49. <quicheSourceDir>${project.build.directory}/quiche-source</quicheSourceDir>
  50. <quicheBuildDir>${quicheSourceDir}/target/release</quicheBuildDir>
  51. <quicheHomeDir>${project.build.directory}/quiche</quicheHomeDir>
  52. <quicheHomeBuildDir>${quicheHomeDir}/build</quicheHomeBuildDir>
  53. <quicheHomeIncludeDir>${quicheHomeDir}/quiche/include</quicheHomeIncludeDir>
  54. <quicheRepository>https://github.com/cloudflare/quiche</quicheRepository>
  55. <quicheBranch>master</quicheBranch>
  56. <quicheCommitSha>4ff56ec2566622980bbb0e0d7b9217254d97c4ba</quicheCommitSha>
  57. <generatedSourcesDir>${project.build.directory}/generated-sources</generatedSourcesDir>
  58. <templateDir>${project.build.directory}/template</templateDir>
  59. <cargoTarget />
  60. <cflags />
  61. <ldflags />
  62. <extraCmakeFlags />
  63. <extraCflags />
  64. <extraCxxflags />
  65. <extraLdflags />
  66. <extraConfigureArg />
  67. <extraConfigureArg2 />
  68. <!-- We need 10.12 as minimum to compile quiche and use it.
  69. Anything below will fail when trying to load quiche with:
  70. Symbol not found: ___isPlatformVersionAtLeast
  71. -->
  72. <macosxDeploymentTarget />
  73. <bundleNativeCode />
  74. <crossCompile />
  75. </properties>
  76. <profiles>
  77. <profile>
  78. <id>windows</id>
  79. <activation>
  80. <os>
  81. <family>windows</family>
  82. </os>
  83. </activation>
  84. <properties>
  85. <boringsslHomeBuildDir>${boringsslHomeDir}/build/RelWithDebInfo</boringsslHomeBuildDir>
  86. <quicheTarget>x86_64-pc-windows-msvc</quicheTarget>
  87. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  88. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  89. <cmakeAsmFlags />
  90. <cmakeCFlags />
  91. <!-- Disable one warning to be able to build on windows -->
  92. <cmakeCxxFlags>/wd4091</cmakeCxxFlags>
  93. <libssl>ssl.lib</libssl>
  94. <libcrypto>crypto.lib</libcrypto>
  95. <libquiche>quiche.lib</libquiche>
  96. <bundleNativeCode>META-INF/native/${jniLibName}.dll;osname=win32;processor=${os.detected.arch}</bundleNativeCode>
  97. </properties>
  98. </profile>
  99. <profile>
  100. <id>mac</id>
  101. <activation>
  102. <os>
  103. <family>mac</family>
  104. </os>
  105. </activation>
  106. <properties>
  107. <!-- We need 10.12 as minimum to compile quiche and use it.
  108. Anything below will fail when trying to load quiche with:
  109. Symbol not found: ___isPlatformVersionAtLeast
  110. -->
  111. <macosxDeploymentTarget>10.12</macosxDeploymentTarget>
  112. <!-- On *nix, add ASM flags to disable executable stack -->
  113. <cmakeAsmFlags>-Wa,--noexecstack -mmacosx-version-min=${macosxDeploymentTarget}</cmakeAsmFlags>
  114. <extraCflags>-mmacosx-version-min=${macosxDeploymentTarget}</extraCflags>
  115. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  116. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  117. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  118. <libssl>libssl.a</libssl>
  119. <libcrypto>libcrypto.a</libcrypto>
  120. <libquiche>libquiche.a</libquiche>
  121. <extraLdflags>-platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} -mmacosx-version-min=${macosxDeploymentTarget}</extraLdflags>
  122. <extraConfigureArg>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg>
  123. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=${os.detected.arch}</bundleNativeCode>
  124. </properties>
  125. </profile>
  126. <profile>
  127. <id>mac-m1-cross-compile</id>
  128. <properties>
  129. <jniLibName>netty_quiche_osx_aarch_64</jniLibName>
  130. <jni.classifier>osx-aarch_64</jni.classifier>
  131. <javaModuleNameClassifier>osx.aarch_64</javaModuleNameClassifier>
  132. <macosxDeploymentTarget>11.0</macosxDeploymentTarget>
  133. <extraCflags>-target arm64-apple-macos11</extraCflags>
  134. <extraCxxflags>-target arm64-apple-macos11</extraCxxflags>
  135. <!-- On *nix, add ASM flags to disable executable stack -->
  136. <cmakeAsmFlags>-Wa,--noexecstack -target arm64-apple-macos11</cmakeAsmFlags>
  137. <extraCmakeFlags>-DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64</extraCmakeFlags>
  138. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  139. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  140. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  141. <libssl>libssl.a</libssl>
  142. <libcrypto>libcrypto.a</libcrypto>
  143. <libquiche>libquiche.a</libquiche>
  144. <extraLdflags>-arch arm64 -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget}</extraLdflags>
  145. <extraConfigureArg>--host=aarch64-apple-darwin</extraConfigureArg>
  146. <extraConfigureArg2>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg2>
  147. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=aarch64</bundleNativeCode>
  148. <!-- Don't run tests as we can't load the aarch64 lib on a x86_64 system -->
  149. <skipTests>true</skipTests>
  150. <crossCompile>mac</crossCompile>
  151. <quicheTarget>aarch64-apple-darwin</quicheTarget>
  152. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  153. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  154. </properties>
  155. </profile>
  156. <profile>
  157. <id>mac-intel-cross-compile</id>
  158. <properties>
  159. <jniLibName>netty_quiche_osx_x86_64</jniLibName>
  160. <jni.classifier>osx-x86_64</jni.classifier>
  161. <javaModuleNameClassifier>osx.x86_64</javaModuleNameClassifier>
  162. <macosxDeploymentTarget>10.12</macosxDeploymentTarget>
  163. <extraCflags>-target x86_64-apple-macos10.12 -mmacosx-version-min=${macosxDeploymentTarget}</extraCflags>
  164. <extraCxxflags>-target x86_64-apple-macos10.12</extraCxxflags>
  165. <!-- On *nix, add ASM flags to disable executable stack -->
  166. <cmakeAsmFlags>-Wa,--noexecstack -target x86_64-apple-macos10.12 -mmacosx-version-min=${macosxDeploymentTarget}</cmakeAsmFlags>
  167. <extraCmakeFlags>-DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_OSX_ARCHITECTURES=x86_64</extraCmakeFlags>
  168. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  169. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  170. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  171. <libssl>libssl.a</libssl>
  172. <libcrypto>libcrypto.a</libcrypto>
  173. <libquiche>libquiche.a</libquiche>
  174. <extraLdflags>-arch x86_64 -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} -mmacosx-version-min=${macosxDeploymentTarget}</extraLdflags>
  175. <extraConfigureArg>--host=x86_64-apple-darwin</extraConfigureArg>
  176. <extraConfigureArg2>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg2>
  177. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=x86_64</bundleNativeCode>
  178. <!-- Don't run tests as we can't load the x86_64 lib on a aarch64 system -->
  179. <skipTests>true</skipTests>
  180. <crossCompile>mac</crossCompile>
  181. <quicheTarget>x86_64-apple-darwin</quicheTarget>
  182. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  183. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  184. </properties>
  185. </profile>
  186. <profile>
  187. <id>linux</id>
  188. <activation>
  189. <os>
  190. <family>linux</family>
  191. </os>
  192. <property>
  193. <name>!android</name>
  194. </property>
  195. </activation>
  196. <properties>
  197. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  198. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  199. <!-- On *nix, add ASM flags to disable executable stack -->
  200. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  201. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  202. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  203. <cmakeCxxFlags>${extraCxxflags} -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  204. <libssl>libssl.a</libssl>
  205. <libcrypto>libcrypto.a</libcrypto>
  206. <libquiche>libquiche.a</libquiche>
  207. <extraLdflags>-static-libstdc++ -l:libstdc++.a -Wl,--strip-debug -Wl,--exclude-libs,ALL -Wl,-lrt</extraLdflags>
  208. <bundleNativeCode>META-INF/native/lib${jniLibName}.so;osname=linux;processor=${os.detected.arch}</bundleNativeCode>
  209. </properties>
  210. </profile>
  211. <profile>
  212. <id>android-armeabi-v7a</id>
  213. <activation>
  214. <os>
  215. <family>linux</family>
  216. </os>
  217. <property>
  218. <name>android</name>
  219. </property>
  220. </activation>
  221. <properties>
  222. <!-- https://developer.android.com/ndk/guides/other_build_systems -->
  223. <!-- https://github.com/android/ndk/issues/1324 -->
  224. <androidAbi>armeabi-v7a</androidAbi>
  225. <androidTriple>armv7a-linux-androideabi</androidTriple>
  226. <quicheTarget>armv7-linux-androideabi</quicheTarget>
  227. </properties>
  228. </profile>
  229. <profile>
  230. <id>android-arm64-v8a</id>
  231. <properties>
  232. <androidAbi>arm64-v8a</androidAbi>
  233. <androidTriple>aarch64-linux-android</androidTriple>
  234. <quicheTarget>aarch64-linux-android</quicheTarget>
  235. </properties>
  236. </profile>
  237. <profile>
  238. <id>android-x86</id>
  239. <properties>
  240. <androidAbi>x86</androidAbi>
  241. <androidTriple>i686-linux-android</androidTriple>
  242. <quicheTarget>i686-linux-android</quicheTarget>
  243. </properties>
  244. </profile>
  245. <profile>
  246. <id>android-x86_64</id>
  247. <properties>
  248. <androidAbi>x86_64</androidAbi>
  249. <androidTriple>x86_64-linux-android</androidTriple>
  250. <quicheTarget>x86_64-linux-android</quicheTarget>
  251. </properties>
  252. </profile>
  253. <profile>
  254. <id>android</id>
  255. <activation>
  256. <os>
  257. <family>linux</family>
  258. </os>
  259. <property>
  260. <name>android</name>
  261. </property>
  262. </activation>
  263. <properties>
  264. <packaging.type>aar</packaging.type>
  265. <skipTests>true</skipTests>
  266. <platform>android</platform>
  267. <androidNdkVersion>21</androidNdkVersion>
  268. <androidMinSdkVersion>21</androidMinSdkVersion>
  269. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  270. <skipIteration>false</skipIteration>
  271. <nativeLibOnlyDir>${project.build.directory}/native-lib-only/${androidAbi}</nativeLibOnlyDir>
  272. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  273. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  274. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  275. <!-- On *nix, add ASM flags to disable executable stack -->
  276. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  277. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  278. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  279. <cmakeCxxFlags>${extraCxxflags} -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  280. <libssl>libssl.a</libssl>
  281. <libcrypto>libcrypto.a</libcrypto>
  282. <libquiche>libquiche.a</libquiche>
  283. <!-- https://developer.android.com/ndk/guides/other_build_systems -->
  284. <jniLibName>netty_quiche</jniLibName>
  285. <jni.classifier>${platform}</jni.classifier>
  286. <javaModuleNameClassifier>android</javaModuleNameClassifier>
  287. <cflags>-std=c99 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value -O3 -I${quicheHomeIncludeDir} -I${boringsslHomeIncludeDir}</cflags>
  288. <ldflags>-L${quicheHomeBuildDir} -lquiche -L${boringsslHomeBuildDir} -lssl -lcrypto</ldflags>
  289. <bundleNativeCode>META-INF/native/${jniLibName}.dll;osname=android;processor=${androidAbi}</bundleNativeCode>
  290. <ndkToolchain>${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64</ndkToolchain>
  291. <extraLdflags>-Wl,-soname=${jniLibName}.so -Wl,--build-id=sha1 -Wl,--strip-debug -Wl,--exclude-libs,ALL -lm</extraLdflags>
  292. <extraConfigureArg>--host=${androidTriple}</extraConfigureArg>
  293. <boringsslBuildDir>${boringsslSourceDir}/build/${androidAbi}</boringsslBuildDir>
  294. <boringsslHomeDir>${project.build.directory}/boringssl/${androidAbi}</boringsslHomeDir>
  295. <quicheHomeDir>${project.build.directory}/quiche/${androidAbi}</quicheHomeDir>
  296. <hawtjniBuildDir>${project.build.directory}/native-build/${androidAbi}</hawtjniBuildDir>
  297. </properties>
  298. <build>
  299. <plugins>
  300. <plugin>
  301. <groupId>com.soebes.maven.plugins</groupId>
  302. <artifactId>iterator-maven-plugin</artifactId>
  303. <!-- Don't use 0.5.1, it contains a change that merges all properties,
  304. and therefore doesn't re-evaluates "nested" properties (e.g. cargoTarget, which uses ${quicheTarget}).
  305. Keep this version or provide a fix to disable merging of properties in iterator-maven-plugin -->
  306. <version>0.5.0</version>
  307. <executions>
  308. <execution>
  309. <phase>package</phase>
  310. <goals>
  311. <goal>invoker</goal>
  312. </goals>
  313. <configuration>
  314. <itemsWithProperties>
  315. <itemWithProperty>
  316. <name>arm64-v8a</name>
  317. <properties>
  318. <skipIteration>true</skipIteration>
  319. </properties>
  320. </itemWithProperty>
  321. <itemWithProperty>
  322. <name>x86</name>
  323. <properties>
  324. <skipIteration>true</skipIteration>
  325. </properties>
  326. </itemWithProperty>
  327. <itemWithProperty>
  328. <name>x86_64</name>
  329. <properties>
  330. <skipIteration>true</skipIteration>
  331. </properties>
  332. </itemWithProperty>
  333. </itemsWithProperties>
  334. <baseDirectory>${project.basedir}</baseDirectory>
  335. <goals>
  336. <goal>package</goal>
  337. </goals>
  338. <profiles>android-@item@,android</profiles>
  339. <skip>${skipIteration}</skip>
  340. </configuration>
  341. </execution>
  342. </executions>
  343. </plugin>
  344. <plugin>
  345. <groupId>org.fusesource.hawtjni</groupId>
  346. <artifactId>hawtjni-maven-plugin</artifactId>
  347. <executions>
  348. <execution>
  349. <id>generate-native-lib</id>
  350. <configuration>
  351. <configureArgs>
  352. <configureArg>${extraConfigureArg}</configureArg>
  353. <configureArg>${extraConfigureArg2}</configureArg>
  354. <configureArg>CFLAGS=${cflags}</configureArg>
  355. <configureArg>LDFLAGS=${ldflags} ${extraLdflags}</configureArg>
  356. <configureArg>--libdir=${hawtjniBuildDir}/native-build/target/lib</configureArg>
  357. <configureArg>TOOLCHAIN=${ndkToolchain}</configureArg>
  358. <configureArg>TARGET=${androidTriple}</configureArg>
  359. <configureArg>API=${androidMinSdkVersion}</configureArg>
  360. <configureArg>AR=${ndkToolchain}/bin/llvm-ar</configureArg>
  361. <configureArg>CC=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang</configureArg>
  362. <configureArg>AS=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang</configureArg>
  363. <configureArg>CXX=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang++</configureArg>
  364. <configureArg>LD=${ndkToolchain}/bin/ld</configureArg>
  365. <configureArg>RANLIB=${ndkToolchain}/bin/llvm-ranlib</configureArg>
  366. <configureArg>STRIP=${ndkToolchain}/bin/llvm-strip</configureArg>
  367. </configureArgs>
  368. <buildDirectory>${hawtjniBuildDir}</buildDirectory>
  369. </configuration>
  370. <goals>
  371. <goal>generate</goal>
  372. <goal>build</goal>
  373. </goals>
  374. </execution>
  375. </executions>
  376. </plugin>
  377. <plugin>
  378. <artifactId>maven-jar-plugin</artifactId>
  379. <executions>
  380. <execution>
  381. <id>native-jar</id>
  382. <phase>none</phase>
  383. </execution>
  384. </executions>
  385. </plugin>
  386. <plugin>
  387. <groupId>org.apache.felix</groupId>
  388. <artifactId>maven-bundle-plugin</artifactId>
  389. <executions>
  390. <execution>
  391. <id>generate-manifest</id>
  392. <phase>none</phase>
  393. </execution>
  394. </executions>
  395. </plugin>
  396. <plugin>
  397. <artifactId>maven-antrun-plugin</artifactId>
  398. <!-- Copy the native lib that was generated and the license material for attribution -->
  399. <executions>
  400. <execution>
  401. <id>copy-android-native-lib</id>
  402. <phase>initialize</phase>
  403. <goals>
  404. <goal>run</goal>
  405. </goals>
  406. <configuration>
  407. <target>
  408. <!-- Add the ant tasks from ant-contrib -->
  409. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  410. <filter token="JAVA_MODULE_NAME" value="${javaModuleNameWithClassifier}" />
  411. <filter token="MIN_SDK_VERSION" value="${androidMinSdkVersion}" />
  412. <copy file="src/main/AndroidManifest.xml" todir="${project.build.directory}/android-build/" filtering="true" />
  413. <!-- Create an empty MANIFEST.MF file -->
  414. <touch file="${project.build.outputDirectory}/META-INF/MANIFEST.MF" mkdirs="true" />
  415. </target>
  416. </configuration>
  417. </execution>
  418. <!-- Copy the native lib that was generated and the license material for attribution -->
  419. <execution>
  420. <id>copy-native-lib-and-license</id>
  421. <phase>none</phase>
  422. </execution>
  423. <!-- Copy the native android lib that was generated and the license material for attribution -->
  424. <execution>
  425. <id>copy-android-native-libs</id>
  426. <phase>process-test-resources</phase>
  427. <goals>
  428. <goal>run</goal>
  429. </goals>
  430. <configuration>
  431. <target>
  432. <!-- Add the ant tasks from ant-contrib -->
  433. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  434. <copy todir="${project.build.directory}/android-build/native-libs/${androidAbi}" includeEmptyDirs="false">
  435. <zipfileset dir="${nativeLibOnlyDir}/META-INF/native" />
  436. <regexpmapper handledirsep="yes" from="^(?:[^/]+/)*([^/]+)$" to="\1" />
  437. </copy>
  438. </target>
  439. </configuration>
  440. </execution>
  441. </executions>
  442. </plugin>
  443. </plugins>
  444. </build>
  445. </profile>
  446. <profile>
  447. <id>linux-aarch64</id>
  448. <properties>
  449. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  450. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  451. <!-- On *nix, add ASM flags to disable executable stack -->
  452. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  453. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  454. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  455. <cmakeCxxFlags>${extraCxxflags} -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  456. <libssl>libssl.a</libssl>
  457. <libcrypto>libcrypto.a</libcrypto>
  458. <libquiche>libquiche.a</libquiche>
  459. <extraLdflags>-static-libstdc++ -l:libstdc++.a -Wl,--strip-debug -Wl,--exclude-libs,ALL</extraLdflags>
  460. <bundleNativeCode>META-INF/native/lib${jniLibName}.so;osname=linux;processor=aarch64</bundleNativeCode>
  461. <jniLibName>netty_quiche_linux_aarch_64</jniLibName>
  462. <jni.classifier>linux-aarch_64</jni.classifier>
  463. <javaModuleNameClassifier>linux.aarch_64</javaModuleNameClassifier>
  464. <extraConfigureArg>--host=aarch64-linux-gnu</extraConfigureArg>
  465. <extraConfigureArg2>CC=aarch64-none-linux-gnu-gcc</extraConfigureArg2>
  466. <extraCmakeFlags>-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=aarch64-none-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-none-linux-gnu-g++</extraCmakeFlags>
  467. <!-- Don't run tests as we can't load the aarch64 lib on a x86_64 system -->
  468. <skipTests>true</skipTests>
  469. <crossCompile>linux</crossCompile>
  470. <quicheTarget>aarch64-unknown-linux-gnu</quicheTarget>
  471. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  472. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  473. </properties>
  474. </profile>
  475. <profile>
  476. <id>leak</id>
  477. <properties>
  478. <test.argLine>-Dio.netty.leakDetectionLevel=paranoid -Dio.netty.leakDetection.targetRecords=32</test.argLine>
  479. </properties>
  480. </profile>
  481. <!-- Build with unsafe disabled which also means the memory address cant be accessed-->
  482. <profile>
  483. <id>noUnsafe</id>
  484. <properties>
  485. <test.argLine>-Dio.netty.noUnsafe=true</test.argLine>
  486. </properties>
  487. </profile>
  488. <!-- Profile related to native-image -->
  489. <!-- ./mvnw -Pnative-image-agent -pl codec-native-quic test -->
  490. <profile>
  491. <id>native-image-agent</id>
  492. <dependencies>
  493. <dependency>
  494. <groupId>org.bouncycastle</groupId>
  495. <artifactId>bcpkix-jdk15on</artifactId>
  496. </dependency>
  497. </dependencies>
  498. <build>
  499. <plugins>
  500. <plugin>
  501. <artifactId>maven-compiler-plugin</artifactId>
  502. <configuration>
  503. <source>17</source>
  504. <target>17</target>
  505. </configuration>
  506. </plugin>
  507. <plugin>
  508. <artifactId>maven-surefire-plugin</artifactId>
  509. <configuration>
  510. <excludes>
  511. <exclude>io.netty.incubator.codec.quic.QuicChannelEchoTest</exclude>
  512. </excludes>
  513. </configuration>
  514. </plugin>
  515. <plugin>
  516. <groupId>org.graalvm.buildtools</groupId>
  517. <artifactId>native-maven-plugin</artifactId>
  518. <version>${native.maven.plugin.version}</version>
  519. <dependencies>
  520. <dependency>
  521. <groupId>org.codehaus.plexus</groupId>
  522. <artifactId>plexus-utils</artifactId>
  523. <version>3.4.2</version>
  524. </dependency>
  525. </dependencies>
  526. <extensions>true</extensions>
  527. <executions>
  528. <execution>
  529. <id>test-native</id>
  530. <goals>
  531. <goal>test</goal>
  532. </goals>
  533. <phase>test</phase>
  534. </execution>
  535. </executions>
  536. <configuration>
  537. <skipNativeTests>true</skipNativeTests>
  538. <metadataRepository>
  539. <enabled>true</enabled>
  540. </metadataRepository>
  541. <agent>
  542. <enabled>true</enabled>
  543. <defaultMode>Conditional</defaultMode>
  544. <modes>
  545. <conditional>
  546. <userCodeFilterPath>${project.basedir}/src/test/resources/netty-filter.json</userCodeFilterPath>
  547. <extraFilterPath>${project.basedir}/src/test/resources/test-class-filter.json</extraFilterPath>
  548. <parallel>true</parallel>
  549. </conditional>
  550. </modes>
  551. <options>
  552. <builtinCallerFilter>true</builtinCallerFilter>
  553. <builtinHeuristicFilter>true</builtinHeuristicFilter>
  554. <enableExperimentalPredefinedClasses>false</enableExperimentalPredefinedClasses>
  555. <enableExperimentalUnsafeAllocationTracing>false</enableExperimentalUnsafeAllocationTracing>
  556. <trackReflectionMetadata>true</trackReflectionMetadata>
  557. </options>
  558. <metadataCopy>
  559. <disabledStages>
  560. <stage>main</stage>
  561. </disabledStages>
  562. <merge>true</merge>
  563. </metadataCopy>
  564. </agent>
  565. </configuration>
  566. </plugin>
  567. </plugins>
  568. </build>
  569. </profile>
  570. </profiles>
  571. <build>
  572. <extensions>
  573. <extension>
  574. <groupId>kr.motd.maven</groupId>
  575. <artifactId>os-maven-plugin</artifactId>
  576. <version>1.7.0</version>
  577. </extension>
  578. </extensions>
  579. <plugins>
  580. <!-- Also include c files in source jar -->
  581. <plugin>
  582. <groupId>org.codehaus.mojo</groupId>
  583. <artifactId>build-helper-maven-plugin</artifactId>
  584. <executions>
  585. <execution>
  586. <phase>generate-sources</phase>
  587. <goals>
  588. <goal>add-source</goal>
  589. </goals>
  590. <configuration>
  591. <sources>
  592. <source>${nativeSourceDirectory}</source>
  593. </sources>
  594. </configuration>
  595. </execution>
  596. </executions>
  597. </plugin>
  598. <plugin>
  599. <groupId>org.apache.maven.plugins</groupId>
  600. <artifactId>maven-dependency-plugin</artifactId>
  601. <executions>
  602. <!-- unpack netty-jni-util files -->
  603. <execution>
  604. <id>unpack</id>
  605. <phase>generate-sources</phase>
  606. <goals>
  607. <goal>unpack-dependencies</goal>
  608. </goals>
  609. <configuration>
  610. <includeGroupIds>io.netty</includeGroupIds>
  611. <includeArtifactIds>netty-jni-util</includeArtifactIds>
  612. <classifier>sources</classifier>
  613. <outputDirectory>${jniUtilIncludeDir}</outputDirectory>
  614. <includes>**.h,**.c</includes>
  615. <overWriteReleases>false</overWriteReleases>
  616. <overWriteSnapshots>true</overWriteSnapshots>
  617. </configuration>
  618. </execution>
  619. </executions>
  620. </plugin>
  621. <plugin>
  622. <artifactId>maven-antrun-plugin</artifactId>
  623. <executions>
  624. <!-- Build the BoringSSL static libs -->
  625. <execution>
  626. <id>build-boringssl</id>
  627. <phase>generate-sources</phase>
  628. <goals>
  629. <goal>run</goal>
  630. </goals>
  631. <configuration>
  632. <target>
  633. <!-- Add the ant tasks from ant-contrib -->
  634. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  635. <property environment="env" />
  636. <if>
  637. <available file="${boringsslHomeDir}" />
  638. <then>
  639. <echo message="BoringSSL was already build, skipping the build step." />
  640. </then>
  641. <else>
  642. <if>
  643. <available file="${boringsslSourceDir}" />
  644. <then>
  645. <echo message="BoringSSL was already cloned, skipping the clone step." />
  646. </then>
  647. <else>
  648. <echo message="Clone BoringSSL" />
  649. <exec executable="git" failonerror="true" dir="${project.build.directory}" resolveexecutable="true">
  650. <arg value="clone" />
  651. <arg value="--branch" />
  652. <arg value="${boringsslBranch}" />
  653. <arg value="${boringsslRepository}" />
  654. <arg value="${boringsslSourceDir}" />
  655. </exec>
  656. </else>
  657. </if>
  658. <echo message="Building BoringSSL" />
  659. <!-- Use the known SHA of the commit -->
  660. <exec executable="git" failonerror="true" dir="${boringsslSourceDir}" resolveexecutable="true">
  661. <arg value="checkout" />
  662. <arg value="${boringsslCommitSha}" />
  663. </exec>
  664. <mkdir dir="${boringsslBuildDir}" />
  665. <if>
  666. <equals arg1="${platform}" arg2="android" />
  667. <then>
  668. <!-- https://boringssl.googlesource.com/boringssl/+/HEAD/BUILDING.md#building-for-android -->
  669. <exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
  670. <arg value="-DANDROID_ABI=${androidAbi}" />
  671. <arg value="-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" />
  672. <arg value="-DANDROID_NATIVE_API_LEVEL=${androidNdkVersion}" />
  673. <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
  674. <arg value="-DCMAKE_BUILD_TYPE=Release" />
  675. <arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
  676. <arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
  677. <arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
  678. <arg value="-GNinja" />
  679. <arg value="${boringsslSourceDir}" />
  680. </exec>
  681. </then>
  682. <else>
  683. <exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
  684. <env key="MACOSX_DEPLOYMENT_TARGET" value="${macosxDeploymentTarget}" />
  685. <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
  686. <arg value="-DCMAKE_BUILD_TYPE=Release" />
  687. <arg value="-DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded" />
  688. <arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
  689. <arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
  690. <arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
  691. <arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
  692. <arg line="${extraCmakeFlags}" />
  693. <arg value="-GNinja" />
  694. <arg value="${boringsslSourceDir}" />
  695. </exec>
  696. </else>
  697. </if>
  698. <if>
  699. <!-- may be called ninja-build or ninja -->
  700. <!-- See https://github.com/netty/netty-tcnative/issues/475 -->
  701. <available file="ninja-build" filepath="${PATH}" />
  702. <then>
  703. <property name="ninjaExecutable" value="ninja-build" />
  704. </then>
  705. <else>
  706. <property name="ninjaExecutable" value="ninja" />
  707. </else>
  708. </if>
  709. <exec executable="${ninjaExecutable}" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
  710. <arg value="crypto" />
  711. <arg value="ssl" />
  712. </exec>
  713. <!-- Only copy the libs and header files we need -->
  714. <mkdir dir="${boringsslHomeBuildDir}" />
  715. <copy file="${boringsslBuildDir}/ssl/${libssl}" todir="${boringsslHomeBuildDir}" verbose="true" />
  716. <copy file="${boringsslBuildDir}/crypto/${libcrypto}" todir="${boringsslHomeBuildDir}" verbose="true" />
  717. <copy todir="${boringsslHomeIncludeDir}" verbose="true">
  718. <fileset dir="${boringsslSourceDir}/include" />
  719. </copy>
  720. </else>
  721. </if>
  722. </target>
  723. </configuration>
  724. </execution>
  725. <!-- Build the Quiche static lib -->
  726. <execution>
  727. <id>build-quiche</id>
  728. <phase>generate-sources</phase>
  729. <goals>
  730. <goal>run</goal>
  731. </goals>
  732. <configuration>
  733. <target>
  734. <!-- Add the ant tasks from ant-contrib -->
  735. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  736. <property environment="env" />
  737. <if>
  738. <available file="${quicheHomeDir}" />
  739. <then>
  740. <echo message="Quiche was already build, skipping the build step." />
  741. </then>
  742. <else>
  743. <if>
  744. <available file="${quicheSourceDir}" />
  745. <then>
  746. <echo message="Quiche was already cloned, skipping the clone step." />
  747. </then>
  748. <else>
  749. <echo message="Clone Quiche" />
  750. <exec executable="git" failonerror="true" dir="${project.build.directory}" resolveexecutable="true">
  751. <arg value="clone" />
  752. <arg value="--recursive" />
  753. <arg value="--branch" />
  754. <arg value="${quicheBranch}" />
  755. <arg value="${quicheRepository}" />
  756. <arg value="${quicheSourceDir}" />
  757. </exec>
  758. <!-- Use the known SHA of the commit -->
  759. <exec executable="git" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  760. <arg value="checkout" />
  761. <arg value="${quicheCommitSha}" />
  762. </exec>
  763. </else>
  764. </if>
  765. <echo message="Building Quiche" />
  766. <if>
  767. <equals arg1="${platform}" arg2="android" />
  768. <then>
  769. <exec executable="cargo" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  770. <arg line="ndk ${cargoTarget} -p ${androidNdkVersion} -- build --exclude quiche_apps --workspace --features &quot;ffi qlog&quot; --release" />
  771. <env key="CFLAGS" value="${extraCflags}" />
  772. <env key="CXXFLAGS" value="${extraCxxflags}" />
  773. <env key="QUICHE_BSSL_PATH" value="${boringsslHomeDir}/" />
  774. </exec>
  775. </then>
  776. <else>
  777. <if>
  778. <equals arg1="${os.detected.name}" arg2="windows" />
  779. <then>
  780. <exec executable="cargo" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  781. <arg line="build --exclude quiche_apps --workspace --features &quot;ffi qlog&quot; --release" />
  782. <arg value="${cargoTarget}" />
  783. <!-- See https://github.com/cloudflare/quiche/blob/0.7.0/src/build.rs#L73 -->
  784. <env key="DEBUG" value="true" />
  785. <env key="OPT_LEVEL" value="3" />
  786. <env key="QUICHE_BSSL_PATH" value="${boringsslHomeDir}/" />
  787. </exec>
  788. </then>
  789. <elseif>
  790. <equals arg1="${crossCompile}" arg2="linux" />
  791. <then>
  792. <exec executable="cargo" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  793. <arg line="build --exclude quiche_apps --workspace --features &quot;ffi qlog&quot; --release" />
  794. <arg value="${cargoTarget}" />
  795. <env key="QUICHE_BSSL_PATH" value="${boringsslHomeDir}/" />
  796. <!-- Lets enable frame-pointers so we can profile better -->
  797. <env key="RUSTFLAGS" value="-Cforce-frame-pointers=yes" />
  798. <env key="TARGET_CC" value="aarch64-none-linux-gnu-gcc" />
  799. </exec>
  800. </then>
  801. </elseif>
  802. <elseif>
  803. <equals arg1="${crossCompile}" arg2="mac" />
  804. <then>
  805. <exec executable="cargo" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  806. <arg line="build --exclude quiche_apps --workspace --features &quot;ffi qlog&quot; --release" />
  807. <env key="CFLAGS" value="${extraCflags}" />
  808. <env key="CXXFLAGS" value="${extraCxxflags}" />
  809. <arg value="${cargoTarget}" />
  810. <env key="QUICHE_BSSL_PATH" value="${boringsslHomeDir}/" />
  811. <!-- Lets enable frame-pointers so we can profile better -->
  812. <env key="RUSTFLAGS" value="-Cforce-frame-pointers=yes" />
  813. <env key="MACOSX_DEPLOYMENT_TARGET" value="${macosxDeploymentTarget}" />
  814. </exec>
  815. </then>
  816. </elseif>
  817. <else>
  818. <exec executable="cargo" failonerror="true" dir="${quicheSourceDir}" resolveexecutable="true">
  819. <arg line="build --exclude quiche_apps --workspace --features &quot;ffi qlog&quot; --release" />
  820. <env key="CFLAGS" value="${extraCflags}" />
  821. <env key="CXXFLAGS" value="${extraCxxflags}" />
  822. <env key="QUICHE_BSSL_PATH" value="${boringsslHomeDir}/" />
  823. <!-- Lets enable frame-pointers so we can profile better -->
  824. <env key="RUSTFLAGS" value="-Cforce-frame-pointers=yes" />
  825. <env key="MACOSX_DEPLOYMENT_TARGET" value="${macosxDeploymentTarget}" />
  826. </exec>
  827. </else>
  828. </if>
  829. </else>
  830. </if>
  831. <!-- Only copy the libs and header files we need -->
  832. <mkdir dir="${quicheHomeDir}" />
  833. <copy file="${quicheBuildDir}/${libquiche}" todir="${quicheHomeBuildDir}/" />
  834. <copy todir="${quicheHomeIncludeDir}">
  835. <fileset dir="${quicheSourceDir}/quiche/include" />
  836. </copy>
  837. </else>
  838. </if>
  839. </target>
  840. </configuration>
  841. </execution>
  842. <execution>
  843. <id>copy-src</id>
  844. <phase>generate-sources</phase>
  845. <goals>
  846. <goal>run</goal>
  847. </goals>
  848. <configuration>
  849. <target>
  850. <!-- Copy all of the c code -->
  851. <delete dir="${generatedSourcesDir}" quiet="true" />
  852. <copy todir="${generatedSourcesDir}/c">
  853. <fileset dir="${project.basedir}/src/main/c" />
  854. </copy>
  855. <copy todir="${generatedSourcesDir}/c">
  856. <fileset dir="${jniUtilIncludeDir}" />
  857. </copy>
  858. </target>
  859. </configuration>
  860. </execution>
  861. <execution>
  862. <!-- Adjust our template and copy it over so it can be used when compiling on windows -->
  863. <id>setup-template</id>
  864. <phase>generate-sources</phase>
  865. <goals>
  866. <goal>run</goal>
  867. </goals>
  868. <configuration>
  869. <target>
  870. <!-- Add the ant tasks from ant-contrib -->
  871. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  872. <property environment="env" />
  873. <!-- Convert the paths to windows format -->
  874. <pathconvert property="boringsslHomeIncludeWindowsDir" targetos="windows">
  875. <path location="${boringsslHomeIncludeDir}" />
  876. </pathconvert>
  877. <pathconvert property="quicheHomeIncludeWindowsDir" targetos="windows">
  878. <path location="${quicheHomeIncludeDir}" />
  879. </pathconvert>
  880. <pathconvert property="boringsslHomeBuildWindowsDir" targetos="windows">
  881. <path location="${boringsslHomeBuildDir}" />
  882. </pathconvert>
  883. <pathconvert property="quicheHomeBuildWindowsDir" targetos="windows">
  884. <path location="${quicheHomeBuildDir}" />
  885. </pathconvert>
  886. <!-- Copy custom.m4 to fix building library without version-suffix on Android -->
  887. <if>
  888. <equals arg1="${platform}" arg2="android" />
  889. <then>
  890. <copy file="src/main/native-package/m4/custom.m4.android.template" tofile="${templateDir}/m4/custom.m4" filtering="true" overwrite="true" verbose="true" />
  891. </then>
  892. <elseif>
  893. <equals arg1="${os.detected.name}" arg2="windows" />
  894. <then>
  895. <!-- Copy and filter the template MSVC project -->
  896. <filter token="BORINGSSL_INCLUDE_DIR" value="${boringsslHomeIncludeWindowsDir}" />
  897. <filter token="QUICHE_INCLUDE_DIR" value="${quicheHomeIncludeWindowsDir}" />
  898. <filter token="BORINGSSL_LIB_DIR" value="${boringsslHomeBuildWindowsDir}" />
  899. <filter token="QUICHE_LIB_DIR" value="${quicheHomeBuildWindowsDir}" />
  900. <filter token="QUICHE_LIB" value="${libquiche}" />
  901. <filter token="CRYPTO_LIB" value="${libcrypto}" />
  902. <filter token="SSL_LIB" value="${libssl}" />
  903. <copy file="src/main/native-package/vs2010.custom.props.template" tofile="${templateDir}/vs2010.custom.props" filtering="true" overwrite="true" verbose="true" />
  904. </then>
  905. </elseif>
  906. <else>
  907. <!-- Copy and filter custom.m4 -->
  908. <filter token="BORINGSSL_INCLUDE_DIR" value="${boringsslHomeIncludeDir}" />
  909. <filter token="QUICHE_INCLUDE_DIR" value="${quicheHomeIncludeDir}" />
  910. <filter token="BORINGSSL_LIB_DIR" value="${boringsslHomeBuildDir}" />
  911. <filter token="QUICHE_LIB_DIR" value="${quicheHomeBuildDir}" />
  912. <filter token="QUICHE_LIB" value="quiche" />
  913. <filter token="CRYPTO_LIB" value="crypto" />
  914. <filter token="SSL_LIB" value="ssl" />
  915. <filter token="EXTRA_LDFLAGS" value="${extraLdflags}" />
  916. <filter token="EXTRA_CFLAGS" value="${extraCflags}" />
  917. <copy file="src/main/native-package/m4/custom.m4.template" tofile="${templateDir}/m4/custom.m4" filtering="true" overwrite="true" verbose="true" />
  918. </else>
  919. </if>
  920. </target>
  921. </configuration>
  922. </execution>
  923. <!-- Copy the native lib that was generated and the license material for attribution -->
  924. <execution>
  925. <id>copy-native-lib-and-license</id>
  926. <phase>process-test-resources</phase>
  927. <goals>
  928. <goal>run</goal>
  929. </goals>
  930. <configuration>
  931. <target>
  932. <!-- Add the ant tasks from ant-contrib -->
  933. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  934. <copy todir="${project.build.outputDirectory}" includeEmptyDirs="false">
  935. <zipfileset dir="${nativeLibOnlyDir}/META-INF/native" />
  936. <regexpmapper handledirsep="yes" from="^(?:[^/]+/)*([^/]+)$" to="META-INF/native/\1" />
  937. </copy>
  938. <!-- Copy license material for attribution-->
  939. <copy file="../NOTICE.txt" todir="${project.build.outputDirectory}/META-INF/" />
  940. <copy file="../LICENSE.txt" todir="${project.build.outputDirectory}/META-INF/" />
  941. <copy todir="${project.build.outputDirectory}/META-INF/license">
  942. <fileset dir="../license" />
  943. </copy>
  944. </target>
  945. </configuration>
  946. </execution>
  947. <!-- Copy the manifest file that we populated so far so we can use it as a starting point when generating the jars and adding more things to it. -->
  948. <execution>
  949. <id>copy-manifest</id>
  950. <phase>prepare-package</phase>
  951. <goals>
  952. <goal>run</goal>
  953. </goals>
  954. <configuration>
  955. <target>
  956. <copy file="${project.build.outputDirectory}/META-INF/MANIFEST.MF" tofile="${project.build.directory}/manifests/MANIFEST-native.MF" />
  957. <copy file="${project.build.outputDirectory}/META-INF/MANIFEST.MF" tofile="${project.build.directory}/manifests/MANIFEST.MF" />
  958. </target>
  959. </configuration>
  960. </execution>
  961. </executions>
  962. </plugin>
  963. <!-- always produce osgi bundles -->
  964. <plugin>
  965. <groupId>org.apache.felix</groupId>
  966. <artifactId>maven-bundle-plugin</artifactId>
  967. <executions>
  968. <execution>
  969. <id>generate-manifest</id>
  970. <phase>process-classes</phase>
  971. <goals>
  972. <goal>manifest</goal>
  973. </goals>
  974. <configuration>
  975. <supportedProjectTypes>
  976. <supportedProjectType>jar</supportedProjectType>
  977. <supportedProjectType>bundle</supportedProjectType>
  978. </supportedProjectTypes>
  979. <instructions>
  980. <Export-Package>${project.groupId}.*</Export-Package>
  981. <BoringSSL-Revision>${boringsslCommitSha}</BoringSSL-Revision>
  982. <BoringSSL-Branch>${boringsslBranch}</BoringSSL-Branch>
  983. <Quiche-Revision>${quicheCommitSha}</Quiche-Revision>
  984. <Quiche-Branch>${quicheBranch}</Quiche-Branch>
  985. </instructions>
  986. </configuration>
  987. </execution>
  988. </executions>
  989. </plugin>
  990. <plugin>
  991. <artifactId>maven-source-plugin</artifactId>
  992. <!-- Eclipse-related OSGi manifests
  993. See https://github.com/netty/netty/issues/3886
  994. More information: https://rajakannappan.blogspot.ie/2010/03/automating-eclipse-source-bundle.html -->
  995. <configuration>
  996. <archive>
  997. <manifestEntries>
  998. <Bundle-ManifestVersion>2</Bundle-ManifestVersion>
  999. <Bundle-Name>${project.name}</Bundle-Name>
  1000. <Bundle-SymbolicName>${project.groupId}.${project.artifactId}.source</Bundle-SymbolicName>
  1001. <Bundle-Vendor>${project.organization.name}</Bundle-Vendor>
  1002. <Bundle-Version>${parsedVersion.osgiVersion}</Bundle-Version>
  1003. <Eclipse-SourceBundle>${project.groupId}.${project.artifactId};version="${parsedVersion.osgiVersion}";roots:="."</Eclipse-SourceBundle>
  1004. </manifestEntries>
  1005. </archive>
  1006. </configuration>
  1007. <executions>
  1008. <execution>
  1009. <id>attach-sources</id>
  1010. <phase>prepare-package</phase>
  1011. <goals>
  1012. <goal>jar-no-fork</goal>
  1013. </goals>
  1014. </execution>
  1015. <execution>
  1016. <id>attach-test-sources</id>
  1017. <phase>prepare-package</phase>
  1018. <goals>
  1019. <goal>test-jar-no-fork</goal>
  1020. </goals>
  1021. </execution>
  1022. </executions>
  1023. </plugin>
  1024. <plugin>
  1025. <groupId>org.fusesource.hawtjni</groupId>
  1026. <artifactId>hawtjni-maven-plugin</artifactId>
  1027. <executions>
  1028. <execution>
  1029. <id>generate-native-lib</id>
  1030. <configuration>
  1031. <name>${jniLibName}</name>
  1032. <nativeSourceDirectory>${generatedSourcesDir}</nativeSourceDirectory>
  1033. <customPackageDirectory>${templateDir}</customPackageDirectory>
  1034. <windowsBuildTool>msbuild</windowsBuildTool>
  1035. <windowsCustomProps>true</windowsCustomProps>
  1036. <windowsPlatformToolset>v142</windowsPlatformToolset>
  1037. <libDirectory>${nativeLibOnlyDir}</libDirectory>
  1038. <verbose>true</verbose>
  1039. <configureArgs>
  1040. <configureArg>${extraConfigureArg}</configureArg>
  1041. <configureArg>${extraConfigureArg2}</configureArg>
  1042. <configureArg>--libdir=${project.build.directory}/native-build/target/lib</configureArg>
  1043. </configureArgs>
  1044. </configuration>
  1045. <goals>
  1046. <goal>generate</goal>
  1047. <goal>build</goal>
  1048. </goals>
  1049. </execution>
  1050. </executions>
  1051. </plugin>
  1052. <plugin>
  1053. <artifactId>maven-jar-plugin</artifactId>
  1054. <executions>
  1055. <execution>
  1056. <id>default-jar</id>
  1057. <configuration>
  1058. <!-- Exclude native lib and attribution for the jar without classifier-->
  1059. <excludes>
  1060. <exclude>META-INF/native/**</exclude>
  1061. <exclude>META-INF/license/**</exclude>
  1062. <exclude>META-INF/NOTICE.txt</exclude>
  1063. <exclude>META-INF/LICENSE.txt</exclude>
  1064. </excludes>
  1065. <archive>
  1066. <manifest>
  1067. <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
  1068. <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
  1069. </manifest>
  1070. <manifestEntries>
  1071. <Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
  1072. </manifestEntries>
  1073. <index>true</index>
  1074. <manifestFile>${project.build.directory}/manifests/MANIFEST.MF</manifestFile>
  1075. </archive>
  1076. </configuration>
  1077. </execution>
  1078. <!-- Generate the JAR that contains the native library in it. -->
  1079. <execution>
  1080. <id>native-jar</id>
  1081. <goals>
  1082. <goal>jar</goal>
  1083. </goals>
  1084. <configuration>
  1085. <archive>
  1086. <manifest>
  1087. <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
  1088. <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
  1089. </manifest>
  1090. <manifestEntries>
  1091. <Automatic-Module-Name>${javaModuleNameWithClassifier}</Automatic-Module-Name>
  1092. <Fragment-Host>${fragmentHost}</Fragment-Host>
  1093. <Bundle-NativeCode>${bundleNativeCode}</Bundle-NativeCode>
  1094. </manifestEntries>
  1095. <index>true</index>
  1096. <manifestFile>${project.build.directory}/manifests/MANIFEST-native.MF</manifestFile>
  1097. </archive>
  1098. <classifier>${jni.classifier}</classifier>
  1099. </configuration>
  1100. </execution>
  1101. </executions>
  1102. </plugin>
  1103. <plugin>
  1104. <groupId>com.simpligility.maven.plugins</groupId>
  1105. <artifactId>android-maven-plugin</artifactId>
  1106. <extensions>true</extensions>
  1107. <configuration>
  1108. <sdk>
  1109. <platform>${androidMinSdkVersion}</platform>
  1110. </sdk>
  1111. <androidManifestFile>${project.build.directory}/android-build/AndroidManifest.xml</androidManifestFile>
  1112. <nativeLibrariesDirectory>${project.build.directory}/android-build/native-libs</nativeLibrariesDirectory>
  1113. <classesJarExcludes>
  1114. <exclude>META-INF</exclude>
  1115. </classesJarExcludes>
  1116. <classifier>${jni.classifier}</classifier>
  1117. </configuration>
  1118. <executions>
  1119. <execution>
  1120. <phase>package</phase>
  1121. </execution>
  1122. </executions>
  1123. </plugin>
  1124. </plugins>
  1125. </build>
  1126. <dependencies>
  1127. <dependency>
  1128. <groupId>io.netty</groupId>
  1129. <artifactId>netty-jni-util</artifactId>
  1130. <version>${netty.jni-util.version}</version>
  1131. <classifier>sources</classifier>
  1132. <optional>true</optional>
  1133. </dependency>
  1134. <dependency>
  1135. <groupId>${project.groupId}</groupId>
  1136. <artifactId>netty-incubator-codec-classes-quic</artifactId>
  1137. <version>${project.version}</version>
  1138. <scope>compile</scope>
  1139. </dependency>
  1140. <dependency>
  1141. <groupId>io.netty</groupId>
  1142. <artifactId>netty-transport-native-epoll</artifactId>
  1143. <version>${netty.version}</version>
  1144. <classifier>linux-x86_64</classifier>
  1145. <scope>test</scope>
  1146. </dependency>
  1147. <dependency>
  1148. <groupId>io.netty</groupId>
  1149. <artifactId>netty-transport-native-epoll</artifactId>
  1150. <version>${netty.version}</version>
  1151. <classifier>linux-aarch_64</classifier>
  1152. <scope>test</scope>
  1153. </dependency>
  1154. <dependency>
  1155. <groupId>org.junit.jupiter</groupId>
  1156. <artifactId>junit-jupiter-api</artifactId>
  1157. <version>${junit.version}</version>
  1158. <scope>test</scope>
  1159. </dependency>
  1160. <dependency>
  1161. <groupId>org.junit.jupiter</groupId>
  1162. <artifactId>junit-jupiter-engine</artifactId>
  1163. <version>${junit.version}</version>
  1164. <scope>test</scope>
  1165. </dependency>
  1166. <dependency>
  1167. <groupId>org.junit.jupiter</groupId>
  1168. <artifactId>junit-jupiter-params</artifactId>
  1169. <version>${junit.version}</version>
  1170. <scope>test</scope>
  1171. </dependency>
  1172. <dependency>
  1173. <groupId>org.hamcrest</groupId>
  1174. <artifactId>hamcrest-library</artifactId>
  1175. <version>1.3</version>
  1176. <scope>test</scope>
  1177. </dependency>
  1178. <dependency>
  1179. <groupId>io.netty</groupId>
  1180. <artifactId>netty-build-common</artifactId>
  1181. <version>${netty.build.version}</version>
  1182. <scope>test</scope>
  1183. </dependency>
  1184. <dependency>
  1185. <groupId>ch.qos.logback</groupId>
  1186. <artifactId>logback-classic</artifactId>
  1187. <version>1.3.12</version>
  1188. <scope>test</scope>
  1189. </dependency>
  1190. <!-- Also include bouncycastle so we can use SelfSignedCertificate even on more recent JDKs during testing -->
  1191. <dependency>
  1192. <groupId>org.bouncycastle</groupId>
  1193. <artifactId>bcpkix-jdk15on</artifactId>
  1194. <version>1.70</version>
  1195. <scope>test</scope>
  1196. </dependency>
  1197. <dependency>
  1198. <groupId>org.assertj</groupId>
  1199. <artifactId>assertj-core</artifactId>
  1200. <version>3.20.2</version>
  1201. <scope>test</scope>
  1202. </dependency>
  1203. <dependency>
  1204. <groupId>org.jetbrains</groupId>
  1205. <artifactId>annotations</artifactId>
  1206. </dependency>
  1207. <dependency>
  1208. <groupId>com.google.code.findbugs</groupId>
  1209. <artifactId>jsr305</artifactId>
  1210. </dependency>
  1211. </dependencies>
  1212. </project>