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

  <parent>
    <groupId>org.sonarsource.parent</groupId>
    <artifactId>parent</artifactId>
    <version>74.0.0.1768</version>
  </parent>

  <groupId>org.sonarsource.plugins.cayc</groupId>
  <artifactId>sonar-cayc-plugin</artifactId>
  <packaging>sonar-plugin</packaging>
  <version>2.4.0.2018</version>
  <scm>
    <url>https://github.com/SonarSource/sonar-cayc-stats-plugin</url>
  </scm>
  <issueManagement>
    <url>https://sonarsource.atlassian.net/jira/software/c/projects/CAYCPLUGIN</url>
  </issueManagement>

  <name>Clean as You Code Plugin</name>
  <description>Demonstrates the value of Clean as You Code methodology</description>

  <inceptionYear>2022</inceptionYear>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <sonar.apiVersion>9.17.0.587</sonar.apiVersion>
    <sonarqube.version>10.1.0.73491</sonarqube.version>
    <jdk.min.version>11</jdk.min.version>
    <sonar.sources>src/main/java,src/main/ts</sonar.sources>
    <sonar.javascript.lcov.reportPaths>./coverage/lcov.info</sonar.javascript.lcov.reportPaths>
    <sonar.coverage.exclusions>src/main/java/org/sonar/plugin/cayc/CleanAsYouCodePlugin.java,src/main/ts/api.ts,src/main/ts/**/__tests__/**</sonar.coverage.exclusions>
    <gitRepositoryName>sonar-cayc-stats-plugin</gitRepositoryName>
    <artifactsToPublish>${project.groupId}:sonar-cayc-plugin:jar</artifactsToPublish>
    <orchestrator.version>4.1.0.495</orchestrator.version>
    <skipFrontendTests>false</skipFrontendTests>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api</artifactId>
      <version>${sonar.apiVersion}</version>
      <scope>provided</scope>
    </dependency>
    
    <!-- integration tests -->
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-ws</artifactId>
      <version>${sonarqube.version}</version>
      <scope>test</scope>
    </dependency>

    <!-- unit tests -->
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-testing-harness</artifactId>
      <version>${sonarqube.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>4.13.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>5.1.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
      <version>3.24.2</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.orchestrator</groupId>
      <artifactId>sonar-orchestrator</artifactId>
      <version>${orchestrator.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.orchestrator</groupId>
      <artifactId>sonar-orchestrator-junit4</artifactId>
      <version>${orchestrator.version}</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.postgresql</groupId>
      <artifactId>postgresql</artifactId>
      <version>42.5.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.codeborne</groupId>
      <artifactId>selenide</artifactId>
      <version>6.17.0</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
        <artifactId>sonar-packaging-maven-plugin</artifactId>
        <version>1.21.0.505</version>
        <extensions>true</extensions>
        <configuration>
          <pluginKey>cayc</pluginKey>
          <pluginName>Clean as You Code</pluginName>
          <pluginDescription>Demonstrates the value of Clean as You Code methodology</pluginDescription>
          <pluginClass>org.sonar.plugin.cayc.CleanAsYouCodePlugin</pluginClass>
          <sonarQubeMinVersion>8.9</sonarQubeMinVersion>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.10.1</version>
        <configuration>
          <release>11</release>
        </configuration>
      </plugin>
      <plugin>
        <!-- UTF-8 bundles are not supported by Java, so they must be converted during build -->
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>native2ascii-maven-plugin</artifactId>
        <version>2.0.1</version>
        <executions>
          <execution>
            <goals>
              <goal>resources</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.9.1</version>
        <executions>
          <execution>
            <phase>generate-resources</phase>
            <id>install node and yarn</id>
            <goals>
              <goal>install-node-and-yarn</goal>
            </goals>
            <configuration>
              <nodeVersion>v16.14.0</nodeVersion>
              <yarnVersion>v1.22.5</yarnVersion>
            </configuration>
          </execution>
          <execution>
            <id>yarn install</id>
            <goals>
              <goal>yarn</goal>
            </goals>
          </execution>
          <execution>
            <phase>generate-resources</phase>
            <id>yarn run script</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <arguments>build</arguments>
            </configuration>
          </execution>
          <execution>
            <phase>test</phase>
            <id>yarn run tests</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <configuration>
              <skip>${skipFrontendTests}</skip>
              <arguments>test --coverage</arguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.2.0</version>
        <executions>
          <execution>
            <id>add-test-source</id>
            <phase>generate-test-sources</phase>
            <goals>
              <goal>add-test-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>src/bbt/java</source>
              </sources>
            </configuration>
          </execution>
          <execution>
            <id>add-test-resources</id>
            <phase>generate-test-resources</phase>
            <goals>
              <goal>add-test-resource</goal>
            </goals>
            <configuration>
              <resources>
                <resource>
                  <directory>src/bbt/resources</directory>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
        <id>black-box-tests</id>
        <properties>
            <skipFrontendTests>true</skipFrontendTests>
        </properties>
        <build>
            <plugins>
              <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <configuration>
                        <skip>true</skip>
                    </configuration>
                </plugin>
              <plugin>
                  <groupId>org.apache.maven.plugins</groupId>
                  <artifactId>maven-failsafe-plugin</artifactId>
                  <executions>
                      <execution>
                          <id>run-black-box-tests</id>
                          <goals>
                              <goal>integration-test</goal>
                              <goal>verify</goal>
                          </goals>
                          <configuration>
                            <includes>
                                  <include>**/*BBT.java</include>
                            </includes>
                          </configuration>
                      </execution>
                  </executions>
              </plugin>
            </plugins>
        </build>
    </profile>
</profiles>


</project>
