<?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>
    <!-- 13-Mar-2017, tatu: use FasterXML oss-parent over sonatype's, more
        likely to get settings that work for releases
      -->
    <parent>
        <groupId>com.fasterxml</groupId>
        <artifactId>oss-parent</artifactId>
        <version>72</version>
    </parent>
    <groupId>com.ning</groupId>
    <artifactId>compress-lzf</artifactId>
    <name>Compress-LZF</name>
    <version>1.2.0</version>
    <packaging>bundle</packaging>
    <description>
        Compression codec for LZF encoding for particularly encoding/decoding, with reasonable compression.
        Compressor is basic Lempel-Ziv codec, without Huffman (deflate/gzip) or statistical post-encoding.
        See "http://oldhome.schmorp.de/marc/liblzf.html" for more on original LZF package.
    </description>
    <url>https://github.com/ning/compress</url>
    <scm>
        <connection>scm:git:git@github.com:ning/compress.git</connection>
        <developerConnection>scm:git:git@github.com:ning/compress.git</developerConnection>
        <url>https://github.com/ning/compress</url>
        <tag>compress-lzf-1.2.0</tag>
    </scm>
    <issueManagement>
        <url>https://github.com/ning/compress/issues</url>
    </issueManagement>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <developers>
        <developer>
            <id>tatu</id>
            <name>Tatu Saloranta</name>
            <email>tatu.saloranta@iki.fi</email>
        </developer>
    </developers>
    <contributors>
        <contributor>
            <name>Jon Hartlaub</name>
            <email>jhartlaub@gmail.com</email>
        </contributor>
        <contributor>
            <name>Cédrik Lime</name>
            <email>2013@cedrik.fr</email>
        </contributor>
    </contributors>
    <licenses>
        <license>
            <name>Apache License 2.0</name>
            <url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${version.junit5}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.code-intelligence</groupId>
            <artifactId>jazzer-junit</artifactId>
            <version>0.28.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>install</defaultGoal>
        <plugins>
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- 1.6 since 0.9.7 -->
                <!-- 1.8 since 1.1 (to use Moditect plugin) -->
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <encoding>UTF-8</encoding>
                    <links>
                        <link>https://docs.oracle.com/javase/8/docs/api/</link>
                    </links>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <mavenExecutorId>forked-path</mavenExecutorId>
                </configuration>
            </plugin>
            <!-- Plus, let's make jars OSGi bundles as well  -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <instructions><!--  note: artifact id, name, version and description use defaults (which are fine) -->
                        <Bundle-Vendor>http://ning.com</Bundle-Vendor>
                        <!-- if using high-perf decoder: -->
                        <Import-Package>
                            sun.misc;resolution:=optional, *
                        </Import-Package>
                        <Private-Package>
                            com.ning.compress.lzf.impl
                        </Private-Package>
                        <!-- Export-Package default: set of packages in local Java sources, excluding the default package '.' and any packages containing 'impl' or 'internal' -->
                        <!--  06-Jan-2021, tatu: Commented out, I think, since bundle plugin can figure it out? -->
                        <!--Export-Package>
                            com.ning.compress,
                            com.ning.compress.gzip,
                            com.ning.compress.lzf,
                            com.ning.compress.lzf.parallel,
                            com.ning.compress.lzf.util
                        </Export-Package-->
                        <Main-Class>com.ning.compress.lzf.LZF</Main-Class>
                    </instructions>
                </configuration>
            </plugin>

            <!--  06-Jan-2021, tatu: Add rudimentary JDK9+ module info. To build with JDK 8
              will have to use `moduleInfoFile` which isn't great but will have to do
                  -->
            <plugin>
                <groupId>org.moditect</groupId>
                <artifactId>moditect-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>add-module-infos</id>
                        <phase>package</phase>
                        <goals>
                            <goal>add-module-info</goal>
                        </goals>
                        <configuration>
                            <overwriteExistingFiles>true</overwriteExistingFiles>
                            <module>
                                <moduleInfoFile>src/moditect/module-info.java</moduleInfoFile>
                            </module>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- EVEN BETTER; make executable! -->

<!-- 08-Sep-2014, tatu: except, doesn't quite work yet. Sigh.
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>2.2</version>
            <executions>
              <execution>
               <phase>package</phase>
                <goals>
                <goal>shade</goal>
               </goals>
               <configuration>
                <transformers>
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                    <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                        <mainClass>com.ning.compress.lzf.LZF</mainClass>
                    </transformer>
                </transformers>
                <createDependencyReducedPom>false</createDependencyReducedPom>
                <filters>
                    <filter>
                        <artifact>*:*</artifact>
                        <excludes>
                            <exclude>META-INF/*.SF</exclude>
                            <exclude>META-INF/*.DSA</exclude>
                            <exclude>META-INF/*.RSA</exclude>
                        </excludes>
                    </filter>
                </filters>
               </configuration>
              </execution>
            </executions>
          </plugin>

          <plugin>
        <groupId>org.skife.maven</groupId>
        <artifactId>really-executable-jar-maven-plugin</artifactId>
        <version>1.2.0</version>
        <configuration>
          <programFile>lzf</programFile>
          <flags>-Xmx200m</flags>
        </configuration>

        <executions>
          <execution>
           <phase>package</phase>
           <goals>
             <goal>really-executable-jar</goal>
           </goals>
          </execution>
        </executions>
          </plugin>
-->


        </plugins>
    </build>

    <profiles>
        <!--
            Profile for fuzzing, setting ENV variable and configuring individual fuzz methods to run
            Should be run separately from regular build because it disables normal unit tests and only runs fuzz tests
        -->
        <profile>
            <id>fuzz</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-surefire-plugin</artifactId>
                        <configuration>
                            <environmentVariables>
                                <!-- Enable Jazzer fuzzing mode, see https://github.com/CodeIntelligenceTesting/jazzer?tab=readme-ov-file#fuzzing-mode -->
                                <JAZZER_FUZZ>1</JAZZER_FUZZ>
                            </environmentVariables>
                            <failIfNoTests>true</failIfNoTests>
                        </configuration>
                        <!--
                            Currently have to list all fuzz tests separately, see
                            https://github.com/CodeIntelligenceTesting/jazzer/issues/599
                        -->
                        <executions>
                            <!-- Skip default execution -->
                            <execution>
                                <id>default-test</id>
                                <configuration>
                                    <skipTests>true</skipTests>
                                </configuration>
                            </execution>
                            <!-- Explicitly list separate fuzz test methods -->
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#decode</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#decode</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#roundtrip</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#roundtrip</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#encode</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#encode</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#encodeAppend</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#encodeAppend</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#inputStreamRead</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#inputStreamRead</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#inputStreamSkip</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#inputStreamSkip</test>
                                </configuration>
                            </execution>
                            <execution>
                                <id>fuzz-TestFuzzUnsafeLZF#outputStream</id>
                                <goals>
                                    <goal>test</goal>
                                </goals>
                                <configuration>
                                    <test>TestFuzzUnsafeLZF#outputStream</test>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <profile>
            <id>release-sign-artifacts</id>
            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
