<?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>ikanos-parent</artifactId>
    <groupId>io.ikanos</groupId>
    <version>1.0.0-alpha4</version>
  </parent>
  <modelVersion>4.0.0</modelVersion>
  <artifactId>ikanos-cli</artifactId>
  <name>Ikanos CLI</name>
  <version>1.0.0-alpha4</version>
  <description>Picocli-based CLI tooling (ikanos create, validate, serve, import, export, health, status, traces, metrics, scripting). Houses the shade plugin and native-image config.</description>
  <licenses>
    <license>
      <name>Apache License, Version 2.0</name>
      <url>https://opensource.org/license/apache-2-0/</url>
      <distribution>repo</distribution>
    </license>
  </licenses>
  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <annotationProcessorPaths>
            <path>
              <groupId>info.picocli</groupId>
              <artifactId>picocli-codegen</artifactId>
              <version>4.7.6</version>
            </path>
          </annotationProcessorPaths>
          <compilerArgs>
            <arg>-Aproject=${project.groupId}/${project.artifactId}</arg>
          </compilerArgs>
        </configuration>
      </plugin>
      <plugin>
        <artifactId>maven-surefire-plugin</artifactId>
      </plugin>
      <plugin>
        <groupId>org.jacoco</groupId>
        <artifactId>jacoco-maven-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-source-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-javadoc-plugin</artifactId>
      </plugin>
      <plugin>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.5.1</version>
        <executions>
          <execution>
            <id>cli</id>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <outputFile>${project.build.directory}/ikanos.jar</outputFile>
              <transformers>
                <transformer>
                  <mainClass>io.ikanos.Cli</mainClass>
                </transformer>
                <transformer />
              </transformers>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <artifactSet>
                <excludes>
                  <exclude>org.graalvm.truffle:*</exclude>
                  <exclude>org.graalvm.polyglot:polyglot</exclude>
                  <exclude>org.graalvm.polyglot:js*</exclude>
                  <exclude>org.graalvm.polyglot:python*</exclude>
                  <exclude>org.graalvm.js:*</exclude>
                  <exclude>org.graalvm.python:*</exclude>
                  <exclude>org.graalvm.regex:*</exclude>
                  <exclude>org.graalvm.shadowed:*</exclude>
                  <exclude>org.graalvm.tools:*</exclude>
                  <exclude>org.graalvm.llvm:*</exclude>
                  <exclude>org.graalvm.sdk:*</exclude>
                  <exclude>org.apache.groovy:*</exclude>
                  <exclude>org.eclipse.jetty:jetty-slf4j-impl</exclude>
                </excludes>
              </artifactSet>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <id>native</id>
      <build>
        <plugins>
          <plugin>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.5.1</version>
            <executions>
              <execution>
                <id>cli-native</id>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <outputFile>${project.build.directory}/cli-native.jar</outputFile>
                  <transformers>
                    <transformer>
                      <mainClass>io.ikanos.Cli</mainClass>
                    </transformer>
                    <transformer />
                  </transformers>
                  <filters>
                    <filter>
                      <artifact>*:*</artifact>
                      <excludes>
                        <exclude>META-INF/*.SF</exclude>
                        <exclude>META-INF/*.DSA</exclude>
                        <exclude>META-INF/*.RSA</exclude>
                      </excludes>
                    </filter>
                  </filters>
                  <artifactSet>
                    <excludes>
                      <exclude>org.graalvm.truffle:*</exclude>
                      <exclude>org.graalvm.polyglot:polyglot</exclude>
                      <exclude>org.graalvm.polyglot:js*</exclude>
                      <exclude>org.graalvm.polyglot:python*</exclude>
                      <exclude>org.graalvm.js:*</exclude>
                      <exclude>org.graalvm.python:*</exclude>
                      <exclude>org.graalvm.regex:*</exclude>
                      <exclude>org.graalvm.shadowed:*</exclude>
                      <exclude>org.graalvm.tools:*</exclude>
                      <exclude>org.graalvm.llvm:*</exclude>
                      <exclude>org.graalvm.sdk:*</exclude>
                      <exclude>org.apache.groovy:*</exclude>
                      <exclude>org.eclipse.jetty:jetty-slf4j-impl</exclude>
                    </excludes>
                  </artifactSet>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.graalvm.buildtools</groupId>
            <artifactId>native-maven-plugin</artifactId>
            <version>0.10.3</version>
            <executions>
              <execution>
                <id>build-cli-native</id>
                <phase>package</phase>
                <goals>
                  <goal>compile-no-fork</goal>
                </goals>
                <configuration>
                  <mainClass>io.ikanos.Cli</mainClass>
                  <imageName>ikanos-cli</imageName>
                  <classpath>
                    <param>${project.build.directory}/cli-native.jar</param>
                  </classpath>
                  <buildArgs>
                    <buildArg>-H:+ReportExceptionStackTraces</buildArg>
                    <buildArg>--enable-url-protocols=https</buildArg>
                  </buildArgs>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
  <dependencies>
    <dependency>
      <groupId>info.picocli</groupId>
      <artifactId>picocli-codegen</artifactId>
      <version>4.7.6</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.junit.jupiter</groupId>
      <artifactId>junit-jupiter</artifactId>
      <version>5.12.2</version>
      <scope>test</scope>
      <exclusions>
        <exclusion>
          <artifactId>junit-jupiter-api</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-jupiter-params</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
        <exclusion>
          <artifactId>junit-jupiter-engine</artifactId>
          <groupId>org.junit.jupiter</groupId>
        </exclusion>
      </exclusions>
    </dependency>
  </dependencies>
</project>
