<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2016-2022 Hedera Hashgraph, LLC
  ~
  ~ This software is the confidential and proprietary information of
  ~ Hedera Hashgraph, LLC. ("Confidential Information"). You shall not
  ~ disclose such Confidential Information and shall use it only in
  ~ accordance with the terms of the license agreement you entered into
  ~ with Hedera Hashgraph.
  ~
  ~ HEDERA HASHGRAPH MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
  ~ THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
  ~ TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
  ~ PARTICULAR PURPOSE, OR NON-INFRINGEMENT. HEDERA HASHGRAPH SHALL NOT BE LIABLE FOR
  ~ ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
  ~ DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
  -->

<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">

	<!-- Required Maven Version -->
	<modelVersion>4.0.0</modelVersion>

	<!-- Parent Configuration -->
	<parent>
		<groupId>com.swirlds</groupId>
		<artifactId>swirlds-platform</artifactId>
		<version>0.25.0</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<!-- Project Configuration -->
	<artifactId>swirlds-virtualmap</artifactId>
	<packaging>jar</packaging>

	<!-- Project Properties -->
	<properties>
		<!-- Maven and Java Configuration -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>

		<!--var app.repo is supplied by inheritors. mvn has dynamic var binding not lexical.-->
		<app.repo>${project.baseUri}../sdk/data/repos/app/</app.repo>
		<sonar.coverage.jacoco.xmlReportPaths>${sonar.jacoco.path},${sonar.jacoco.alt.path}
		</sonar.coverage.jacoco.xmlReportPaths>
	</properties>

	<!-- Dependencies -->
	<dependencies>
		<!-- Swirlds -->
		<dependency>
			<groupId>com.swirlds</groupId>
			<artifactId>swirlds-common</artifactId>
			<version>0.25.0</version>
		</dependency>

		<!-- Log4j -->
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
		</dependency>

		<!-- JUnit 5.x -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-params</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>com.swirlds</groupId>
			<artifactId>swirlds-common-test</artifactId>
			<version>0.25.0</version>
			<scope>test</scope>
		</dependency>

		<!-- REMOVE BEFORE MERGING INTO DEVELOP -->
		<dependency>
			<groupId>org.mockito</groupId>
			<artifactId>mockito-core</artifactId>
			<scope>test</scope>
		</dependency>

	</dependencies>

	<!-- Profiles -->
	<profiles>
		<!-- Automatic Profile (not for manual use) -->
		<!--
		We support the use of the environment variable MAVEN_OPTS to allow extra JVM & Maven options to be passed
		through to unit tests. This profile is to handle cases where the MAVEN_OPTS environment variable is not set or
		undefined by creating an empty environment variable. The profile below should not be modified and needs to
		remain here in the parent POM file. Also, this profile should be copied to all other POM files that use
		the MAVEN_OPTS environment variable in their Surefire plugin definitions. Failing to include this profile when
		launching surefire tests where the MAVEN_OPTS is undefined will result in erroneous error messages.

		CircleCI depends on the MAVEN_OPTS environment variable in order to specify the appropriate amount of
		maximum memory a maven process (including surefire) may consume. CircleCI passes an appropriate
		JVM switch (-Xmx) via the MAVEN_OPTS variable to enforce the correct memory limits.

		Additionally, the MAVEN_OPTS variable allows developers to pass custom JVM arguments when launching unit tests by
		specifying them using the maven -D switch. See the following examples:

			mvn -DMAVEN_OPTS=-Xmx8g test
			mvn -DMAVEN_OPTS="-Xmx8g -Xms8g" test
			mvn -DMAVEN_OPTS="-Xmx8g -XX:+UnlockExperimentalVMOptions -XX:+UseZGC" test

		This comment should be copied along with this profile to every POM file that uses the MAVEN_OPTS variable.
		-->
		<profile>
			<id>maven_opts_defaults</id>
			<activation>
				<property>
					<name>!env.MAVEN_OPTS</name>
				</property>
			</activation>
			<properties>
				<env.MAVEN_OPTS/>
			</properties>
		</profile>
	</profiles>

	<!-- $$BEGIN_OPEN_REVIEW_REMOVE_1$$ -->
	<!-- Build Configuration -->
	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<argLine>@{argLine} ${env.MAVEN_OPTS}
						--add-opens com.swirlds.virtualmap/com.swirlds.virtualmap=ALL-UNNAMED
						--add-opens com.swirlds.virtualmap/com.swirlds.virtualmap.cache=ALL-UNNAMED
					</argLine>
					<failIfNoTests>true</failIfNoTests>
					<forkCount>1</forkCount>
					<reuseForks>true</reuseForks>
					<useSystemClassLoader>true</useSystemClassLoader>
					<excludes>
						<exclude>**/VirtualHasherHugeTest.java</exclude>
						<exclude>**/LargeReconnectTest.java</exclude>
					</excludes>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>
