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

  <parent>
    <groupId>io.tileverse</groupId>
    <artifactId>tileverse-parent</artifactId>
    <version>2.1-RC</version>
  </parent>

  <groupId>io.tileverse.vectortiles</groupId>
  <artifactId>tileverse-vectortiles</artifactId>
  <name>Tileverse :: Vector Tiles</name>
  <description>Vector tile encoding/decoding for Tileverse</description>

  <properties>
    <!--
      VectorTileProto.java is protoc-generated (carries @com.google.protobuf.Generated)
      with manual edits to fix builder casting; exclude it from analysis.
    -->
    <sonar.exclusions>**/VectorTileProto.java</sonar.exclusions>
    <sonar.cpd.exclusions>**/VectorTileProto.java</sonar.cpd.exclusions>
  </properties>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>io.tileverse</groupId>
        <artifactId>tileverse-bom</artifactId>
        <version>${project.version}</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <dependencies>
    <!--
     Adding bom as a dependency with type=pom and scope=provided here
     does not change the dependency tree for the submodules at all, but forces the BOM to be installed
     in the local maven repository first, either when building the whole project or when a submodule is
     built independently (e.g. mvn install -pl :<module> -am), hence ensuring any change to the dependencies
     is picked up.
    -->
    <dependency>
      <groupId>io.tileverse</groupId>
      <artifactId>tileverse-bom</artifactId>
      <version>${project.version}</version>
      <type>pom</type>
      <scope>provided</scope>
      <optional>true</optional>
    </dependency>

    <!-- JTS Topology Suite -->
    <dependency>
      <groupId>org.locationtech.jts</groupId>
      <artifactId>jts-core</artifactId>
    </dependency>

    <!-- Protocol Buffers -->
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-javalite</artifactId>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <configuration>
          <sourceFileExcludes>
            <!-- Exclude protobuf generated classes from javadoc -->
            <sourceFileExclude>**/VectorTileProto.java</sourceFileExclude>
          </sourceFileExcludes>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>coverage</id>
      <activation>
        <property>
          <name>coverage</name>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.jacoco</groupId>
            <artifactId>jacoco-maven-plugin</artifactId>
            <configuration>
              <excludes>
                <!-- Exclude protobuf generated classes -->
                <exclude>**/VectorTileProto*</exclude>
              </excludes>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <id>protobuf</id>
      <activation>
        <activeByDefault>false</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>io.github.ascopes</groupId>
            <artifactId>protobuf-maven-plugin</artifactId>
            <version>3.10.2</version>
            <configuration>
              <liteOnly>true</liteOnly>
              <protocVersion>${protobuf-java.version}</protocVersion>
            </configuration>
            <executions>
              <execution>
                <goals>
                  <goal>generate</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
