xref: /aosp_15_r20/external/aws-crt-java/pom.xml (revision 3c7ae9de214676c52d19f01067dc1a404272dc11)
1<project xmlns="http://maven.apache.org/POM/4.0.0"
2    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3    <modelVersion>4.0.0</modelVersion>
4    <groupId>software.amazon.awssdk.crt</groupId>
5    <artifactId>aws-crt</artifactId>
6    <packaging>jar</packaging>
7    <version>1.0.0-SNAPSHOT</version>
8    <name>${project.groupId}:${project.artifactId}</name>
9    <description>Java bindings for the AWS SDK Common Runtime</description>
10    <url>https://github.com/awslabs/aws-crt-java</url>
11
12    <licenses>
13        <license>
14            <name>The Apache Software License, Version 2.0</name>
15            <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
16        </license>
17    </licenses>
18
19    <developers>
20        <developer>
21            <name>AWS SDK Common Runtime Team</name>
22            <email>[email protected]</email>
23            <organization>Amazon Web Services</organization>
24            <organizationUrl>https://aws.amazon.com</organizationUrl>
25        </developer>
26    </developers>
27
28    <scm>
29        <connection>scm:git:git://github.com/awslabs/aws-crt-java.git</connection>
30        <developerConnection>scm:git:ssh://github.com:awslabs/aws-crt-java.git</developerConnection>
31        <url>https://github.com/awslabs/aws-crt-java/tree/main</url>
32    </scm>
33
34    <properties>
35        <cmake.command>cmake</cmake.command>
36        <cmake.buildtype>RelWithDebInfo</cmake.buildtype>
37        <cmake.buildconfig>${cmake.buildtype}</cmake.buildconfig>
38        <cmake.binaries>target/cmake-build</cmake.binaries>
39        <maven.compiler.source>1.8</maven.compiler.source>
40        <maven.compiler.target>1.8</maven.compiler.target>
41        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
42        <cmake.warningsareerrors>OFF</cmake.warningsareerrors>
43        <cmake.s2nNoPqAsm>OFF</cmake.s2nNoPqAsm>
44        <cmake.osx_arch>-DOSX_ARCH_DUMMY=1</cmake.osx_arch>
45        <cmake.min_osx_version>-DOSX_DEPLOYMENT_TARGET_DUMMY=1</cmake.min_osx_version>
46        <cmake.disable_perl>ON</cmake.disable_perl>
47        <cmake.disable_aws_lc_512avx>OFF</cmake.disable_aws_lc_512avx>
48    </properties>
49
50    <profiles>
51        <profile>
52            <id>compile-for-java-8</id>
53            <activation>
54                <jdk>[9,)</jdk>
55            </activation>
56            <properties>
57                <maven.compiler.release>8</maven.compiler.release>
58            </properties>
59        </profile>
60        <profile>
61            <id>continuous-integration</id>
62            <properties>
63                <cmake.warningsareerrors>ON</cmake.warningsareerrors>
64            </properties>
65        </profile>
66        <profile>
67            <!-- Windows profile: find cmake generators and use ALL_BUILD target
68                NOTE: CMake generator will be cached to target/cmake-build/cmake.properties, delete or edit this
69                file to change VS version
70                -->
71            <id>windows-vs</id>
72            <activation>
73                <os>
74                    <family>windows</family>
75                </os>
76            </activation>
77            <properties>
78                <cmake.buildtype></cmake.buildtype>
79                <cmake.buildconfig>RelWithDebInfo</cmake.buildconfig>
80                <cmake.cflags/>
81            </properties>
82        </profile>
83        <!-- Unix/Linux/OSX profiles: use makefiles and the "all" compile target -->
84        <profile>
85            <id>unix-make</id>
86            <activation>
87                <os>
88                    <family>unix</family>
89                </os>
90            </activation>
91            <properties>
92                <cmake.cflags/>
93            </properties>
94        </profile>
95        <profile>
96            <id>mac-x64</id>
97            <activation>
98                <os>
99                    <family>mac</family>
100                    <arch>x86_64</arch>
101                </os>
102            </activation>
103            <properties>
104                <cmake.cflags/>
105                <cmake.min_osx_version>-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9</cmake.min_osx_version>
106                <cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=x86_64</cmake.osx_arch>
107            </properties>
108        </profile>
109        <profile>
110            <id>mac-arm64</id>
111                <activation>
112                    <os>
113                        <family>mac</family>
114                        <arch>arm64</arch>
115                    </os>
116                </activation>
117            <properties>
118                <cmake.min_osx_version>-DCMAKE_OSX_DEPLOYMENT_TARGET=10.9</cmake.min_osx_version>
119                <cmake.osx_arch>-DCMAKE_OSX_ARCHITECTURES=arm64</cmake.osx_arch>
120            </properties>
121        </profile>
122        <!-- 32-bit Unix -->
123        <profile>
124            <id>unix-x86</id>
125            <activation>
126                <os>
127                    <family>unix</family>
128                    <arch>i386</arch>
129                </os>
130            </activation>
131            <properties>
132                <cmake.cflags>-m32</cmake.cflags>
133            </properties>
134        </profile>
135        <profile>
136            <id>debug-native</id>
137            <activation>
138                <property>
139                    <name>debug.native</name>
140                </property>
141            </activation>
142            <properties>
143                <cmake.buildtype>Debug</cmake.buildtype>
144            </properties>
145        </profile>
146        <!-- native compilation -->
147        <profile>
148            <id>build-shared-lib</id>
149            <activation>
150                <property>
151                    <name>!shared-lib.skip</name>
152                </property>
153            </activation>
154            <build>
155                <plugins>
156                    <!-- cmake configure and build -->
157                    <plugin>
158                        <groupId>org.codehaus.mojo</groupId>
159                        <artifactId>exec-maven-plugin</artifactId>
160                        <version>1.3.2</version>
161                        <executions>
162                            <!-- cmake configure -->
163                            <execution>
164                                <id>cmake-configure</id>
165                                <phase>generate-sources</phase>
166                                <goals>
167                                    <goal>exec</goal>
168                                </goals>
169                                <configuration>
170                                    <executable>${cmake.command}</executable>
171                                    <workingDirectory>${project.basedir}</workingDirectory>
172                                    <arguments>
173                                        <argument>-B${cmake.binaries}</argument>
174                                        <argument>-H${project.basedir}</argument>
175                                        <argument>-DCMAKE_BUILD_TYPE=${cmake.buildtype}</argument>
176                                        <argument>-DCMAKE_EXPORT_COMPILE_COMMANDS=ON</argument>
177                                        <argument>-DBUILD_DEPS=ON</argument>
178                                        <argument>-DAWS_WARNINGS_ARE_ERRORS=${cmake.warningsareerrors}</argument>
179                                        <argument>-DCMAKE_PREFIX_PATH=${cmake.binaries}/install</argument>
180                                        <argument>-DCMAKE_INSTALL_PREFIX=${cmake.binaries}/install</argument>
181                                        <argument>-DCMAKE_C_FLAGS=${cmake.cflags}</argument>
182                                        <argument>${cmake.min_osx_version}</argument>
183                                        <argument>${cmake.osx_arch}</argument>
184                                        <argument>-DS2N_NO_PQ_ASM=${cmake.s2nNoPqAsm}</argument>
185                                        <argument>-DBUILD_TESTING=OFF</argument>
186                                        <argument>-DDISABLE_PERL=${cmake.disable_perl}</argument>
187                                        <argument>-DMY_ASSEMBLER_IS_TOO_OLD_FOR_512AVX=${cmake.disable_aws_lc_512avx}</argument>
188                                        <argument>--no-warn-unused-cli</argument>
189                                        <argument>${cmake.generator}</argument>
190                                        <argument>${cmake.toolset}</argument>
191                                    </arguments>
192                                </configuration>
193                            </execution>
194                            <!-- cmake build -->
195                            <execution>
196                                <id>make</id>
197                                <phase>generate-resources</phase>
198                                <goals>
199                                    <goal>exec</goal>
200                                </goals>
201                                <configuration>
202                                    <executable>${cmake.command}</executable>
203                                    <workingDirectory>${cmake.binaries}</workingDirectory>
204                                    <arguments>
205                                        <argument>--build</argument>
206                                        <argument>.</argument>
207                                        <argument>--config</argument>
208                                        <argument>${cmake.buildconfig}</argument>
209                                        <argument>--target</argument>
210                                        <argument>aws-crt-jni</argument>
211                                    </arguments>
212                                </configuration>
213                            </execution>
214                        </executions>
215                    </plugin>
216                </plugins>
217            </build>
218        </profile>
219        <profile>
220            <id>release</id>
221            <distributionManagement>
222                <snapshotRepository>
223                    <id>ossrh</id>
224                    <url>https://aws.oss.sonatype.org/content/repositories/snapshots</url>
225                </snapshotRepository>
226            </distributionManagement>
227            <build>
228                <plugins>
229                    <!-- staging/release to Sonatype -->
230                    <plugin>
231                        <groupId>org.sonatype.plugins</groupId>
232                        <artifactId>nexus-staging-maven-plugin</artifactId>
233                        <version>1.6.8</version>
234                        <extensions>true</extensions>
235                        <configuration>
236                            <serverId>ossrh</serverId>
237                            <nexusUrl>https://aws.oss.sonatype.org/</nexusUrl>
238                            <autoReleaseAfterClose>false</autoReleaseAfterClose>
239                            <skipStagingRepositoryClose>true</skipStagingRepositoryClose>
240                        </configuration>
241                    </plugin>
242                    <!-- source jar -->
243                    <plugin>
244                        <groupId>org.apache.maven.plugins</groupId>
245                        <artifactId>maven-source-plugin</artifactId>
246                        <version>2.2.1</version>
247                        <executions>
248                            <execution>
249                                <id>attach-sources</id>
250                                <goals>
251                                    <goal>jar-no-fork</goal>
252                                </goals>
253                            </execution>
254                        </executions>
255                    </plugin>
256                    <!-- javadoc jar -->
257                    <plugin>
258                        <groupId>org.apache.maven.plugins</groupId>
259                        <artifactId>maven-javadoc-plugin</artifactId>
260                        <version>2.9.1</version>
261                        <executions>
262                            <execution>
263                                <id>attach-javadocs</id>
264                                <goals>
265                                    <goal>jar</goal>
266                                </goals>
267                            </execution>
268                        </executions>
269                    </plugin>
270                    <!-- GPG signing -->
271                    <plugin>
272                        <groupId>org.apache.maven.plugins</groupId>
273                        <artifactId>maven-gpg-plugin</artifactId>
274                        <version>1.5</version>
275                        <executions>
276                            <execution>
277                                <id>sign-artifacts</id>
278                                <phase>verify</phase>
279                                <goals>
280                                    <goal>sign</goal>
281                                </goals>
282                                <configuration>
283                                    <keyname>${gpg.keyname}</keyname>
284                                </configuration>
285                            </execution>
286                        </executions>
287                    </plugin>
288                </plugins>
289            </build>
290        </profile>
291    </profiles>
292
293    <dependencies>
294        <dependency>
295            <groupId>junit</groupId>
296            <artifactId>junit</artifactId>
297            <version>4.13.1</version>
298            <scope>test</scope>
299        </dependency>
300        <dependency>
301            <groupId>org.mockito</groupId>
302            <artifactId>mockito-core</artifactId>
303            <version>4.7.0</version>
304            <scope>test</scope>
305        </dependency>
306        <dependency>
307            <groupId>commons-cli</groupId>
308            <artifactId>commons-cli</artifactId>
309            <version>1.4</version>
310            <scope>test</scope>
311        </dependency>
312    </dependencies>
313    <build>
314        <resources>
315            <!-- shared libs built via cmake -->
316            <resource>
317                <directory>${cmake.binaries}/lib</directory>
318                <excludes>
319                    <exclude>**/*.ilk</exclude>                    <!-- no one needs incremental linker files in their jar -->
320                    <exclude>**/*.pdb</exclude>                    <!-- do not package pdbs, comment this out to debug C code -->
321                    <exclude>**/*.dbg</exclude>                    <!-- UNIX debug info, same as PDBs -->
322                    <exclude>**/*.a</exclude>                      <!-- ignore any libraries from building -->
323                </excludes>
324            </resource>
325        </resources>
326        <testResources>
327            <testResource>
328                <directory>src/test/resources</directory>
329            </testResource>
330        </testResources>
331        <plugins>
332            <plugin>
333                <groupId>org.apache.maven.plugins</groupId>
334                <artifactId>maven-compiler-plugin</artifactId>
335                <version>3.8.1</version>
336            </plugin>
337            <plugin>
338                <groupId>org.apache.maven.plugins</groupId>
339                <artifactId>maven-jar-plugin</artifactId>
340                <version>3.1.0</version>
341                <executions>
342                    <execution>
343                        <goals>
344                            <goal>test-jar</goal>
345                        </goals>
346                    </execution>
347                </executions>
348                <configuration>
349                    <classifier>${crt.classifier}</classifier>
350                    <archive>
351                        <manifest>
352                            <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
353                            <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
354                        </manifest>
355                    </archive>
356                </configuration>
357            </plugin>
358            <!-- make build dir for cmake -->
359            <plugin>
360                <artifactId>maven-antrun-plugin</artifactId>
361                <version>1.8</version>
362                <executions>
363                    <execution>
364                        <id>create-build-dir</id>
365                        <phase>initialize</phase>
366                        <configuration>
367                            <target>
368                                <mkdir dir="${cmake.binaries}"/>
369                            </target>
370                        </configuration>
371                        <goals>
372                            <goal>run</goal>
373                        </goals>
374                    </execution>
375                    <execution>
376                        <id>cmake-generator</id>
377                        <phase>initialize</phase>
378                        <goals>
379                            <goal>run</goal>
380                        </goals>
381                        <configuration>
382                            <exportAntProperties>true</exportAntProperties>
383                            <target>
384                                <property environment="env"/>
385                                <condition property="cmake.generator" value="-G${env.AWS_CMAKE_GENERATOR}" else="-DGENERATOR_DUMMY=1">
386                                    <isset property="env.AWS_CMAKE_GENERATOR" />
387                                </condition>
388                                <echo message="Generator = ${cmake.generator}"/>
389                            </target>
390                        </configuration>
391                    </execution>
392                    <execution>
393                        <id>cmake-toolset</id>
394                        <phase>initialize</phase>
395                        <goals>
396                            <goal>run</goal>
397                        </goals>
398                        <configuration>
399                            <exportAntProperties>true</exportAntProperties>
400                            <target>
401                                <property environment="env"/>
402                                <condition property="cmake.toolset" value="-T${env.AWS_CMAKE_TOOLSET}" else="-DTOOLSET_DUMMY=1">
403                                    <isset property="env.AWS_CMAKE_TOOLSET" />
404                                </condition>
405                                <echo message="Toolset = ${cmake.toolset}"/>
406                            </target>
407                        </configuration>
408                    </execution>
409                </executions>
410            </plugin>
411            <!-- unit test configuration -->
412            <plugin>
413                <groupId>org.apache.maven.plugins</groupId>
414                <artifactId>maven-surefire-plugin</artifactId>
415                <version>2.21.0</version>
416                <configuration>
417                    <systemPropertyVariables>
418                        <crt.classifier>${crt.classifier}</crt.classifier>
419                        <certificate>${crt.test.certificate}</certificate>
420                        <privatekey>${crt.test.privatekey}</privatekey>
421                        <ecc_certificate>${crt.test.ecc_certificate}</ecc_certificate>
422                        <ecc_privatekey>${crt.test.ecc_privatekey}</ecc_privatekey>
423                        <endpoint>${crt.test.endpoint}</endpoint>
424                        <rootca>${crt.test.rootca}</rootca>
425                        <privatekey_p8>${crt.test.privatekey_p8}</privatekey_p8>
426                    </systemPropertyVariables>
427                    <properties>
428                        <property>
429                            <name>listener</name>
430                            <value>software.amazon.awssdk.crt.test.FailFastListener</value>
431                        </property>
432                    </properties>
433                    <shutdown>kill</shutdown>
434                    <argLine>-Daws.crt.memory.tracing=2 -Xcheck:jni</argLine>
435                    <runOrder>alphabetical</runOrder>
436                    <useFile>false</useFile>
437                    <reuseForks>false</reuseForks>
438                    <forkCount>0</forkCount>
439                </configuration>
440            </plugin>
441        </plugins>
442    </build>
443</project>
444