<?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.python</groupId>
    <artifactId>python</artifactId>
    <version>5.2.0.20808</version>
  </parent>

  <artifactId>python-frontend</artifactId>

  <name>Python :: Frontend</name>
  <properties>
    <sonar.sources>pom.xml,src/main/java,typeshed_serializer/serializer,typeshed_serializer/runners</sonar.sources>
    <sonar.python.coverage.reportPaths>typeshed_serializer/cov.xml</sonar.python.coverage.reportPaths>
    <sonar.python.version>3.9</sonar.python.version>
    <skipTests>false</skipTests>
    <failStubGenerationFast>false</failStubGenerationFast>
  </properties>
  <dependencies>
    <dependency>
      <groupId>org.sonarsource.sslr</groupId>
      <artifactId>sslr-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sslr</groupId>
      <artifactId>sslr-testing-harness</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.api.plugin</groupId>
      <artifactId>sonar-plugin-api-test-fixtures</artifactId>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-api</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>com.google.guava</groupId>
      <artifactId>guava</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
      <version>${protobuf.version}</version>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-regex-parsing</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.analyzer-commons</groupId>
      <artifactId>sonar-analyzer-commons</artifactId>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.sonarsource.sonarqube</groupId>
      <artifactId>sonar-plugin-api-impl</artifactId>
    </dependency>
    <dependency>
      <groupId>com.fasterxml.jackson.core</groupId>
      <artifactId>jackson-databind</artifactId>
    </dependency>
  </dependencies>
  <build>
    <extensions>
      <extension>
        <groupId>kr.motd.maven</groupId>
        <artifactId>os-maven-plugin</artifactId>
        <version>1.7.1</version>
      </extension>
    </extensions>
    <plugins>
      <plugin>
        <groupId>org.xolstice.maven.plugins</groupId>
        <artifactId>protobuf-maven-plugin</artifactId>
        <version>0.6.1</version>
        <executions>
          <execution>
            <id>generate-protobuf-java-sources</id>
            <goals>
              <goal>compile</goal>
            </goals>
            <configuration>
              <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
              </protocArtifact>
              <protoSourceRoot>${project.basedir}/src/main/protobuf</protoSourceRoot>
              <outputDirectory>${project.build.directory}/generated-sources/protobuf</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>generate-protobuf-python-sources</id>
            <goals>
              <goal>compile-python</goal>
            </goals>
            <configuration>
              <protocArtifact>com.google.protobuf:protoc:${protobuf.version}:exe:${os.detected.classifier}
              </protocArtifact>
              <protoSourceRoot>${project.basedir}/src/main/protobuf</protoSourceRoot>
              <outputDirectory>${project.basedir}/typeshed_serializer/serializer/proto_out</outputDirectory>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protoc</artifactId>
            <version>${protobuf.version}</version>
            <type>exe</type>
            <classifier>${os.detected.classifier}</classifier>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.6.0</version>
        <executions>
          <execution>
            <id>add-protobuf-generated-sources</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/protobuf</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>
        typeshed_serializer
      </id>
      <activation>
        <property>
          <name>
            !skipTypeshed
          </name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.5.0</version>
            <configuration>
              <workingDirectory>typeshed_serializer</workingDirectory>
            </configuration>
            <executions>
              <execution>
                <id>tox-runner</id>
                <phase>generate-resources</phase>
                <configuration>
                  <executable>python</executable>
                  <arguments>
                      <argument>runners/tox_runner.py</argument>
                      <argument>--skip_tests</argument>
                      <argument>${skipTests}</argument>
                      <argument>--fail_fast</argument>
                      <argument>${failStubGenerationFast}</argument>
                  </arguments>
                  <useMavenLogger>true</useMavenLogger>
                </configuration>
                <goals>
                  <goal>exec</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>com.mycila</groupId>
            <artifactId>license-maven-plugin</artifactId>
            <!-- This plugin is already configured in parent pom, however we want a configuration specific to this project -->
            <configuration>
              <licenseSets>
                <licenseSet>
                  <includes>
                    <include>src/*/java/**/*.java</include>
                    <include>typeshed_serializer/serializer/**/*.py</include>
                    <include>typeshed_serializer/runners/**/*.py</include>
                    <include>typeshed_serializer/tests/**/*.py</include>
                  </includes>
                  <excludes>
                    <exclude>typeshed_serializer/serializer/proto_out/**</exclude>
                    <exclude>src/test/resources/**</exclude>
                  </excludes>
                </licenseSet>
              </licenseSets>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
