<?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.prometheus</groupId>
    <artifactId>client_java</artifactId>
    <version>1.3.8</version>
  </parent>

  <artifactId>prometheus-metrics-exposition-formats</artifactId>
  <packaging>bundle</packaging>

  <name>Prometheus Metrics Exposition Formats</name>
  <description>
    Prometheus exposition formats.
  </description>

  <properties>
    <automatic.module.name>io.prometheus.metrics.expositionformats</automatic.module.name>
  </properties>

  <dependencies>
    <dependency>
      <groupId>io.prometheus</groupId>
      <artifactId>prometheus-metrics-exposition-formats-no-protobuf</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>regex-property</id>
            <goals>
              <goal>regex-property</goal>
            </goals>
            <configuration>
              <name>protobuf-java.string-version</name>
              <value>${protobuf-java.version}</value>
              <regex>\.</regex>
              <replacement>_</replacement>
              <failIfNoMatch>true</failIfNoMatch>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <shadeSourcesContent>true</shadeSourcesContent>
              <createSourcesJar>true</createSourcesJar>
              <artifactSet>
                <includes>
                  <include>com.google.protobuf:protobuf-java</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google.protobuf</pattern>
                  <shadedPattern>
                    io.prometheus.metrics.shaded.com_google_protobuf_${protobuf-java.string-version}
                  </shadedPattern>
                </relocation>
              </relocations>
              <filters>
                <filter>
                  <artifact>com.google.protobuf:protobuf-java</artifact>
                  <excludes>
                    <exclude>META-INF/maven/com.google.protobuf/**</exclude>
                    <exclude>**/*.proto</exclude>
                    <exclude>META-INF/MANIFEST.MF</exclude>
                  </excludes>
                </filter>
              </filters>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
