<?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>
    <artifactId>com.io7m.montarre</artifactId>
    <groupId>com.io7m.montarre</groupId>
    <version>1.0.0-beta0001</version>
  </parent>

  <artifactId>com.io7m.montarre.cmdline</artifactId>

  <name>com.io7m.montarre.cmdline</name>
  <description>Application packaging tools (Command-line tools).</description>
  <url>https://www.io7m.com/software/montarre</url>

  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.api</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.io</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.schema</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.nativepack</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.xml_format</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>com.io7m.montarre.adoptium</artifactId>
      <version>${project.version}</version>
    </dependency>

    <dependency>
      <groupId>com.io7m.lanark</groupId>
      <artifactId>com.io7m.lanark.core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.jxe</groupId>
      <artifactId>com.io7m.jxe.core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.seltzer</groupId>
      <artifactId>com.io7m.seltzer.api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.quarrel</groupId>
      <artifactId>com.io7m.quarrel.core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.quarrel</groupId>
      <artifactId>com.io7m.quarrel.ext.logback</artifactId>
    </dependency>
    <dependency>
      <groupId>commons-io</groupId>
      <artifactId>commons-io</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>jul-to-slf4j</artifactId>
    </dependency>
    <dependency>
      <groupId>org.slf4j</groupId>
      <artifactId>slf4j-api</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.streamtime</groupId>
      <artifactId>com.io7m.streamtime.core</artifactId>
    </dependency>
    <dependency>
      <groupId>com.io7m.jdownload</groupId>
      <artifactId>com.io7m.jdownload.core</artifactId>
    </dependency>

    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.annotation.bundle</artifactId>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>org.osgi.annotation.versioning</artifactId>
      <scope>provided</scope>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <!-- Ignore dependencies that bytecode analysis gets wrong. -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <configuration>
          <failOnWarning>true</failOnWarning>
          <ignoredUnusedDeclaredDependencies>
            <ignoredUnusedDeclaredDependency>ch.qos.logback:logback-classic::*</ignoredUnusedDeclaredDependency>
          </ignoredUnusedDeclaredDependencies>
        </configuration>
      </plugin>

      <plugin>
        <groupId>com.io7m.stmp</groupId>
        <artifactId>string-template-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>generate-version</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>renderTemplate</goal>
            </goals>
            <configuration>
              <template>
                <inputFile>src/main/string-template/MVersion.st</inputFile>
                <name>MVersion</name>
                <outputFile>
                  ${project.build.directory}/generated-sources/string-template/com/io7m/montarre/cmdline/MVersion.java
                </outputFile>
                <properties>
                  <appVersion>${project.version}</appVersion>
                  <appBuild>${buildNumber}</appBuild>
                </properties>
              </template>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>add-sources</id>
            <goals>
              <goal>add-source</goal>
            </goals>
            <phase>
              generate-sources
            </phase>
            <configuration>
              <sources>
                <source>
                  ${project.build.directory}/generated-sources/string-template
                </source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <executions>
          <execution>
            <id>onejar</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <minimizeJar>false</minimizeJar>
              <shadedClassifierName>main</shadedClassifierName>
              <shadedArtifactAttached>true</shadedArtifactAttached>
              <transformers>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                  <manifestEntries>
                    <Main-Class>com.io7m.montarre.cmdline.MMain</Main-Class>
                  </manifestEntries>
                </transformer>
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
              </transformers>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
