<?xml version="1.0" encoding="UTF-8"?>
<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">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.sonarsource.sonarqube</groupId>
    <artifactId>sonarqube</artifactId>
    <version>5.6.5</version>
  </parent>

  <artifactId>sonar-plugin-api</artifactId>
  <packaging>jar</packaging>

  <name>SonarQube :: Plugin API</name>

  <properties>
    <sonar.clirr.reportPath>${project.build.directory}/clirr-report.txt</sonar.clirr.reportPath>
  </properties>

  <dependencies>

    <!--
    The following artifacts are shaded and relocated in an internal package.
    They are not visible by plugins
    -->
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-codec</groupId>
      <artifactId>commons-codec</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-lang</groupId>
      <artifactId>commons-lang</artifactId>
    </dependency>

    <!--
    The following artifacts are shaded but not relocated. They
    are provided at runtime, so plugins can use them but
    can not change their version.
    Long-term target is to remove them from API. They should be
    embedded by plugins.
    -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-check-api</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-colorizer</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-duplications</artifactId>
      <exclusions>
        <exclusion>
          <groupId>org.slf4j</groupId>
          <artifactId>slf4j-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <!-- to be kept for backward-compatibility of org.sonar.api.design.Dependency -->
      <groupId>org.codehaus.sonar</groupId>
      <artifactId>sonar-graph</artifactId>
    </dependency>


    <!--
      Transitive dependencies available at runtime. They are not shaded with API
      as they are not managed by SonarSource. Versions should not be
      overridden by plugins though.
    -->
    <dependency>
      <groupId>org.codehaus.woodstox</groupId>
      <artifactId>woodstox-core-lgpl</artifactId>
      <exclusions>
        <exclusion>
          <groupId>stax</groupId>
          <artifactId>stax-api</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.codehaus.woodstox</groupId>
      <artifactId>stax2-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.staxmate</groupId>
      <artifactId>staxmate</artifactId>
    </dependency>

    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <optional>true</optional>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>xpp3</groupId>
      <artifactId>xpp3</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <version>3.0.1</version>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-classic</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>ch.qos.logback</groupId>
      <artifactId>logback-core</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <!-- unit tests -->
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>sonar-testing-harness</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>xmlunit</groupId>
      <artifactId>xmlunit</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.dbunit</groupId>
      <artifactId>dbunit</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <!-- can't minimize dependencies because of some classes of sonar-duplications
              that required by sonar-batch -->
              <minimizeJar>false</minimizeJar>
              <createDependencyReducedPom>true</createDependencyReducedPom>
              <artifactSet>
                <excludes>
                  <exclude>org.codehaus.woodstox:woodstox-core-lgpl</exclude>
                  <exclude>org.codehaus.woodstox:stax2-api</exclude>
                  <exclude>org.codehaus.staxmate:staxmate</exclude>
                </excludes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google</pattern>
                  <shadedPattern>org.sonar.api.internal.google</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.apache.commons</pattern>
                  <shadedPattern>org.sonar.api.internal.apachecommons</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>test-jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>

    <resources>
      <resource>
        <!-- Used to set SonarQube version in sq-version.txt file -->
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
      </resource>
    </resources>
  </build>

  <profiles>
    <profile>
      <id>clirr</id>
      <activation>
        <property>
          <name>clirr</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>clirr-maven-plugin</artifactId>
            <configuration>
              <comparisonVersion>4.5.2</comparisonVersion>
              <textOutputFile>${project.build.directory}/clirr-report.txt</textOutputFile>
              <linkXRef>false</linkXRef>
              <failOnError>false</failOnError>
              <excludes>
                <exclude>**/internal/**</exclude>
              </excludes>
            </configuration>
            <executions>
              <execution>
                <id>clirr</id>
                <goals>
                  <goal>check-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>