<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">
	
	<!-- ================= PROJECT INFORMATION ================== -->
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.performetriks</groupId>
	<artifactId>performator</artifactId>
	<version>1.2.3</version>
	
	<name>Performator</name>
	<description>A lightweight and powerful performance testing framework that can execute anything you can write in java!</description>
	<url>https://github.com/Performetriks/Performator</url>

	<!-- ================= PROPERTIES ================== -->
	<properties>
		
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<otel.version>1.49.0</otel.version>
		
		<folderName>performator-agent</folderName> <!-- making folder without version name, as antrun can't handle regex with folders -->
		<binariesFolder>${basedir}/target/${folderName}</binariesFolder>
		
		<skipJavadoc>false</skipJavadoc>
		<skipTests>true</skipTests>
		<skipSigning>false</skipSigning>
	</properties>
	
		<!-- ================= LICENSES ================== -->
	<licenses>
		<license>
			<name>Eclipse Public License - v 2.0</name>
			<url>https://github.com/Performetriks/Performator/blob/main/LICENSE</url>
		</license>
	</licenses>

	<!-- ================= DEVELOPERS ================== -->
	<developers>
		<developer>
			<name>Reto Scheiwiller</name>
			<email>reto.scheiwiller@performatriks.com</email>
			<organization>Performetriks</organization>
			<organizationUrl>http://www.performetriks.com</organizationUrl>
		</developer>
	</developers>

	<!-- ================= SCM ================== -->
	<scm>
		<connection>scm:git:git://github.com/Performetriks/Performator.git</connection>
		<developerConnection>scm:git:ssh://github.com/Performetriks/Performator.git</developerConnection>
		<url>https://github.com/Performetriks/Performator/tree/main</url>
	</scm>

	<!-- ================= DEPENDENCIES ================== -->
	<dependencies>
			
		<!-- https://mvnrepository.com/artifact/com.xresch/hsr -->
		<dependency>
		    <groupId>com.xresch</groupId>
		    <artifactId>hsr</artifactId>
		    <version>1.4.8.16.32</version>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
		<dependency>
			<groupId>org.postgresql</groupId>
			<artifactId>postgresql</artifactId>
			<version>42.7.8</version>
			<scope>provided</scope>
		</dependency>
		
		<!-- ========================================================================== -->
		<!-- ============================ SCOPE: TESTING ============================== -->
		<!-- ========================================================================== -->
		
		<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-launcher -->
		<dependency>
		    <groupId>org.junit.platform</groupId>
		    <artifactId>junit-platform-launcher</artifactId>
		    <version>1.8.2</version>
		    <scope>provided</scope>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-api -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<version>5.7.2</version>
			<scope>provided</scope>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.junit.jupiter/junit-jupiter-engine -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-engine</artifactId>
			<version>5.7.2</version>
			<scope>provided</scope>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-commons -->
		<dependency>
		    <groupId>org.junit.platform</groupId>
		    <artifactId>junit-platform-commons</artifactId>
		    <version>1.8.2</version>
		    <scope>provided</scope>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-api -->
		<dependency>
		    <groupId>org.junit.platform</groupId>
		    <artifactId>junit-platform-suite-api</artifactId>
		    <version>1.8.2</version>
		    <scope>provided</scope>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-engine -->
		<dependency>
		    <groupId>org.junit.platform</groupId>
		    <artifactId>junit-platform-suite-engine</artifactId>
		    <version>1.8.2</version>
		    <scope>provided</scope>
		</dependency>

		<!-- https://mvnrepository.com/artifact/org.junit.platform/junit-platform-suite-commons -->
		<!-- dependency>
		    <groupId>org.junit.platform</groupId>
		    <artifactId>junit-platform-suite-commons</artifactId>
		    <version>1.8.2</version>
		    <scope>runtime</scope>
		</dependency -->
		
		 <!--dependency>
	      <groupId>com.microsoft.playwright</groupId>
	      <artifactId>playwright</artifactId>
	      <version>1.38.0</version>
	    </dependency-->
    
		<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
		<!--dependency>
		    <groupId>org.seleniumhq.selenium</groupId>
		    <artifactId>selenium-java</artifactId>
		    <version>4.1.2</version>
		    <scope>provided</scope>
		</dependency-->
	</dependencies>


	<!-- ================= BUILD ================== -->
	<build>
		
			
		<!-- ================= RESOURCES ================== -->
		<resources>
			<resource>
				<directory>src/main/java</directory>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
			</resource>
		</resources>
		
		<!-- ================= TEST RESOURCES ================== -->
		<testResources>
			<testResource>
				<directory>src/test/java</directory>
				<excludes>
					<exclude>**/*.java</exclude>
				</excludes>
			</testResource>
		</testResources>

		<plugins>
						
			<!-- ================= SUREFIRE ================== -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.5.4</version>
				<configuration>
					<skipTests>${skipTests}</skipTests>
					<includes>
						<include>**/*TestSuiteAll.java</include>
					</includes>
					<!-- excludes> <exclude>com.xresch.cfw.tests._master.*</exclude> </excludes -->
				</configuration>
			</plugin>
			
			<!-- ================= SHADE ================== -->
		    <plugin>
              <groupId>org.apache.maven.plugins</groupId>
              <artifactId>maven-shade-plugin</artifactId>
              <version>3.1.1</version>
              <configuration>
            	<finalName>performator-agent-${project.version}</finalName>
                <filters>
                  <!-- https://stackoverflow.com/a/6743609 -->
                  <filter>
                    <artifact>*:*</artifact>
                    <excludes>
                      <exclude>META-INF/*.DSA</exclude>
                      <exclude>META-INF/*.SF</exclude>
                      <exclude>META-INF/*.RSA</exclude>
                    </excludes>
                  </filter>
                </filters>
              </configuration>
              <executions>
                <execution>
                  <phase>package</phase>
                  <goals>
                    <goal>shade</goal>
                  </goals>
                  <configuration>
                    <transformers>
                      <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <manifestEntries>
		                    <Main-Class>com.performetriks.performator.base.Main</Main-Class>
                  		</manifestEntries>
                      </transformer>
                    </transformers>
                  </configuration>
                </execution>
              </executions>
            </plugin>
            
			
			<!-- ================= EXEC ================== -->
			<plugin>
		        <groupId>org.codehaus.mojo</groupId>
		        <artifactId>exec-maven-plugin</artifactId>
		        <version>3.6.2</version>
		        <executions>
		          <execution>
					<phase>verify</phase>
		            <goals>
		              <goal>java</goal>
		            </goals>
		          </execution>
		        </executions>
		        <configuration>
		          <mainClass>com.performetriks.performator.base.Main</mainClass>
					<!--arguments>
		            <argument>argument1</argument>
		          </arguments-->
		          <systemProperties>
		            <projectProperties /> <!-- automatically propagate all -D argument values -->
		          </systemProperties>
		        </configuration>
		    </plugin>

			<!-- ================= COMPILER ================== -->
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<source>17</source>
					<target>17</target>
				</configuration>
			</plugin>

			<!-- ================= INSTALL ================== -->
			<plugin>
			  <artifactId>maven-install-plugin</artifactId>
			  <version>2.3.1</version>
			  <configuration>
			    <createChecksum>true</createChecksum>
			  </configuration>
			</plugin>

			<!-- ================= SOURCES ================== -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-source-plugin</artifactId>
				<version>3.3.0</version>
				<executions>
					<execution>
						<id>attach-sources</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- ================= JAVADOC ================== -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<version>3.5.0</version>
				<executions>
					<execution>
						<id>attach-javadocs</id>
						<goals>
							<goal>jar</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<skip>${skipJavadoc}</skip>
					<additionalparam>-Xdoclint:none</additionalparam>
					<additionalOptions>-Xdoclint:none</additionalOptions>
					<additionalJOption>-Xdoclint:none</additionalJOption>
				</configuration>
			</plugin>

			<!-- ================= GPG SIGN ================== -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-gpg-plugin</artifactId>
				<version>1.6</version>
				<executions>
					<execution>
						<id>sign-artifacts</id>
						<phase>verify</phase>
						<goals>
							<goal>sign</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<skip>${skipSigning}</skip>
					<gpgArguments>
						<arg>--pinentry-mode</arg>
						<arg>loopback</arg>
						<arg>--status-fd</arg>
						<arg>--yes</arg>
						<arg>--always-trust</arg>

					</gpgArguments>
				</configuration>
			</plugin>
			
			<!-- ================= ANTRUN: Create Server Folder ================== -->
			<plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <phase>install</phase>           
                        <configuration>
                        	<skip>${skipMakeFolder}</skip>
						    <target>
						        <mkdir dir="${binariesFolder}" />
						        
						        <!-- ##### Copy Agent JAR ##### -->
						        <copy todir="${binariesFolder}" file="${basedir}/target/performator-agent-${project.version}.jar"></copy>
						        
						        <!-- ##### Copy Scripts ##### -->
						        <copy todir="${binariesFolder}">
						            <fileset dir="${basedir}/scripts/agent" includes="start.sh" />
						            <fileset dir="${basedir}/scripts/agent" includes="start.bat" />
						        </copy>
						        
						        <!-- ##### Copy License ##### -->
						        <copy file="${basedir}/LICENSE" tofile="${binariesFolder}/LICENSE"></copy>
						        
						        
						        <!-- ##### Create Zip file with Version ##### -->
						        <zip destfile="${basedir}/target/performator-agent-${project.version}.zip" basedir="${binariesFolder}"/>
						        
						    </target>
						</configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
			
		</plugins>

	</build>
</project>