<!--

    Copyright (C) 2006-2019 INRIA and contributors

    Spoon is available either under the terms of the MIT License (see LICENSE-MIT.txt) of the Cecill-C License (see LICENSE-CECILL-C.txt).
    You as the user are entitled to choose the terms under which to adopt Spoon.

-->
<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>

  <parent>
    <groupId>fr.inria.gforge.spoon</groupId>
    <artifactId>spoon-pom</artifactId>
    <version>10.4.0</version>
    <relativePath>spoon-pom</relativePath>
  </parent>

  <artifactId>spoon-core</artifactId>
  <packaging>jar</packaging>
  <version>10.4.0</version>
  <name>Spoon Core</name>
  <description>Spoon is a tool for meta-programming, analysis and transformation of Java programs.</description>
  <url>http://spoon.gforge.inria.fr/</url>

  <properties>
    <sonar.coverage.exclusions>
        **/support/gui/*
    </sonar.coverage.exclusions>
    <checkstyle.config.location>checkstyle.xml</checkstyle.config.location>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.eclipse.jdt</groupId>
      <artifactId>org.eclipse.jdt.core</artifactId>
      <version>3.33.0</version>
      <exclusions>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.resources</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.runtime</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.core.filesystem</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.eclipse.platform</groupId>
          <artifactId>org.eclipse.text</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>com.martiansoftware</groupId>
      <artifactId>jsap</artifactId>
      <version>2.1</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.slf4j/slf4j-api -->
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
      <version>1.7.36</version>
    </dependency>
      <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
      <version>2.13.0</version>
    </dependency>
    <dependency>
	<!-- We use this old version for maximum compatibility, as we use the system maven installation for all commands anyways. -->
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-model</artifactId>
      <version>3.6.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-lang3</artifactId>
      <version>3.12.0</version>
    </dependency>
  <!-- https://mvnrepository.com/artifact/org.tukaani/xz -->
	<dependency>
    	<groupId>org.tukaani</groupId>
    	<artifactId>xz</artifactId>
    	<version>1.9</version>
        <scope>test</scope>
	</dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
      <version>2.15.2</version>
    </dependency>
    <dependency>
      <!-- support for compressed serialized ASTs -->
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
      <version>1.23.0</version>
	</dependency>
    <dependency>
      <!-- to reproduce JTD error with nullable annotation -->
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>32.1.1-jre</version>
      <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.4.8</version>
        <scope>test</scope>
    </dependency>
    <dependency>
      <!-- to reproduce and fix a bug -->
      <groupId>com.mysema.querydsl</groupId>
      <artifactId>querydsl-core</artifactId>
      <version>3.7.4</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <groupId>com.google.code.findbugs</groupId>
          <artifactId>jsr305</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.mysema.commons</groupId>
          <artifactId>mysema-commons-lang</artifactId>
        </exclusion>
        <exclusion>
          <groupId>com.infradna.tool</groupId>
          <artifactId>bridge-method-annotation</artifactId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.shared</groupId>
      <artifactId>maven-invoker</artifactId>
      <version>3.2.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/javax.validation/validation-api -->
    <dependency>
      <groupId>javax.validation</groupId>
      <artifactId>validation-api</artifactId>
      <version>2.0.1.Final</version>
      <scope>test</scope>
    </dependency>
    <!-- https://mvnrepository.com/artifact/uk.org.lidalia/slf4j-test -->
    <dependency>
      <groupId>uk.org.lidalia</groupId>
      <artifactId>slf4j-test</artifactId>
      <version>1.2.0</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.kohsuke.metainf-services</groupId>
      <artifactId>metainf-services</artifactId>
      <version>1.11</version>
      <optional>true</optional>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
        <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>prepare-agent</goal>
                    </goals>
                </execution>
                <execution>
                    <id>report</id>
                    <phase>prepare-package</phase>
                    <goals>
                        <goal>report</goal>
                    </goals>
                </execution>
                <execution>
                  <!-- reference:
                  * https://www.jacoco.org/jacoco/trunk/doc/check-mojo.html
                  * https://stackoverflow.com/questions/41891739/how-to-fail-a-maven-build-if-junit-coverage-falls-below-certain-threshold
                  -->
                  <id>check-coverage</id>
                  <goals>
                    <goal>check</goal>
                  </goals>
                  <configuration>
                    <rules>
                    <rule implementation="org.jacoco.maven.RuleConfiguration">
                      <element>CLASS</element>
                      <excludes>
                        <!-- we exclude the GUI classes, because we don't have Swing GUI tests in CI -->
                        <exclude>spoon.support.gui.*</exclude>
                        <!-- we exclude the generated inner classes of ReplacementVisitor -->
                        <exclude>spoon.support.visitor.replace.ReplacementVisitor.*</exclude>
                      </excludes>
                      <limits>
                        <limit implementation="org.jacoco.report.check.Limit">
                          <counter>LINE</counter>
                          <value>COVEREDRATIO</value>
                          <minimum>0.1</minimum>
                        </limit>
                      </limits>
                    </rule>
                  </rules>
                  </configuration>
                </execution>
          </executions>
      </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>spoon.Launcher</mainClass>
                    </manifest>
                    <manifestEntries>
                      <Multi-Release>true</Multi-Release>
                    </manifestEntries>
                </archive>
                <descriptorRefs>
                    <descriptorRef>jar-with-dependencies</descriptorRef>
                    <!-- descriptorRef>project</descriptorRef -->
                </descriptorRefs>
                <!-- descriptor>src/main/assembly/project.xml</descriptor -->
            </configuration>
            <executions>
                <execution>
                    <id>make-assembly</id><!-- this is used for inheritance merges -->
                    <phase>package</phase><!-- append to the packaging phase. -->
                    <goals>
                        <goal>single</goal><!-- goals == mojos -->
                    </goals>
                </execution>
            </executions>
        </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>3.3.0</version>
        <configuration>
          <failsOnError>true</failsOnError>
          <consoleOutput>true</consoleOutput>
          <!-- we exclude the generated files, see CtGenerationTest -->
          <excludes>spoon/support/visitor/clone/CloneBuilder.java</excludes>
          <excludes>spoon/reflect/visitor/CtBiScannerDefault.java</excludes>
          <excludes>spoon/support/visitor/equals/EqualsVisitor.java</excludes>
          <excludes>spoon/support/visitor/replace/ReplacementVisitor.java</excludes>
        </configuration>
        <executions>
          <execution>
            <phase>verify</phase>
            <goals>
              <goal>checkstyle</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <configuration>
          <classpathDependencyExcludes>
            <classpathDependencyExclude>ch.qos.logback:logback-classic</classpathDependencyExclude>
            <trimStackTrace>false</trimStackTrace>
          </classpathDependencyExcludes>
        </configuration>
      </plugin>

    </plugins>
  </build>
</project>
