netty-incubator-codec-native-quic-0.0.51.Final.pom 57 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237
  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.51.Final</version>
  23. </parent>
  24. <artifactId>netty-incubator-codec-native-quic</artifactId>
  25. <version>0.0.51.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>chromium-stable</boringsslBranch>
  48. <boringsslCommitSha>dd5219451c3ce26221762a15d867edf43b463bb2</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>28ef289f027713cb024e3171ccfa2972fc12a9e2</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. <!-- On Windows, build with /MT for static linking -->
  91. <cmakeCFlags>/MT</cmakeCFlags>
  92. <!-- Disable one warning to be able to build on windows -->
  93. <cmakeCxxFlags>/MT /wd4091</cmakeCxxFlags>
  94. <libssl>ssl.lib</libssl>
  95. <libcrypto>crypto.lib</libcrypto>
  96. <libquiche>quiche.lib</libquiche>
  97. <bundleNativeCode>META-INF/native/${jniLibName}.dll;osname=win32;processor=${os.detected.arch}</bundleNativeCode>
  98. </properties>
  99. </profile>
  100. <profile>
  101. <id>mac</id>
  102. <activation>
  103. <os>
  104. <family>mac</family>
  105. </os>
  106. </activation>
  107. <properties>
  108. <!-- We need 10.12 as minimum to compile quiche and use it.
  109. Anything below will fail when trying to load quiche with:
  110. Symbol not found: ___isPlatformVersionAtLeast
  111. -->
  112. <macosxDeploymentTarget>10.12</macosxDeploymentTarget>
  113. <!-- On *nix, add ASM flags to disable executable stack -->
  114. <cmakeAsmFlags>-Wa,--noexecstack -mmacosx-version-min=${macosxDeploymentTarget}</cmakeAsmFlags>
  115. <extraCflags>-mmacosx-version-min=${macosxDeploymentTarget}</extraCflags>
  116. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  117. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  118. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  119. <libssl>libssl.a</libssl>
  120. <libcrypto>libcrypto.a</libcrypto>
  121. <libquiche>libquiche.a</libquiche>
  122. <extraLdflags>-platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} -mmacosx-version-min=${macosxDeploymentTarget}</extraLdflags>
  123. <extraConfigureArg>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg>
  124. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=${os.detected.arch}</bundleNativeCode>
  125. </properties>
  126. </profile>
  127. <profile>
  128. <id>mac-m1-cross-compile</id>
  129. <properties>
  130. <jniLibName>netty_quiche_osx_aarch_64</jniLibName>
  131. <jni.classifier>osx-aarch_64</jni.classifier>
  132. <javaModuleNameClassifier>osx.aarch_64</javaModuleNameClassifier>
  133. <macosxDeploymentTarget>11.0</macosxDeploymentTarget>
  134. <extraCflags>-target arm64-apple-macos11</extraCflags>
  135. <extraCxxflags>-target arm64-apple-macos11</extraCxxflags>
  136. <!-- On *nix, add ASM flags to disable executable stack -->
  137. <cmakeAsmFlags>-Wa,--noexecstack -target arm64-apple-macos11</cmakeAsmFlags>
  138. <extraCmakeFlags>-DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64</extraCmakeFlags>
  139. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  140. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  141. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  142. <libssl>libssl.a</libssl>
  143. <libcrypto>libcrypto.a</libcrypto>
  144. <libquiche>libquiche.a</libquiche>
  145. <extraLdflags>-arch arm64 -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget}</extraLdflags>
  146. <extraConfigureArg>--host=aarch64-apple-darwin</extraConfigureArg>
  147. <extraConfigureArg2>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg2>
  148. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=aarch64</bundleNativeCode>
  149. <!-- Don't run tests as we can't load the aarch64 lib on a x86_64 system -->
  150. <skipTests>true</skipTests>
  151. <crossCompile>mac</crossCompile>
  152. <quicheTarget>aarch64-apple-darwin</quicheTarget>
  153. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  154. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  155. </properties>
  156. </profile>
  157. <profile>
  158. <id>mac-intel-cross-compile</id>
  159. <properties>
  160. <jniLibName>netty_quiche_osx_x86_64</jniLibName>
  161. <jni.classifier>osx-x86_64</jni.classifier>
  162. <javaModuleNameClassifier>osx.x86_64</javaModuleNameClassifier>
  163. <macosxDeploymentTarget>10.12</macosxDeploymentTarget>
  164. <extraCflags>-target x86_64-apple-macos10.12 -mmacosx-version-min=${macosxDeploymentTarget}</extraCflags>
  165. <extraCxxflags>-target x86_64-apple-macos10.12</extraCxxflags>
  166. <!-- On *nix, add ASM flags to disable executable stack -->
  167. <cmakeAsmFlags>-Wa,--noexecstack -target x86_64-apple-macos10.12 -mmacosx-version-min=${macosxDeploymentTarget}</cmakeAsmFlags>
  168. <extraCmakeFlags>-DCMAKE_SYSTEM_PROCESSOR=x86_64 -DCMAKE_OSX_ARCHITECTURES=x86_64</extraCmakeFlags>
  169. <cmakeCFlags>${extraCflags} -O3 -fno-omit-frame-pointer</cmakeCFlags>
  170. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  171. <cmakeCxxFlags>${extraCxxflags} -O3 -fno-omit-frame-pointer -Wno-error=range-loop-analysis</cmakeCxxFlags>
  172. <libssl>libssl.a</libssl>
  173. <libcrypto>libcrypto.a</libcrypto>
  174. <libquiche>libquiche.a</libquiche>
  175. <extraLdflags>-arch x86_64 -platform_version,macos,${macosxDeploymentTarget},${macosxDeploymentTarget} -mmacosx-version-min=${macosxDeploymentTarget}</extraLdflags>
  176. <extraConfigureArg>--host=x86_64-apple-darwin</extraConfigureArg>
  177. <extraConfigureArg2>MACOSX_DEPLOYMENT_TARGET=${macosxDeploymentTarget}</extraConfigureArg2>
  178. <bundleNativeCode>META-INF/native/lib${jniLibName}.jnilib;osname=macos;osname=macosx;processor=x86_64</bundleNativeCode>
  179. <!-- Don't run tests as we can't load the x86_64 lib on a aarch64 system -->
  180. <skipTests>true</skipTests>
  181. <crossCompile>mac</crossCompile>
  182. <quicheTarget>x86_64-apple-darwin</quicheTarget>
  183. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  184. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  185. </properties>
  186. </profile>
  187. <profile>
  188. <id>linux</id>
  189. <activation>
  190. <os>
  191. <family>linux</family>
  192. </os>
  193. <property>
  194. <name>!android</name>
  195. </property>
  196. </activation>
  197. <properties>
  198. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  199. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  200. <!-- On *nix, add ASM flags to disable executable stack -->
  201. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  202. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  203. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  204. <cmakeCxxFlags>${extraCxxflags} -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  205. <libssl>libssl.a</libssl>
  206. <libcrypto>libcrypto.a</libcrypto>
  207. <libquiche>libquiche.a</libquiche>
  208. <extraLdflags>-Wl,--strip-debug -Wl,--exclude-libs,ALL -Wl,-lrt</extraLdflags>
  209. <bundleNativeCode>META-INF/native/lib${jniLibName}.so;osname=linux;processor=${os.detected.arch}</bundleNativeCode>
  210. </properties>
  211. </profile>
  212. <profile>
  213. <id>android-armeabi-v7a</id>
  214. <activation>
  215. <os>
  216. <family>linux</family>
  217. </os>
  218. <property>
  219. <name>android</name>
  220. </property>
  221. </activation>
  222. <properties>
  223. <!-- https://developer.android.com/ndk/guides/other_build_systems -->
  224. <!-- https://github.com/android/ndk/issues/1324 -->
  225. <androidAbi>armeabi-v7a</androidAbi>
  226. <androidTriple>armv7a-linux-androideabi</androidTriple>
  227. <quicheTarget>armv7-linux-androideabi</quicheTarget>
  228. </properties>
  229. </profile>
  230. <profile>
  231. <id>android-arm64-v8a</id>
  232. <properties>
  233. <androidAbi>arm64-v8a</androidAbi>
  234. <androidTriple>aarch64-linux-android</androidTriple>
  235. <quicheTarget>aarch64-linux-android</quicheTarget>
  236. </properties>
  237. </profile>
  238. <profile>
  239. <id>android-x86</id>
  240. <properties>
  241. <androidAbi>x86</androidAbi>
  242. <androidTriple>i686-linux-android</androidTriple>
  243. <quicheTarget>i686-linux-android</quicheTarget>
  244. </properties>
  245. </profile>
  246. <profile>
  247. <id>android-x86_64</id>
  248. <properties>
  249. <androidAbi>x86_64</androidAbi>
  250. <androidTriple>x86_64-linux-android</androidTriple>
  251. <quicheTarget>x86_64-linux-android</quicheTarget>
  252. </properties>
  253. </profile>
  254. <profile>
  255. <id>android</id>
  256. <activation>
  257. <os>
  258. <family>linux</family>
  259. </os>
  260. <property>
  261. <name>android</name>
  262. </property>
  263. </activation>
  264. <properties>
  265. <packaging.type>aar</packaging.type>
  266. <skipTests>true</skipTests>
  267. <platform>android</platform>
  268. <androidNdkVersion>21</androidNdkVersion>
  269. <androidMinSdkVersion>21</androidMinSdkVersion>
  270. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  271. <skipIteration>false</skipIteration>
  272. <nativeLibOnlyDir>${project.build.directory}/native-lib-only/${androidAbi}</nativeLibOnlyDir>
  273. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  274. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  275. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  276. <!-- On *nix, add ASM flags to disable executable stack -->
  277. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  278. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  279. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  280. <cmakeCxxFlags>${extraCxxflags} -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  281. <libssl>libssl.a</libssl>
  282. <libcrypto>libcrypto.a</libcrypto>
  283. <libquiche>libquiche.a</libquiche>
  284. <!-- https://developer.android.com/ndk/guides/other_build_systems -->
  285. <jniLibName>netty_quiche</jniLibName>
  286. <jni.classifier>${platform}</jni.classifier>
  287. <javaModuleNameClassifier>android</javaModuleNameClassifier>
  288. <cflags>-std=c99 -Werror -fno-omit-frame-pointer -fvisibility=hidden -Wunused -Wno-unused-value -O3 -I${quicheHomeIncludeDir} -I${boringsslHomeIncludeDir}</cflags>
  289. <ldflags>-L${quicheHomeBuildDir} -lquiche -L${boringsslHomeBuildDir} -lssl -lcrypto</ldflags>
  290. <bundleNativeCode>META-INF/native/${jniLibName}.dll;osname=android;processor=${androidAbi}</bundleNativeCode>
  291. <ndkToolchain>${ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/linux-x86_64</ndkToolchain>
  292. <extraLdflags>-Wl,-soname=${jniLibName}.so -Wl,--strip-debug -Wl,--exclude-libs,ALL -lm</extraLdflags>
  293. <extraConfigureArg>--host=${androidTriple}</extraConfigureArg>
  294. <boringsslBuildDir>${boringsslSourceDir}/build/${androidAbi}</boringsslBuildDir>
  295. <boringsslHomeDir>${project.build.directory}/boringssl/${androidAbi}</boringsslHomeDir>
  296. <quicheHomeDir>${project.build.directory}/quiche/${androidAbi}</quicheHomeDir>
  297. <hawtjniBuildDir>${project.build.directory}/native-build/${androidAbi}</hawtjniBuildDir>
  298. </properties>
  299. <build>
  300. <plugins>
  301. <plugin>
  302. <groupId>com.soebes.maven.plugins</groupId>
  303. <artifactId>iterator-maven-plugin</artifactId>
  304. <!-- Don't use 0.5.1, it contains a change that merges all properties,
  305. and therefore doesn't re-evaluates "nested" properties (e.g. cargoTarget, which uses ${quicheTarget}).
  306. Keep this version or provide a fix to disable merging of properties in iterator-maven-plugin -->
  307. <version>0.5.0</version>
  308. <executions>
  309. <execution>
  310. <phase>package</phase>
  311. <goals>
  312. <goal>invoker</goal>
  313. </goals>
  314. <configuration>
  315. <itemsWithProperties>
  316. <itemWithProperty>
  317. <name>arm64-v8a</name>
  318. <properties>
  319. <skipIteration>true</skipIteration>
  320. </properties>
  321. </itemWithProperty>
  322. <itemWithProperty>
  323. <name>x86</name>
  324. <properties>
  325. <skipIteration>true</skipIteration>
  326. </properties>
  327. </itemWithProperty>
  328. <itemWithProperty>
  329. <name>x86_64</name>
  330. <properties>
  331. <skipIteration>true</skipIteration>
  332. </properties>
  333. </itemWithProperty>
  334. </itemsWithProperties>
  335. <baseDirectory>${project.basedir}</baseDirectory>
  336. <goals>
  337. <goal>package</goal>
  338. </goals>
  339. <profiles>android-@item@,android</profiles>
  340. <skip>${skipIteration}</skip>
  341. </configuration>
  342. </execution>
  343. </executions>
  344. </plugin>
  345. <plugin>
  346. <groupId>org.fusesource.hawtjni</groupId>
  347. <artifactId>hawtjni-maven-plugin</artifactId>
  348. <executions>
  349. <execution>
  350. <id>generate-native-lib</id>
  351. <configuration>
  352. <configureArgs>
  353. <configureArg>${extraConfigureArg}</configureArg>
  354. <configureArg>${extraConfigureArg2}</configureArg>
  355. <configureArg>CFLAGS=${cflags}</configureArg>
  356. <configureArg>LDFLAGS=${ldflags} ${extraLdflags}</configureArg>
  357. <configureArg>--libdir=${hawtjniBuildDir}/native-build/target/lib</configureArg>
  358. <configureArg>TOOLCHAIN=${ndkToolchain}</configureArg>
  359. <configureArg>TARGET=${androidTriple}</configureArg>
  360. <configureArg>API=${androidMinSdkVersion}</configureArg>
  361. <configureArg>AR=${ndkToolchain}/bin/llvm-ar</configureArg>
  362. <configureArg>CC=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang</configureArg>
  363. <configureArg>AS=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang</configureArg>
  364. <configureArg>CXX=${ndkToolchain}/bin/${androidTriple}${androidMinSdkVersion}-clang++</configureArg>
  365. <configureArg>LD=${ndkToolchain}/bin/ld</configureArg>
  366. <configureArg>RANLIB=${ndkToolchain}/bin/llvm-ranlib</configureArg>
  367. <configureArg>STRIP=${ndkToolchain}/bin/llvm-strip</configureArg>
  368. </configureArgs>
  369. <buildDirectory>${hawtjniBuildDir}</buildDirectory>
  370. </configuration>
  371. <goals>
  372. <goal>generate</goal>
  373. <goal>build</goal>
  374. </goals>
  375. </execution>
  376. </executions>
  377. </plugin>
  378. <plugin>
  379. <artifactId>maven-jar-plugin</artifactId>
  380. <executions>
  381. <execution>
  382. <id>native-jar</id>
  383. <phase>none</phase>
  384. </execution>
  385. </executions>
  386. </plugin>
  387. <plugin>
  388. <groupId>org.apache.felix</groupId>
  389. <artifactId>maven-bundle-plugin</artifactId>
  390. <executions>
  391. <execution>
  392. <id>generate-manifest</id>
  393. <phase>none</phase>
  394. </execution>
  395. </executions>
  396. </plugin>
  397. <plugin>
  398. <artifactId>maven-antrun-plugin</artifactId>
  399. <!-- Copy the native lib that was generated and the license material for attribution -->
  400. <executions>
  401. <execution>
  402. <id>copy-android-native-lib</id>
  403. <phase>initialize</phase>
  404. <goals>
  405. <goal>run</goal>
  406. </goals>
  407. <configuration>
  408. <target>
  409. <!-- Add the ant tasks from ant-contrib -->
  410. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  411. <filter token="JAVA_MODULE_NAME" value="${javaModuleNameWithClassifier}" />
  412. <filter token="MIN_SDK_VERSION" value="${androidMinSdkVersion}" />
  413. <copy file="src/main/AndroidManifest.xml" todir="${project.build.directory}/android-build/" filtering="true" />
  414. <!-- Create an empty MANIFEST.MF file -->
  415. <touch file="${project.build.outputDirectory}/META-INF/MANIFEST.MF" mkdirs="true" />
  416. </target>
  417. </configuration>
  418. </execution>
  419. <!-- Copy the native lib that was generated and the license material for attribution -->
  420. <execution>
  421. <id>copy-native-lib-and-license</id>
  422. <phase>none</phase>
  423. </execution>
  424. <!-- Copy the native android lib that was generated and the license material for attribution -->
  425. <execution>
  426. <id>copy-android-native-libs</id>
  427. <phase>process-test-resources</phase>
  428. <goals>
  429. <goal>run</goal>
  430. </goals>
  431. <configuration>
  432. <target>
  433. <!-- Add the ant tasks from ant-contrib -->
  434. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  435. <copy todir="${project.build.directory}/android-build/native-libs/${androidAbi}" includeEmptyDirs="false">
  436. <zipfileset dir="${nativeLibOnlyDir}/META-INF/native" />
  437. <regexpmapper handledirsep="yes" from="^(?:[^/]+/)*([^/]+)$" to="\1" />
  438. </copy>
  439. </target>
  440. </configuration>
  441. </execution>
  442. </executions>
  443. </plugin>
  444. </plugins>
  445. </build>
  446. </profile>
  447. <profile>
  448. <id>linux-aarch64</id>
  449. <properties>
  450. <extraCflags>-O3 -fno-omit-frame-pointer</extraCflags>
  451. <extraCxxflags>-O3 -fno-omit-frame-pointer</extraCxxflags>
  452. <!-- On *nix, add ASM flags to disable executable stack -->
  453. <cmakeAsmFlags>-Wa,--noexecstack</cmakeAsmFlags>
  454. <cmakeCFlags>${extraCflags}</cmakeCFlags>
  455. <!-- We need to define __STDC_CONSTANT_MACROS and __STDC_FORMAT_MACROS when building boringssl on centos 6 -->
  456. <cmakeCxxFlags>${extraCxxflags} -Wno-error=maybe-uninitialized -Wno-error=shadow -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS</cmakeCxxFlags>
  457. <libssl>libssl.a</libssl>
  458. <libcrypto>libcrypto.a</libcrypto>
  459. <libquiche>libquiche.a</libquiche>
  460. <extraLdflags>-Wl,--strip-debug -Wl,--exclude-libs,ALL</extraLdflags>
  461. <bundleNativeCode>META-INF/native/lib${jniLibName}.so;osname=linux;processor=aarch64</bundleNativeCode>
  462. <jniLibName>netty_quiche_linux_aarch_64</jniLibName>
  463. <jni.classifier>linux-aarch_64</jni.classifier>
  464. <javaModuleNameClassifier>linux.aarch_64</javaModuleNameClassifier>
  465. <extraConfigureArg>--host=aarch64-linux-gnu</extraConfigureArg>
  466. <extraConfigureArg2>CC=aarch64-none-linux-gnu-gcc</extraConfigureArg2>
  467. <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>
  468. <!-- Don't run tests as we can't load the aarch64 lib on a x86_64 system -->
  469. <skipTests>true</skipTests>
  470. <crossCompile>linux</crossCompile>
  471. <quicheTarget>aarch64-unknown-linux-gnu</quicheTarget>
  472. <cargoTarget>--target=${quicheTarget}</cargoTarget>
  473. <quicheBuildDir>${quicheSourceDir}/target/${quicheTarget}/release</quicheBuildDir>
  474. </properties>
  475. </profile>
  476. <profile>
  477. <id>leak</id>
  478. <properties>
  479. <test.argLine>-Dio.netty.leakDetectionLevel=paranoid -Dio.netty.leakDetection.targetRecords=32</test.argLine>
  480. </properties>
  481. </profile>
  482. <!-- Build with unsafe disabled which also means the memory address cant be accessed-->
  483. <profile>
  484. <id>noUnsafe</id>
  485. <properties>
  486. <test.argLine>-Dio.netty.noUnsafe=true</test.argLine>
  487. </properties>
  488. </profile>
  489. <!-- Profile related to native-image -->
  490. <!-- ./mvnw -Pnative-image-agent -pl codec-native-quic test -->
  491. <profile>
  492. <id>native-image-agent</id>
  493. <dependencies>
  494. <dependency>
  495. <groupId>org.bouncycastle</groupId>
  496. <artifactId>bcpkix-jdk15on</artifactId>
  497. </dependency>
  498. </dependencies>
  499. <build>
  500. <plugins>
  501. <plugin>
  502. <artifactId>maven-compiler-plugin</artifactId>
  503. <configuration>
  504. <source>17</source>
  505. <target>17</target>
  506. </configuration>
  507. </plugin>
  508. <plugin>
  509. <artifactId>maven-surefire-plugin</artifactId>
  510. <configuration>
  511. <excludes>
  512. <exclude>io.netty.incubator.codec.quic.QuicChannelEchoTest</exclude>
  513. </excludes>
  514. </configuration>
  515. </plugin>
  516. <plugin>
  517. <groupId>org.graalvm.buildtools</groupId>
  518. <artifactId>native-maven-plugin</artifactId>
  519. <version>${native.maven.plugin.version}</version>
  520. <dependencies>
  521. <dependency>
  522. <groupId>org.codehaus.plexus</groupId>
  523. <artifactId>plexus-utils</artifactId>
  524. <version>3.4.2</version>
  525. </dependency>
  526. </dependencies>
  527. <extensions>true</extensions>
  528. <executions>
  529. <execution>
  530. <id>test-native</id>
  531. <goals>
  532. <goal>test</goal>
  533. </goals>
  534. <phase>test</phase>
  535. </execution>
  536. </executions>
  537. <configuration>
  538. <skipNativeTests>true</skipNativeTests>
  539. <metadataRepository>
  540. <enabled>true</enabled>
  541. </metadataRepository>
  542. <agent>
  543. <enabled>true</enabled>
  544. <defaultMode>Conditional</defaultMode>
  545. <modes>
  546. <conditional>
  547. <userCodeFilterPath>${project.basedir}/src/test/resources/netty-filter.json</userCodeFilterPath>
  548. <extraFilterPath>${project.basedir}/src/test/resources/test-class-filter.json</extraFilterPath>
  549. <parallel>true</parallel>
  550. </conditional>
  551. </modes>
  552. <options>
  553. <builtinCallerFilter>true</builtinCallerFilter>
  554. <builtinHeuristicFilter>true</builtinHeuristicFilter>
  555. <enableExperimentalPredefinedClasses>false</enableExperimentalPredefinedClasses>
  556. <enableExperimentalUnsafeAllocationTracing>false</enableExperimentalUnsafeAllocationTracing>
  557. <trackReflectionMetadata>true</trackReflectionMetadata>
  558. </options>
  559. <metadataCopy>
  560. <disabledStages>
  561. <stage>main</stage>
  562. </disabledStages>
  563. <merge>true</merge>
  564. </metadataCopy>
  565. </agent>
  566. </configuration>
  567. </plugin>
  568. </plugins>
  569. </build>
  570. </profile>
  571. </profiles>
  572. <build>
  573. <extensions>
  574. <extension>
  575. <groupId>kr.motd.maven</groupId>
  576. <artifactId>os-maven-plugin</artifactId>
  577. <version>1.7.0</version>
  578. </extension>
  579. </extensions>
  580. <plugins>
  581. <!-- Also include c files in source jar -->
  582. <plugin>
  583. <groupId>org.codehaus.mojo</groupId>
  584. <artifactId>build-helper-maven-plugin</artifactId>
  585. <executions>
  586. <execution>
  587. <phase>generate-sources</phase>
  588. <goals>
  589. <goal>add-source</goal>
  590. </goals>
  591. <configuration>
  592. <sources>
  593. <source>${nativeSourceDirectory}</source>
  594. </sources>
  595. </configuration>
  596. </execution>
  597. </executions>
  598. </plugin>
  599. <plugin>
  600. <groupId>org.apache.maven.plugins</groupId>
  601. <artifactId>maven-dependency-plugin</artifactId>
  602. <executions>
  603. <!-- unpack netty-jni-util files -->
  604. <execution>
  605. <id>unpack</id>
  606. <phase>generate-sources</phase>
  607. <goals>
  608. <goal>unpack-dependencies</goal>
  609. </goals>
  610. <configuration>
  611. <includeGroupIds>io.netty</includeGroupIds>
  612. <includeArtifactIds>netty-jni-util</includeArtifactIds>
  613. <classifier>sources</classifier>
  614. <outputDirectory>${jniUtilIncludeDir}</outputDirectory>
  615. <includes>**.h,**.c</includes>
  616. <overWriteReleases>false</overWriteReleases>
  617. <overWriteSnapshots>true</overWriteSnapshots>
  618. </configuration>
  619. </execution>
  620. </executions>
  621. </plugin>
  622. <plugin>
  623. <artifactId>maven-antrun-plugin</artifactId>
  624. <executions>
  625. <!-- Build the BoringSSL static libs -->
  626. <execution>
  627. <id>build-boringssl</id>
  628. <phase>generate-sources</phase>
  629. <goals>
  630. <goal>run</goal>
  631. </goals>
  632. <configuration>
  633. <target>
  634. <!-- Add the ant tasks from ant-contrib -->
  635. <taskdef resource="net/sf/antcontrib/antcontrib.properties" />
  636. <property environment="env" />
  637. <if>
  638. <available file="${boringsslHomeDir}" />
  639. <then>
  640. <echo message="BoringSSL was already build, skipping the build step." />
  641. </then>
  642. <else>
  643. <if>
  644. <available file="${boringsslSourceDir}" />
  645. <then>
  646. <echo message="BoringSSL was already cloned, skipping the clone step." />
  647. </then>
  648. <else>
  649. <echo message="Clone BoringSSL" />
  650. <exec executable="git" failonerror="true" dir="${project.build.directory}" resolveexecutable="true">
  651. <arg value="clone" />
  652. <arg value="--branch" />
  653. <arg value="${boringsslBranch}" />
  654. <arg value="${boringsslRepository}" />
  655. <arg value="${boringsslSourceDir}" />
  656. </exec>
  657. </else>
  658. </if>
  659. <echo message="Building BoringSSL" />
  660. <!-- Use the known SHA of the commit -->
  661. <exec executable="git" failonerror="true" dir="${boringsslSourceDir}" resolveexecutable="true">
  662. <arg value="checkout" />
  663. <arg value="${boringsslCommitSha}" />
  664. </exec>
  665. <mkdir dir="${boringsslBuildDir}" />
  666. <if>
  667. <equals arg1="${platform}" arg2="android" />
  668. <then>
  669. <!-- https://boringssl.googlesource.com/boringssl/+/HEAD/BUILDING.md#building-for-android -->
  670. <exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
  671. <arg value="-DANDROID_ABI=${androidAbi}" />
  672. <arg value="-DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake" />
  673. <arg value="-DANDROID_NATIVE_API_LEVEL=${androidNdkVersion}" />
  674. <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
  675. <arg value="-DCMAKE_BUILD_TYPE=Release" />
  676. <arg value="-DCMAKE_ASM_FLAGS=${cmakeAsmFlags}" />
  677. <arg value="-DCMAKE_C_FLAGS_RELEASE=${cmakeCFlags}" />
  678. <arg value="-DCMAKE_CXX_FLAGS_RELEASE=${cmakeCxxFlags}" />
  679. <arg value="-GNinja" />
  680. <arg value="${boringsslSourceDir}" />
  681. </exec>
  682. </then>
  683. <else>
  684. <exec executable="cmake" failonerror="true" dir="${boringsslBuildDir}" resolveexecutable="true">
  685. <env key="MACOSX_DEPLOYMENT_TARGET" value="${macosxDeploymentTarget}" />
  686. <arg value="-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE" />
  687. <arg value="-DCMAKE_BUILD_TYPE=Release" />
  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. </manifest>
  1069. <manifestEntries>
  1070. <Automatic-Module-Name>${javaModuleName}</Automatic-Module-Name>
  1071. </manifestEntries>
  1072. <index>true</index>
  1073. <manifestFile>${project.build.directory}/manifests/MANIFEST.MF</manifestFile>
  1074. </archive>
  1075. </configuration>
  1076. </execution>
  1077. <!-- Generate the JAR that contains the native library in it. -->
  1078. <execution>
  1079. <id>native-jar</id>
  1080. <goals>
  1081. <goal>jar</goal>
  1082. </goals>
  1083. <configuration>
  1084. <archive>
  1085. <manifest>
  1086. <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
  1087. </manifest>
  1088. <manifestEntries>
  1089. <Automatic-Module-Name>${javaModuleNameWithClassifier}</Automatic-Module-Name>
  1090. <Fragment-Host>${fragmentHost}</Fragment-Host>
  1091. <Bundle-NativeCode>${bundleNativeCode}</Bundle-NativeCode>
  1092. </manifestEntries>
  1093. <index>true</index>
  1094. <manifestFile>${project.build.directory}/manifests/MANIFEST-native.MF</manifestFile>
  1095. </archive>
  1096. <classifier>${jni.classifier}</classifier>
  1097. </configuration>
  1098. </execution>
  1099. </executions>
  1100. </plugin>
  1101. <plugin>
  1102. <groupId>com.simpligility.maven.plugins</groupId>
  1103. <artifactId>android-maven-plugin</artifactId>
  1104. <extensions>true</extensions>
  1105. <configuration>
  1106. <sdk>
  1107. <platform>${androidMinSdkVersion}</platform>
  1108. </sdk>
  1109. <androidManifestFile>${project.build.directory}/android-build/AndroidManifest.xml</androidManifestFile>
  1110. <nativeLibrariesDirectory>${project.build.directory}/android-build/native-libs</nativeLibrariesDirectory>
  1111. <classesJarExcludes>
  1112. <exclude>META-INF</exclude>
  1113. </classesJarExcludes>
  1114. <classifier>${jni.classifier}</classifier>
  1115. </configuration>
  1116. <executions>
  1117. <execution>
  1118. <phase>package</phase>
  1119. </execution>
  1120. </executions>
  1121. </plugin>
  1122. </plugins>
  1123. </build>
  1124. <dependencies>
  1125. <dependency>
  1126. <groupId>io.netty</groupId>
  1127. <artifactId>netty-jni-util</artifactId>
  1128. <version>${netty.jni-util.version}</version>
  1129. <classifier>sources</classifier>
  1130. <optional>true</optional>
  1131. </dependency>
  1132. <dependency>
  1133. <groupId>${project.groupId}</groupId>
  1134. <artifactId>netty-incubator-codec-classes-quic</artifactId>
  1135. <version>${project.version}</version>
  1136. <scope>compile</scope>
  1137. </dependency>
  1138. <dependency>
  1139. <groupId>io.netty</groupId>
  1140. <artifactId>netty-transport-native-epoll</artifactId>
  1141. <version>${netty.version}</version>
  1142. <classifier>linux-x86_64</classifier>
  1143. <scope>test</scope>
  1144. </dependency>
  1145. <dependency>
  1146. <groupId>io.netty</groupId>
  1147. <artifactId>netty-transport-native-epoll</artifactId>
  1148. <version>${netty.version}</version>
  1149. <classifier>linux-aarch_64</classifier>
  1150. <scope>test</scope>
  1151. </dependency>
  1152. <dependency>
  1153. <groupId>org.junit.jupiter</groupId>
  1154. <artifactId>junit-jupiter-api</artifactId>
  1155. <version>${junit.version}</version>
  1156. <scope>test</scope>
  1157. </dependency>
  1158. <dependency>
  1159. <groupId>org.junit.jupiter</groupId>
  1160. <artifactId>junit-jupiter-engine</artifactId>
  1161. <version>${junit.version}</version>
  1162. <scope>test</scope>
  1163. </dependency>
  1164. <dependency>
  1165. <groupId>org.junit.jupiter</groupId>
  1166. <artifactId>junit-jupiter-params</artifactId>
  1167. <version>${junit.version}</version>
  1168. <scope>test</scope>
  1169. </dependency>
  1170. <dependency>
  1171. <groupId>org.hamcrest</groupId>
  1172. <artifactId>hamcrest-library</artifactId>
  1173. <version>1.3</version>
  1174. <scope>test</scope>
  1175. </dependency>
  1176. <dependency>
  1177. <groupId>io.netty</groupId>
  1178. <artifactId>netty-build-common</artifactId>
  1179. <version>${netty.build.version}</version>
  1180. <scope>test</scope>
  1181. </dependency>
  1182. <dependency>
  1183. <groupId>ch.qos.logback</groupId>
  1184. <artifactId>logback-classic</artifactId>
  1185. <version>1.3.8</version>
  1186. <scope>test</scope>
  1187. </dependency>
  1188. <!-- Also include bouncycastle so we can use SelfSignedCertificate even on more recent JDKs during testing -->
  1189. <dependency>
  1190. <groupId>org.bouncycastle</groupId>
  1191. <artifactId>bcpkix-jdk15on</artifactId>
  1192. <version>1.70</version>
  1193. <scope>test</scope>
  1194. </dependency>
  1195. <dependency>
  1196. <groupId>org.assertj</groupId>
  1197. <artifactId>assertj-core</artifactId>
  1198. <version>3.20.2</version>
  1199. <scope>test</scope>
  1200. </dependency>
  1201. </dependencies>
  1202. </project>