<?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>yauaa-parent</artifactId>
    <groupId>nl.basjes.parse.useragent</groupId>
    <version>6.11</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>yauaa</artifactId>
  <name>Yauaa : Analyzer</name>
  <description>A parsing and analyzing library to get information from a useragent string.</description>
  <url>https://yauaa.basjes.nl</url>
  <developers>
    <developer>
      <name>Niels Basjes</name>
      <email>niels@basjes.nl</email>
      <roles>
        <role>Architect</role>
        <role>Developer</role>
      </roles>
      <timezone>Europe/Amsterdam</timezone>
    </developer>
  </developers>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <scm>
    <connection>scm:git:https://github.com/nielsbasjes/yauaa.git</connection>
    <developerConnection>scm:git:file:///${project.basedir}</developerConnection>
    <tag>v6.11</tag>
    <url>https://github.com/nielsbasjes/yauaa</url>
  </scm>
  <build>
    <plugins>
      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <version>${maven-jar-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>UserAgents/*.sh</exclude>
            <exclude>UserAgents/**/*.sh</exclude>
            <exclude>UserAgents/**/*.csv</exclude>
            <exclude>UserAgents/**/*.txt</exclude>
            <exclude>UserAgents/**/*.tab</exclude>
            <exclude>UserAgents/**/*.md</exclude>
          </excludes>
          <archive>
            <manifestEntries>
              <Specification-Title>Yauaa: Yet Another UserAgent Analyzer</Specification-Title>
              <Specification-Version>${project.version}</Specification-Version>
              <Specification-Vendor>Niels Basjes</Specification-Vendor>
              <Implementation-Title>Yauaa: Yet Another UserAgent Analyzer</Implementation-Title>
              <Implementation-Version>${project.version}</Implementation-Version>
              <Implementation-Vendor>Niels Basjes</Implementation-Vendor>
              <Implementation-Vendor-Id>nl.basjes</Implementation-Vendor-Id>
              <Automatic-Module-Name>${Automatic-Module-Name}</Automatic-Module-Name>
              <url>${project.url}</url>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <id>inject-problematic-dependencies</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <artifactSet>
                <includes>
                  <include>org.antlr:antlr4-runtime</include>
                  <include>org.springframework:spring-core</include>
                  <include>org.yaml:snakeyaml</include>
                </includes>
              </artifactSet>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <minimizeJar>true</minimizeJar>
          <createDependencyReducedPom>true</createDependencyReducedPom>
          <filters>
            <filter>
              <artifact>org.antlr:antlr4-runtime</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.springframework:spring-core</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
            <filter>
              <artifact>org.yaml:snakeyaml</artifact>
              <excludes>
                <exclude>META-INF/services/**</exclude>
                <exclude>META-INF/MANIFEST.MF</exclude>
              </excludes>
            </filter>
          </filters>
          <relocations>
            <relocation>
              <pattern>org.springframework</pattern>
              <shadedPattern>nl.basjes.shaded.org.springframework</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.antlr</pattern>
              <shadedPattern>nl.basjes.shaded.org.antlr</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.yaml.snakeyaml</pattern>
              <shadedPattern>nl.basjes.shaded.org.yaml.snakeyaml</shadedPattern>
            </relocation>
          </relocations>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.alexecollins.maven.plugin</groupId>
        <artifactId>script-maven-plugin</artifactId>
        <version>${script-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Verify jar contents to ensure the shading of dependencies went right</id>
            <phase>verify</phase>
            <goals>
              <goal>execute</goal>
            </goals>
            <configuration>
              <language>beanshell</language>
              <script>import java.io.*;
                import java.util.jar.*;
                import java.util.Arrays;
                import org.codehaus.plexus.util.*;

                System.out.println("Verifying if the shading went correctly");

                String[] libraryWanted = {
                  "nl/basjes/parse/useragent/utils/YauaaVersion.class",
                  "nl/basjes/shaded/org/antlr/v4/runtime/Parser.class",
                  "nl/basjes/shaded/org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                };

                String[] libraryUnwanted = {
                  "org/antlr/v4/runtime/Parser.class",
                  "org/springframework/core/io/support/PathMatchingResourcePatternResolver.class",
                  "org/slf4j/LoggerFactory.class",
                };

                JarFile libraryJarFile = new JarFile( new File( "${project.basedir}/target", "yauaa-${project.version}.jar" ) );

                for ( String path : libraryWanted ) {
                  if ( libraryJarFile.getEntry( path ) == null ) {
                    throw new IllegalStateException( "Library: wanted path is missing: " + path );
                  }
                }

                for ( String path : libraryUnwanted ) {
                  if ( libraryJarFile.getEntry( path ) != null ) {
                    throw new IllegalStateException( "Library: unwanted path is present: " + path );
                  }
                }</script>
            </configuration>
          </execution>
        </executions>
        <dependencies>
          <dependency>
            <groupId>org.apache-extras.beanshell</groupId>
            <artifactId>bsh</artifactId>
            <version>2.0b6</version>
          </dependency>
        </dependencies>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>${exec-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>Generate Matchers and Lookups</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./regen-all.sh</executable>
            </configuration>
          </execution>
          <execution>
            <id>Inject dependency-reduced-pom.xml to the final jar file</id>
            <phase>package</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./inject-dependency-reduced-pom-into-jar.sh</executable>
              <arguments>
                <argument>${project.groupId}</argument>
                <argument>${project.artifactId}</argument>
                <argument>${project.version}</argument>
              </arguments>
            </configuration>
          </execution>
          <execution>
            <id>Generate list of testcases</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <executable>./getTestCases.sh</executable>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.antlr</groupId>
        <artifactId>antlr4-maven-plugin</artifactId>
        <version>${antlr.version}</version>
        <executions>
          <execution>
            <id>antlr</id>
            <goals>
              <goal>antlr4</goal>
            </goals>
            <configuration>
              <visitor>true</visitor>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.github.spotbugs</groupId>
        <artifactId>spotbugs-maven-plugin</artifactId>
        <version>${spotbugs-maven-plugin.version}</version>
      </plugin>
      <plugin>
        <artifactId>maven-checkstyle-plugin</artifactId>
        <version>${maven-checkstyle-plugin.version}</version>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
        <version>${jacoco-maven-plugin.version}</version>
        <configuration>
          <excludes>
            <exclude>nl/basjes/parse/useragent/Version.class</exclude>
            <exclude>nl/basjes/parse/useragent/PackagedRules.class</exclude>
            <exclude>nl/basjes/parse/useragent/parser/*.class</exclude>
            <exclude>nl/basjes/parse/useragent/debug/*.class</exclude>
          </excludes>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-antrun-plugin</artifactId>
        <version>${maven-antrun-plugin.version}</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
            <configuration>
              <target>
                <fileset />
                <pathconvert>
                  <map />
                </pathconvert>
                <echo>${my-file-list}</echo>
              </target>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <id>Generate Version YAML</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.yaml.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/classes/UserAgents/__Version__.yaml</outputFile>
            </configuration>
          </execution>
          <execution>
            <id>Generate Version Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/version/Version.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/Version.java</outputFile>
            </configuration>
          </execution>
          <execution>
            <id>Generate Yaml List Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PackagedRules.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PackagedRules.java</outputFile>
            </configuration>
          </execution>
          <execution>
            <id>Generate Preheat Java</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
            <configuration>
              <file>${basedir}/src/main/code-gen/UserAgents/PreHeatCases.java.template</file>
              <regex>false</regex>
              <outputFile>${basedir}/target/generated-sources/java/nl/basjes/parse/useragent/PreHeatCases.java</outputFile>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <replacements>
            <replacement>
              <token>@git.commit.id@</token>
              <value>${git.commit.id}</value>
            </replacement>
            <replacement>
              <token>@git.commit.id.describe-short@</token>
              <value>${git.commit.id.describe-short}</value>
            </replacement>
            <replacement>
              <token>@maven.build.timestamp@</token>
              <value>${maven.build.timestamp}</value>
            </replacement>
            <replacement>
              <token>@project.version@</token>
              <value>${project.version}</value>
            </replacement>
            <replacement>
              <token>@version.copyright@</token>
              <value>${version.copyright}</value>
            </replacement>
            <replacement>
              <token>@version.license@</token>
              <value>${version.license}</value>
            </replacement>
            <replacement>
              <token>@version.url@</token>
              <value>${version.url}</value>
            </replacement>
            <replacement>
              <token>@java.version@</token>
              <value>${java.version}</value>
            </replacement>
            <replacement>
              <token>@target.java.version@</token>
              <value>${target.java.version}</value>
            </replacement>
            <replacement>
              <token>###file-list###</token>
              <valueFile>${basedir}/target/temp-yaml-list.txt</valueFile>
            </replacement>
            <replacement>
              <token>###agents-list###</token>
              <valueFile>${basedir}/target/temp-agents-list.txt</valueFile>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>${build-helper-maven-plugin.version}</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <artifactId>maven-invoker-plugin</artifactId>
        <version>${maven-invoker-plugin.version}</version>
        <executions>
          <execution>
            <id>integration-test</id>
            <goals>
              <goal>install</goal>
              <goal>integration-test</goal>
              <goal>verify</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <failIfNoProjects>true</failIfNoProjects>
          <streamLogsOnFailures>true</streamLogsOnFailures>
          <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
          <pomIncludes>
            <pomInclude>*/pom.xml</pomInclude>
          </pomIncludes>
          <postBuildHookScript>verify</postBuildHookScript>
          <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
          <settingsFile>./src/it/settings.xml</settingsFile>
          <goals>
            <goal>clean</goal>
            <goal>test</goal>
          </goals>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.pitest</groupId>
        <artifactId>pitest-maven</artifactId>
        <version>1.7.4</version>
        <configuration>
          <threads>4</threads>
          <reportsDirectory>${project.basedir}/pitest/pit-reports</reportsDirectory>
          <historyInputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyInputFile>
          <historyOutputFile>${project.basedir}/pitest/yauaa_pitest_history.bin</historyOutputFile>
          <timestampedReports>true</timestampedReports>
          <excludedMethods>
            <excludedMethod>toString</excludedMethod>
          </excludedMethods>
          <excludedClasses>
            <excludedClass>nl.basjes.parse.useragent.Version</excludedClass>
            <excludedGroup>nl.basjes.parse.useragent.parser.*</excludedGroup>
            <excludedGroup>nl.basjes.parse.useragent.debug.*</excludedGroup>
          </excludedClasses>
          <avoidCallsTo>
            <avoidCallsTo>java.util.logging</avoidCallsTo>
            <avoidCallsTo>org.apache.log4j</avoidCallsTo>
            <avoidCallsTo>org.slf4j</avoidCallsTo>
            <avoidCallsTo>org.apache.commons.logging</avoidCallsTo>
          </avoidCallsTo>
        </configuration>
      </plugin>
    </plugins>
  </build>
  <dependencies>
    <dependency>
      <groupId>org.apache.httpcomponents.client5</groupId>
      <artifactId>httpclient5</artifactId>
      <version>5.1.3</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-text</artifactId>
      <version>1.9</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.commons</groupId>
      <artifactId>commons-collections4</artifactId>
      <version>4.4</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.github.ben-manes.caffeine</groupId>
      <artifactId>caffeine</artifactId>
      <version>3.0.5</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>nl.basjes.collections</groupId>
      <artifactId>prefixmap</artifactId>
      <version>2.0</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>kryo</artifactId>
          <groupId>com.esotericsoftware</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-core</artifactId>
      <version>2.17.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-slf4j-impl</artifactId>
      <version>2.17.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.apache.logging.log4j</groupId>
      <artifactId>log4j-jcl</artifactId>
      <version>2.17.2</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.esotericsoftware</groupId>
      <artifactId>kryo</artifactId>
      <version>5.3.0</version>
      <scope>compile</scope>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>com.google.code.findbugs</groupId>
      <artifactId>jsr305</artifactId>
      <version>3.0.2</version>
      <scope>compile</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-engine</artifactId>
      <version>5.8.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest-core</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-platform-engine</artifactId>
          <groupId>org.junit.platform</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-jupiter-api</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>apiguardian-api</artifactId>
          <groupId>org.apiguardian</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter-params</artifactId>
      <version>5.8.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>junit-jupiter-api</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>apiguardian-api</artifactId>
          <groupId>org.apiguardian</groupId>
        </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>org.hamcrest</groupId>
      <artifactId>hamcrest-core</artifactId>
      <version>2.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>hamcrest</artifactId>
          <groupId>org.hamcrest</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
  <properties>
    <Automatic-Module-Name>nl.basjes.parse.useragent</Automatic-Module-Name>
  </properties>
</project>
