<?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.javascript</groupId>
    <artifactId>javascript</artifactId>
    <version>9.2.0.17876</version>
  </parent>

  <artifactId>sonar-javascript-plugin</artifactId>
  <packaging>sonar-plugin</packaging>

  <name>SonarQube JavaScript :: Plugin</name>
  <!-- Be careful when altering <description> as its value shows up in the SonarQube GUI -->
  <description>Code Analyzer for JavaScript/TypeScript/CSS</description>
  <url>http://redirect.sonarsource.com/plugins/javascript.html</url>

  <scm>
    <connection>scm:git:git@github.com:SonarSource/sonar-javascript.git</connection>
    <developerConnection>scm:git:git@github.com:SonarSource/sonar-javascript.git</developerConnection>
    <url>https://github.com/SonarSource/sonar-javascript</url>
    <tag>HEAD</tag>
  </scm>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>javascript-checks</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>eslint-bridge</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>nodejs-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-compress</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-plugin-api-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-analyzer-commons</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sslr</groupId>
      <artifactId>sslr-core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.assertj</groupId>
      <artifactId>assertj-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.awaitility</groupId>
      <artifactId>awaitility</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarlint.core</groupId>
      <artifactId>sonarlint-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarlint.core</groupId>
      <artifactId>sonarlint-core</artifactId>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <phase>prepare-package</phase>
            <goals>
              <goal>java</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <mainClass>org.sonar.plugins.javascript.utils.RulesMetadataForSonarLint</mainClass>
          <classpathScope>compile</classpathScope>
          <arguments>
            <argument>${project.build.directory}/classes/sonarlint-metadata.json</argument>
          </arguments>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
        <artifactId>sonar-packaging-maven-plugin</artifactId>
        <configuration>
          <pluginName>JavaScript/TypeScript/CSS Code Quality and Security</pluginName>
          <pluginClass>org.sonar.plugins.javascript.JavaScriptPlugin</pluginClass>
          <skipDependenciesPackaging>true</skipDependenciesPackaging>
          <sonarLintSupported>true</sonarLintSupported>
          <sonarQubeMinVersion>${sonarQubeMinVersion}</sonarQubeMinVersion>
          <nodeJsMinVersion>12.22.0</nodeJsMinVersion>
          <jreMinVersion>${jdk.min.version}</jreMinVersion>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadedArtifactAttached>false</shadedArtifactAttached>
              <minimizeJar>true</minimizeJar>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <!-- This is used to get plugin version at runtime using getPackage().getImplementationVersion() -->
                    <Implementation-Version>${project.version}</Implementation-Version>
                  </manifestEntries>
                </transformer>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <artifactId>maven-enforcer-plugin</artifactId>
        <executions>
          <execution>
            <id>enforce-plugin-size</id>
            <goals>
              <goal>enforce</goal>
            </goals>
            <phase>verify</phase>
            <configuration>
              <rules>
                <requireFilesSize>
                  <minsize>20000000</minsize>
                  <maxsize>23000000</maxsize>
                  <files>
                    <file>${project.build.directory}/${project.build.finalName}.jar</file>
                  </files>
                </requireFilesSize>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>

</project>
