<?xml version="1.0"?>
<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>
    <!-- Not using metacard, as this is meant to be compilable with Java 1.8 as well -->
    <parent>
        <groupId>pro.javacard</groupId>
        <artifactId>ant-javacard-package</artifactId>
        <version>26.11.25</version>
    </parent>
    <artifactId>ant-javacard</artifactId>
    <description>Easy to use Ant task for building JavaCard applets</description>
    <name>ant-javacard task</name>
    <dependencies>
        <dependency>
            <groupId>org.apache.ant</groupId>
            <artifactId>ant</artifactId>
            <scope>provided</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>pro.javacard</groupId>
            <artifactId>capfile</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>pro.javacard</groupId>
            <artifactId>javacard-sdk</artifactId>
            <version>${project.version}</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-simple</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <!-- Converts the test applets for TestCAPMetadata -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>test-caps</id>
                        <phase>process-test-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <mkdir dir="${project.build.directory}/caps"/>
                                <taskdef name="javacard" classname="pro.javacard.ant.JavaCard" classpathref="maven.test.classpath"/>
                                <javacard jckit="${basedir}/../sdks/jc320v26.1_kit">
                                    <cap sources="${basedir}/../src/testapplets/empty" aid="010203040506" version="1.0"
                                         output="${project.build.directory}/caps/applet.cap">
                                        <applet class="testapplets.empty.Empty" aid="01020304050601"/>
                                    </cap>
                                    <!-- A library CAP verifies only against its own export file. -->
                                    <cap sources="${basedir}/../src/testapplets/library" package="testapplets.library"
                                         aid="010203040507" version="1.0" export="${project.build.directory}/exp"
                                         output="${project.build.directory}/caps/library.cap"/>
                                </javacard>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>pro.javacard.ant.DummyMain</mainClass>
                        </manifest>
                        <manifestEntries>
                            <Implementation-Version>${project.version}</Implementation-Version>
                        </manifestEntries>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
