Files
aliro-project/applet/pom.xml
michael 7574fc660e build: add j3r452-only src/main/java-amdh source root
Empty for now; Epic 3 fills it with OnUpgradeListener bridge classes.
2026-05-26 14:08:45 -07:00

195 lines
8.7 KiB
XML

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0">
<modelVersion>4.0.0</modelVersion>
<groupId>com.dangerousthings.aliro</groupId>
<artifactId>aliro-applet</artifactId>
<version>0.1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<description>
Java Card applet implementing the CSA Aliro v1.0 User Device role over NFC.
Built and tested inside the vivokey/smartcard-ci Docker image; see scripts/dt-mvn.sh.
</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- JC 3.0.5 converter supports up to 1.7 bytecode (v51.0). Source
stays at 1.7 to match. Test classes can be compiled at 1.8 via
the test compiler config below — they don't go through the JC
converter and the image's javac handles either version. -->
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<junit.jupiter.version>5.10.2</junit.jupiter.version>
</properties>
<dependencies>
<!--
jcardsim is pre-built into the smartcard-ci image's local m2 repo
(see https://github.com/DangerousThings/smartcard-ci Dockerfile).
No jitpack / central resolution needed.
-->
<dependency>
<groupId>com.licel</groupId>
<artifactId>jcardsim</artifactId>
<version>3.0.5-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>${junit.jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<repositories>
<!-- ant-javacard's recent releases are published via jitpack rather
than Maven Central; the Central artifact is stuck on 2019. -->
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</pluginRepository>
</pluginRepositories>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<configuration>
<!-- Main: 1.7 bytecode for the JC 3.0.5 converter. -->
<source>1.7</source>
<target>1.7</target>
<!-- Tests: JUnit 5 + our helpers use 1.8 features. They
don't go through the JC converter. -->
<testSource>1.8</testSource>
<testTarget>1.8</testTarget>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
</plugin>
<!--
Builds the Java Card CAP file via ant-javacard, which wraps
Oracle's converter from the JC SDK pinned by JC_CLASSIC_HOME
(the dt-mvn.sh wrapper sets this to /app/sdks/jc305u3_kit).
Output: target/aliro-applet-${cap.variant}.cap (j3r180 default; -Pj3r452 for AMD-H variant)
Package AID: A0 00 00 09 09 44 54 41 4C 49 52 4F (CSA RID + "DTALIRO")
Applet AIDs:
AliroApplet A0 00 00 09 09 AC CE 55 01 (Aliro EXPEDITED, spec)
StepUpApplet A0 00 00 09 09 AC CE 55 02 (Aliro STEP_UP, spec)
PersonalizationApplet A0 00 00 09 09 AC CE 55 99 01 (DT-internal, CSA-RID-namespaced)
JavaCard requires all applet AIDs in a CAP to share the
package's RID (first 5 bytes); using the CSA RID throughout
lets the three applets ship in one CAP.
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<id>build-cap</id>
<phase>package</phase>
<goals><goal>run</goal></goals>
<configuration>
<target>
<taskdef name="javacard"
classname="pro.javacard.ant.JavaCard"
classpathref="maven.plugin.classpath"/>
<javacard jckit="${env.JC_CLASSIC_HOME}">
<cap output="${project.build.directory}/${cap.output.name}"
aid="${cap.elf.aid}"
package="com.dangerousthings.aliro"
version="0.1"
classes="${project.build.outputDirectory}">
<applet class="com.dangerousthings.aliro.AliroApplet"
aid="A000000909ACCE5501"/>
<applet class="com.dangerousthings.aliro.StepUpApplet"
aid="A000000909ACCE5502"/>
<applet class="com.dangerousthings.aliro.PersonalizationApplet"
aid="A000000909ACCE559901"/>
</cap>
</javacard>
</target>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.github.martinpaljak</groupId>
<artifactId>ant-javacard</artifactId>
<version>v26.02.22</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<!-- Mutually exclusive with j3r452. Activate exactly one. -->
<id>j3r180</id>
<activation><activeByDefault>true</activeByDefault></activation>
<properties>
<!-- cap.variant: consumed by later tasks (CI matrix, profile-conditional source roots). -->
<cap.variant>j3r180</cap.variant>
<cap.elf.aid>A0000009094454414C49524F</cap.elf.aid>
<cap.output.name>aliro-applet-j3r180.cap</cap.output.name>
</properties>
</profile>
<profile>
<!-- Mutually exclusive with j3r180. Activate exactly one. -->
<id>j3r452</id>
<properties>
<cap.variant>j3r452</cap.variant>
<!-- Last byte differs so both CAPs can coexist on the same card during testing. -->
<cap.elf.aid>A0000009094454414C49524F02</cap.elf.aid>
<cap.output.name>aliro-applet-j3r452.cap</cap.output.name>
</properties>
<build>
<plugins>
<!--
AMD-H bridge classes (e.g. OnUpgradeListener implementations) live
under src/main/java-amdh and are only compiled into the j3r452 CAP.
Keeping them out of the j3r180 source set prevents org.globalplatform.upgrade
imports from leaking into the J3R180 build, which lacks the AMD-H API.
-->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.6.0</version>
<executions>
<execution>
<id>add-amdh-sources</id>
<phase>generate-sources</phase>
<goals><goal>add-source</goal></goals>
<configuration>
<sources><source>src/main/java-amdh</source></sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>