<?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">
  <parent>
    <artifactId>java-driver-parent</artifactId>
    <groupId>org.apache.cassandra</groupId>
    <version>4.19.2</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>java-driver-guava-shaded</artifactId>
  <name>Apache Cassandra Java Driver - guava shaded dep</name>
  <description>Shaded Guava artifact for use in the Java driver for Apache Cassandra®</description>
  <build>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.12</version>
        <executions>
          <execution>
            <id>regex-property</id>
            <goals>
              <goal>regex-property</goal>
            </goals>
            <configuration>
              <name>maven.main.skip</name>
              <value>${java.version}</value>
              <regex>^(?!1.8).+</regex>
              <replacement>true</replacement>
              <failIfNoMatch>false</failIfNoMatch>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>shade-guava-dependency</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>org.apache.cassandra:java-driver-guava-shaded</include>
                  <include>com.google.guava:guava</include>
                  <include>com.google.guava:failureaccess</include>
                  <include>com.google.j2objc:j2objc-annotations</include>
                </includes>
              </artifactSet>
              <relocations>
                <relocation>
                  <pattern>com.google</pattern>
                  <shadedPattern>com.datastax.oss.driver.shaded.guava</shadedPattern>
                </relocation>
              </relocations>
              <filters>
                <filter>
                  <artifact>com.google.guava:*</artifact>
                  <excludes>
                    <exclude>META-INF/**</exclude>
                  </excludes>
                </filter>
              </filters>
              <createSourcesJar>true</createSourcesJar>
              <shadeSourcesContent>true</shadeSourcesContent>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-clean-plugin</artifactId>
        <executions>
          <execution>
            <id>clean-classes</id>
            <phase>package</phase>
            <goals>
              <goal>clean</goal>
            </goals>
            <configuration>
              <directory>${project.build.outputDirectory}</directory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack-shaded-classes</id>
            <phase>package</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.outputDirectory}</outputDirectory>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.cassandra</groupId>
                  <artifactId>java-driver-guava-shaded</artifactId>
                  <version>${project.version}</version>
                  <type>jar</type>
                </artifactItem>
              </artifactItems>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.5.0</version>
        <extensions>true</extensions>
        <executions>
          <execution>
            <id>generate-shaded-manifest</id>
            <phase>package</phase>
            <goals>
              <goal>manifest</goal>
            </goals>
            <configuration>
              <instructions>
                <Bundle-SymbolicName>com.datastax.oss.driver.shaded.guava</Bundle-SymbolicName>
                <Export-Package>!com.datastax.oss.driver.shaded.guava.errorprone.*, !org.checkerframework.*, *</Export-Package>
                <Import-Package>javax.annotation.*;resolution:=optional;version="[3.0,4)", javax.crypto.*;resolution:=optional, sun.misc.*;resolution:=optional, !com.oracle.svm.*, !com.datastax.oss.driver.shaded.guava.errorprone.*, !org.checkerframework.*, *</Import-Package>
              </instructions>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-assembly-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-final-shaded-jar</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <archive>
                <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
              </archive>
              <descriptors>
                <descriptor>src/assembly/shaded-jar.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <executions>
          <execution>
            <id>empty-javadoc-jar</id>
            <goals>
              <goal>jar</goal>
            </goals>
            <configuration>
              <classifier>javadoc</classifier>
              <classesDirectory>${basedir}/src/main/javadoc</classesDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.revapi</groupId>
        <artifactId>revapi-maven-plugin</artifactId>
        <configuration>
          <skip>true</skip>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.graalvm.nativeimage</groupId>
      <artifactId>svm</artifactId>
      <version>20.0.0</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
</project>
