<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright (c) 2014, 2019 Ericsson

   All rights reserved. This program and the accompanying materials
   are made available under the terms of the Eclipse Public License 2.0
   which accompanies this distribution, and is available at
   https://www.eclipse.org/legal/epl-2.0/

   SPDX-License-Identifier: EPL-2.0
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <artifactId>org.eclipse.tracecompass.releng-parent</artifactId>
    <groupId>org.eclipse.tracecompass</groupId>
    <version>7.0.0-SNAPSHOT</version>
  </parent>

  <artifactId>org.eclipse.tracecompass.alltests</artifactId>
  <version>1.0.11-SNAPSHOT</version>
  <packaging>eclipse-test-plugin</packaging>

  <name>Trace Compass All Tests</name>

  <properties>
    <perf.database.loc>//127.0.0.1</perf.database.loc>
    <perf.config>build=20140707-1632;host=myhost;config=linux;jvm=1.7</perf.config>
    <perfFilesDestination>target</perfFilesDestination>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-surefire-plugin</artifactId>
        <configuration>
          <!-- Default build will not find any tests, but the profiles below
               can define some. -->
          <useUIHarness>false</useUIHarness>
          <useUIThread>false</useUIThread>
          <failIfNoTests>false</failIfNoTests>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <!-- Profile to run a test suite present in this plugin, defined by
         putting -DcustomTestSuite=<name> on the command line. -->
    <profile>
      <id>run-custom-test-suite</id>
      <properties>
        <tracecompass.extra.args></tracecompass.extra.args>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <version>${tycho-version}</version>
            <configuration>
              <includes>
                <include>**/${customTestSuite}.java</include>
              </includes>
              <useUIHarness>true</useUIHarness>
              <useUIThread>false</useUIThread>
              <argLine>${tycho.testArgLine} ${base.ui.test.vmargs} ${tracecompass.extra.args}</argLine>
              <product>org.eclipse.platform.ide</product>
              <environmentVariables>
                <SWT_GTK3>${SWT_GTK3}</SWT_GTK3>
                <LIBOVERLAY_SCROLLBAR>0</LIBOVERLAY_SCROLLBAR>
              </environmentVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Profile to run the performance tests -->
    <profile>
      <id>performance</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <version>${tycho-version}</version>
            <configuration>
              <argLine>-Declipse.perf.dbloc=${perf.database.loc} -Declipse.perf.config=${perf.config}</argLine>
              <runOrder>reversealphabetical</runOrder>
              <includes>
                  <include>**/RunAllPerfTests.java</include>
                  <include>**/PerfResultsToJSon.java</include>
              </includes>
              <useUIHarness>false</useUIHarness>
              <useUIThread>false</useUIThread>
              <product>org.eclipse.platform.ide</product>
            </configuration>
          </plugin>
          <plugin>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>deploy-performance-files</id>
                <phase>install</phase>
                  <goals>
                    <goal>run</goal>
                  </goals>
                  <configuration>
                  <target>
                    <copy includeemptydirs="false"
                      todir="${perfFilesDestination}">
                      <fileset dir=".">
                        <include name="*.json" />
                        <include name="*.js" />
                      </fileset>
                    </copy>
                  </target>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <!-- We don't use the ant file to clean because of http://jira.codehaus.org/browse/MANTRUN-78 -->
          <plugin>
            <artifactId>maven-clean-plugin</artifactId>
            <executions>
              <execution>
                <id>clean-performance-files</id>
                <phase>clean</phase>
                <configuration>
                  <filesets>
                    <fileset>
                      <directory>.</directory>
                      <includes>
                        <include>*.json</include>
                        <include>*.js</include>
                      </includes>
                    </fileset>
                  </filesets>
                </configuration>
                <goals>
                  <goal>clean</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
   </profile>
 </profiles>


</project>
