<?xml version="1.0" encoding="UTF-8"?>

<!--
 * See the NOTICE file distributed with this work for additional
 * information regarding copyright ownership.
 *
 * This is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as
 * published by the Free Software Foundation; either version 2.1 of
 * the License, or (at your option) any later version.
 *
 * This software is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this software; if not, write to the Free
 * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-->

<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>org.xwiki.platform</groupId>
    <artifactId>xwiki-platform-extension</artifactId>
    <version>13.10.7</version>
  </parent>
  <artifactId>xwiki-platform-extension-script</artifactId>
  <name>XWiki Platform - Extension - Script</name>
  <packaging>jar</packaging>
  <description>XWiki Platform - Extension - Script</description>
  <properties>
    <xwiki.jacoco.instructionRatio>0.21</xwiki.jacoco.instructionRatio>
    </properties>
  <dependencies>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-extension-api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-job-script</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-job-default</artifactId>
      <version>${commons.version}</version>
    </dependency>
    <!-- Scripting -->
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-oldcore</artifactId>
      <version>${project.version}</version>
    </dependency>

    <!-- Test dependencies -->
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-extension-api</artifactId>
      <version>${commons.version}</version>
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.commons</groupId>
      <artifactId>xwiki-commons-logging-logback</artifactId>
      <version>${commons.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.xwiki.platform</groupId>
      <artifactId>xwiki-platform-test-oldcore</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>javax.servlet-api</artifactId>
      <scope>test</scope>
    </dependency>
    <!-- Used to mock XWiki class -->
    <dependency>
      <groupId>org.jmock</groupId>
      <artifactId>jmock-legacy</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <executions>
          <execution>
            <!-- Specify the "default" execution id so that the "blocker" one is always executed -->
            <id>default</id>
            <configuration>
              <excludes>
                <!-- Fan-Out complexity -->
                **/ExtensionManagerScriptService.java,
                **/ExtensionRepositoryScriptSafeProvider.java
              </excludes>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>fr.inria.gforge.spoon</groupId>
        <artifactId>spoon-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>spoon-main</id>
            <configuration>
              <processorProperties combine.children="append">
                <processorProperty>
                  <name>org.xwiki.tool.spoon.InjectAnnotationProcessor</name>
                  <properties>
                    <property>
                      <!-- Exclude org.xwiki.extension.repository.ExtensionRepository since it doesn't have a @Role
                           annotation (it seems this is because there are other interfaces extending ExtensionRepository
                           and they are using @Role and thus if ExtensionRepository also had it, there would be several
                           components registered for all the roles). This is to be clarified and possibly refactored.
                           In any case, static checking cannot guess that there's a RecommendedExtensionRepository class
                           with "@Component(roles = ExtensionRepository.class)" (only the CM knows that), and thus
                           excluding the check for now. -->
                      <name>excludedFieldTypes</name>
                      <value><![CDATA[
                        ["org.xwiki.extension.repository.ExtensionRepository"]
                      ]]></value>
                    </property>
                  </properties>
                </processorProperty>
              </processorProperties>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
