<?xml version="1.0" encoding="UTF-8"?>
<!--
   Copyright (c) 2011, 2020 Red Hat, Inc. and others

   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 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <prerequisites>
    <maven>${required-maven-version}</maven>
  </prerequisites>

  <groupId>org.eclipse.tracecompass</groupId>
  <artifactId>org.eclipse.tracecompass</artifactId>
  <version>7.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>
  <name>Trace Compass Parent</name>

  <licenses>
    <license>
      <name>Eclipse Public License 2.0</name>
      <comments>
        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
      </comments>
    </license>
  </licenses>

  <properties>
    <required-maven-version>3.6.3</required-maven-version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    <testArgLine></testArgLine>

    <jdk.version>11</jdk.version>
    <jdk.release>11</jdk.release>

    <skip-tc-core-tests>false</skip-tc-core-tests>
    <skip-short-tc-ui-tests>false</skip-short-tc-ui-tests>
    <skip-long-tc-ui-tests>false</skip-long-tc-ui-tests>

    <tycho-version>2.3.0</tycho-version>
    <tycho-extras-version>2.3.0</tycho-extras-version>
    <tycho.scmUrl>scm:git:git://git.eclipse.org/gitroot/tracecompass/org.eclipse.tracecompass.git</tycho.scmUrl>
    <cbi-plugins.version>1.3.1</cbi-plugins.version>
    <target-platform>tracecompass-e4.20</target-platform>
    <help-docs-eclipserun-repo>http://download.eclipse.org/eclipse/updates/4.8</help-docs-eclipserun-repo>

    <rcptt-version>2.2.0</rcptt-version>
    <!-- Disable GTK3 because it's not quite usable yet and it can make the tests hang (bug in IcedTea http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=1736) -->
    <SWT_GTK3>0</SWT_GTK3>

    <!-- Sonar rule configuration -->
    <sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
    <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
    <sonar.java.source>${jdk.version}</sonar.java.source>
    <sonar.exclusions>**/tests/**,**/test/**,**/stubs/**,**/Messages*,**/alltests/**,**/ITmfEventField.java</sonar.exclusions>
    <sonar.skippedModules>org.eclipse.tracecompass.ctf.parser,org.eclipse.tracecompass.examples</sonar.skippedModules>
    <jacoco.destFile>${project.basedir}/../../target/jacoco.exec</jacoco.destFile>
    <sonar.jacoco.reportPath>${jacoco.destFile}</sonar.jacoco.reportPath>
    <sonar.coverage.jacoco.xmlReportPaths>${project.reporting.outputDirectory}/jacoco/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
    <sonar.issue.ignore.multicriteria>e1,e2,e3,e4,e5,e6,e7,e8</sonar.issue.ignore.multicriteria>
    <sonar.issue.ignore.multicriteria.e1.ruleKey>findbugs:NP_STORE_INTO_NONNULL_FIELD</sonar.issue.ignore.multicriteria.e1.ruleKey>
    <sonar.issue.ignore.multicriteria.e1.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e1.resourceKey>
    <sonar.issue.ignore.multicriteria.e2.ruleKey>findbugs:RCN_REDUNDANT_NULLCHECK_OF_NONNULL_VALUE</sonar.issue.ignore.multicriteria.e2.ruleKey>
    <sonar.issue.ignore.multicriteria.e2.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e2.resourceKey>
    <sonar.issue.ignore.multicriteria.e3.ruleKey>findbugs:NP_NONNULL_PARAM_VIOLATION</sonar.issue.ignore.multicriteria.e3.ruleKey>
    <sonar.issue.ignore.multicriteria.e3.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e3.resourceKey>
    <sonar.issue.ignore.multicriteria.e4.ruleKey>findbugs:NP_NULL_PARAM_DEREF_NONVIRTUAL</sonar.issue.ignore.multicriteria.e4.ruleKey>
    <sonar.issue.ignore.multicriteria.e4.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e4.resourceKey>
    <sonar.issue.ignore.multicriteria.e5.ruleKey>findbugs:NP_NONNULL_RETURN_VIOLATION</sonar.issue.ignore.multicriteria.e5.ruleKey>
    <sonar.issue.ignore.multicriteria.e5.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e5.resourceKey>
    <sonar.issue.ignore.multicriteria.e6.ruleKey>findbugs:NP_NONNULL_FIELD_NOT_INITIALIZED_IN_CONSTRUCTOR</sonar.issue.ignore.multicriteria.e6.ruleKey>
    <sonar.issue.ignore.multicriteria.e6.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e6.resourceKey>
    <sonar.issue.ignore.multicriteria.e7.ruleKey>findbugs:NP_NULL_PARAM_DEREF</sonar.issue.ignore.multicriteria.e7.ruleKey>
    <sonar.issue.ignore.multicriteria.e7.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e7.resourceKey>
    <sonar.issue.ignore.multicriteria.e8.ruleKey>findbugs:RCN_REDUNDANT_NULLCHECK_WOULD_HAVE_BEEN_A_NPE</sonar.issue.ignore.multicriteria.e8.ruleKey>
    <sonar.issue.ignore.multicriteria.e8.resourceKey>**/*.java</sonar.issue.ignore.multicriteria.e8.resourceKey>
  </properties>

  <pluginRepositories>
    <pluginRepository>
      <id>repo.eclipse.org</id>
      <url>https://repo.eclipse.org/content/groups/releases/</url>
    </pluginRepository>
    <pluginRepository>
      <id>tycho-snapshots</id>
      <url>https://repo.eclipse.org/content/repositories/tycho-snapshots/</url>
    </pluginRepository>
    <pluginRepository>
      <id>jboss-public-repository-group</id>
      <name>JBoss Public Repository Group</name>
      <url>http://repository.jboss.org/nexus/content/groups/public/</url>
    </pluginRepository>
    <pluginRepository>
      <id>rcptt-snapshots</id>
      <name>RCPTT Maven Snapshots repository</name>
      <url>https://repo.eclipse.org/content/repositories/rcptt-snapshots/</url>
    </pluginRepository>
    <pluginRepository>
      <id>rcptt-releases</id>
      <name>RCPTT Maven repository</name>
      <url>https://repo.eclipse.org/content/repositories/rcptt-releases/</url>
    </pluginRepository>
  </pluginRepositories>

  <profiles>
    <!-- Manually-set profile to sign the generated update sites -->
    <profile>
      <id>sign-update-site</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-pack200a-plugin</artifactId>
            <version>${tycho-extras-version}</version>
            <executions>
              <execution>
                <id>pack200-normalize</id>
                <goals>
                  <goal>normalize</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.eclipse.cbi.maven.plugins</groupId>
            <artifactId>eclipse-jarsigner-plugin</artifactId>
            <version>${cbi-plugins.version}</version>
            <executions>
              <execution>
                <id>sign</id>
                <phase>package</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>

          <plugin>
            <groupId>org.eclipse.tycho.extras</groupId>
            <artifactId>tycho-pack200b-plugin</artifactId>
            <version>${tycho-extras-version}</version>
            <executions>
              <execution>
                <id>pack200-pack</id>
                <goals>
                  <goal>pack</goal>
                </goals>
                <phase>package</phase>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>use-jacoco</id>
      <activation>
        <property>
          <name>!skip-jacoco</name>
        </property>
      </activation>
      <properties>
        <testArgLine>${tycho.testArgLine}</testArgLine>
      </properties>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <version>0.8.4</version>
            <executions>
              <execution>
                <id>pre-test</id>
                <goals>
                  <goal>prepare-agent</goal>
                </goals>
                <configuration>
                  <!-- Where to put jacoco coverage report -->
                  <destFile>${jacoco.destFile}</destFile>
                  <includes>
                    <include>org.eclipse.tracecompass.*</include>
                  </includes>
                  <append>true</append>
                </configuration>
              </execution>
              <execution>
                <id>jacoco-report</id>
                <phase>verify</phase>
                <goals>
                  <goal>report</goal>
                  <goal>report-aggregate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Automatic profile for Mac-specific settings -->
    <profile>
      <id>macosx</id>
      <activation>
        <os>
          <family>mac</family>
        </os>
      </activation>
      <properties>
        <base.ui.test.vmargs>-XstartOnFirstThread -Dorg.eclipse.swt.internal.carbon.smallFonts -Djava.awt.headless=false</base.ui.test.vmargs>
      </properties>
    </profile>

    <!-- Automatic profile for non-Mac platforms settings -->
    <profile>
      <id>not-macosx</id>
      <activation>
        <os>
          <family>!mac</family>
        </os>
      </activation>
      <properties>
        <!-- Disable webkit integration, especially unstable on Linux -->
        <base.ui.test.vmargs>-Dorg.eclipse.swt.browser.DefaultType=mozilla</base.ui.test.vmargs>
      </properties>
    </profile>

    <!-- Automatic profile to define the settings for UI test plugins -->
    <profile>
      <id>ui-test-plugin</id>
      <activation>
        <file>
          <exists>ui-test-plugin.properties</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <configuration>
              <useUIHarness>true</useUIHarness>
              <useUIThread>true</useUIThread>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Automatic profile to define the settings for SWTBot test plugins -->
    <profile>
      <id>swtbot-test-plugin</id>
      <activation>
        <file>
          <exists>swtbot-test-plugin.properties</exists>
        </file>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.eclipse.tycho</groupId>
            <artifactId>tycho-surefire-plugin</artifactId>
            <configuration>
              <useUIHarness>true</useUIHarness>
              <useUIThread>false</useUIThread>
              <environmentVariables>
                <SWT_GTK3>${SWT_GTK3}</SWT_GTK3>
                <LIBOVERLAY_SCROLLBAR>0</LIBOVERLAY_SCROLLBAR>
              </environmentVariables>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>

    <!-- Automatic profile to skip sonar -->
    <profile>
      <id>skip-sonar</id>
      <activation>
        <file>
          <exists>sonar.skip.properties</exists>
        </file>
      </activation>
      <properties>
        <sonar.skip>true</sonar.skip>
      </properties>
    </profile>
  </profiles>

  <modules>
    <module>analysis</module>
    <module>btf</module>
    <module>common</module>
    <module>ctf</module>
    <module>doc</module>
    <module>gdbtrace</module>
    <module>lttng</module>
    <module>pcap</module>
    <module>rcp</module>
    <module>releng</module>
    <module>statesystem</module>
    <module>tmf</module>
    <module>jsontrace</module>
  </modules>

  <build>
    <plugins>
      <plugin>
        <inherited>true</inherited>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-enforcer-plugin</artifactId>
        <version>3.0.0-M3</version>
        <executions>
          <execution>
            <id>enforce-maven-version</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <configuration>
              <rules>
                <requireMavenVersion>
                  <version>${required-maven-version}</version>
                </requireMavenVersion>
                <requireJavaVersion>
                  <version>${jdk.version}</version>
                </requireJavaVersion>
              </rules>
              <fail>true</fail>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>target-platform-configuration</artifactId>
        <configuration>
          <executionEnvironment>JavaSE-${jdk.version}</executionEnvironment>
          <includePackedArtifacts>true</includePackedArtifacts>
          <environments>
            <environment>
                <os>win32</os>
                <ws>win32</ws>
                <arch>x86_64</arch>
            </environment>
            <environment>
                <os>macosx</os>
                <ws>cocoa</ws>
                <arch>x86_64</arch>
            </environment>
            <environment>
                <os>linux</os>
                <ws>gtk</ws>
                <arch>x86_64</arch>
            </environment>
          </environments>
          <target>
            <artifact>
              <groupId>org.eclipse.tracecompass</groupId>
              <artifactId>org.eclipse.tracecompass.target</artifactId>
              <classifier>${target-platform}</classifier>
              <version>7.0.0-SNAPSHOT</version>
            </artifact>
          </target>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-maven-plugin</artifactId>
        <version>${tycho-version}</version>
        <extensions>true</extensions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-source-plugin</artifactId>
        <version>${tycho-version}</version>
        <executions>
          <execution>
            <id>plugin-source</id>
            <goals>
              <goal>plugin-source</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-source-feature-plugin</artifactId>
        <version>${tycho-extras-version}</version>
        <configuration>
          <includeBinaryFeature>false</includeBinaryFeature>
        </configuration>
        <executions>
          <execution>
            <id>source-feature</id>
            <phase>package</phase>
            <goals>
              <goal>source-feature</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho.extras</groupId>
        <artifactId>tycho-pack200b-plugin</artifactId>
        <version>${tycho-extras-version}</version>
        <executions>
          <execution>
            <id>pack200-pack</id>
            <goals>
              <goal>pack</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.eclipse.tycho</groupId>
        <artifactId>tycho-p2-plugin</artifactId>
        <executions>
          <execution>
            <id>p2-metadata</id>
            <goals>
              <goal>p2-metadata</goal>
            </goals>
            <phase>package</phase>
          </execution>
        </executions>
        <configuration>
          <defaultP2Metadata>false</defaultP2Metadata>
        </configuration>
      </plugin>
    </plugins>

    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-compiler-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <source>${jdk.version}</source>
            <target>${jdk.version}</target>
            <release>${jdk.release}</release>
            <encoding>UTF-8</encoding>
            <compilerArguments>
              <annotationpath>common/org.eclipse.tracecompass.common.core/annotations</annotationpath>
            </compilerArguments>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>target-platform-configuration</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-publisher-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-p2-repository-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <skipArchive>true</skipArchive>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-surefire-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <!-- Default configuration, UI tests may have to override these -->
            <excludes>**/*Tests.java,**/*$*</excludes>
            <useUIHarness>false</useUIHarness>
            <useUIThread>false</useUIThread>
            <dependencies>
               <dependency>
                 <type>p2-installable-unit</type>
                 <artifactId>org.eclipse.platform.feature.group</artifactId>
                 <version>${sdk-version}</version>
               </dependency>
            </dependencies>
            <product>org.eclipse.platform.ide</product>
            <argLine>${testArgLine} ${base.ui.test.vmargs} -Xms512m -Xmx1024m</argLine>
            <appArgLine>-consoleLog</appArgLine>
            <trimStackTrace>false</trimStackTrace>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-versions-plugin</artifactId>
          <version>${tycho-version}</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho</groupId>
          <artifactId>tycho-packaging-plugin</artifactId>
          <version>${tycho-version}</version>
          <configuration>
            <sourceReferences>
              <generate>true</generate>
            </sourceReferences>
          </configuration>
          <dependencies>
            <dependency>
              <groupId>org.eclipse.tycho.extras</groupId>
              <artifactId>tycho-sourceref-jgit</artifactId>
              <version>${tycho-extras-version}</version>
            </dependency>
          </dependencies>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-toolchains-plugin</artifactId>
          <executions>
            <execution>
              <goals>
                <goal>toolchain</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <toolchains>
              <jdk>
                <version>${jdk.version}</version>
              </jdk>
            </toolchains>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-resources-plugin</artifactId>
          <version>3.0.2</version>
          <configuration>
            <encoding>UTF-8</encoding>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-antrun-plugin</artifactId>
          <version>1.8</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-dependency-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.rcptt</groupId>
          <artifactId>rcptt-maven-plugin</artifactId>
          <version>${rcptt-version}</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-site-plugin</artifactId>
          <version>3.6</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-clean-plugin</artifactId>
          <version>3.0.0</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-deploy-plugin</artifactId>
          <version>2.8.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-install-plugin</artifactId>
          <version>2.5.2</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-project-info-reports-plugin</artifactId>
          <version>2.9</version>
        </plugin>

        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-javadoc-plugin</artifactId>
          <version>3.1.0</version>
          <configuration>
            <groups>
              <group>
                <title>Backend</title>
                <packages>org.eclipse.tracecompass.statesystem.*:org.eclipse.tracecompass.segmentstore.*:org.eclipse.tracecompass.datastore.*</packages>
               </group>
            </groups>
            <excludePackageNames>org.eclipse.tracecompass.internal.*:*.test*:*.alltests*:*.examples*:*.btf.*:*.lttng2.*:*.remote.*:*.rcp.*</excludePackageNames>
            <doclint>none</doclint>
          </configuration>
        </plugin>

        <plugin>
          <groupId>org.jboss.tools.tycho-plugins</groupId>
          <artifactId>repository-utils</artifactId>
          <version>1.7.0</version>
        </plugin>

        <plugin>
          <groupId>org.sonarsource.scanner.maven</groupId>
          <artifactId>sonar-maven-plugin</artifactId>
          <version>3.2</version>
        </plugin>

        <plugin>
          <groupId>org.eclipse.tycho.extras</groupId>
          <artifactId>tycho-eclipserun-plugin</artifactId>
          <version>${tycho-extras-version}</version>
          <configuration>
            <dependencies>
              <dependency>
                <artifactId>org.apache.ant</artifactId>
                <type>eclipse-plugin</type>
              </dependency>
              <dependency>
                <artifactId>org.eclipse.help.base</artifactId>
                <type>eclipse-plugin</type>
              </dependency>
              <dependency>
                <artifactId>org.eclipse.ant.core</artifactId>
                <type>eclipse-plugin</type>
              </dependency>
            </dependencies>
            <!-- This needs to be explicitly set now, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=395281 -->
            <repositories>
              <repository>
                <id>platform</id>
                <layout>p2</layout>
                <url>${help-docs-eclipserun-repo}</url>
              </repository>
            </repositories>
            <executionEnvironment>JavaSE-${jdk.version}</executionEnvironment>
          </configuration>
          <executions>
            <execution>
              <goals>
                <goal>eclipse-run</goal>
              </goals>
              <phase>compile</phase>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

</project>
