<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<parent>
		<groupId>io.github.dfa1.vortex</groupId>
		<artifactId>vortex-java</artifactId>
		<version>0.7.2</version>
	</parent>

	<artifactId>vortex-cli</artifactId>

	<name>vortex-cli</name>
	<description>Command-line interface for the Vortex columnar file format.</description>

	<properties>
	</properties>

	<dependencies>
		<!-- production -->
		<dependency>
			<groupId>io.github.dfa1.vortex</groupId>
			<artifactId>vortex-csv</artifactId>
		</dependency>
		<dependency>
			<groupId>io.github.dfa1.vortex</groupId>
			<artifactId>vortex-parquet</artifactId>
		</dependency>
		<dependency>
			<groupId>io.github.dfa1.vortex</groupId>
			<artifactId>vortex-reader</artifactId>
		</dependency>
		<dependency>
			<groupId>io.github.dfa1.vortex</groupId>
			<artifactId>vortex-inspector</artifactId>
		</dependency>
		<dependency>
			<groupId>io.airlift</groupId>
			<artifactId>aircompressor-v3</artifactId>
		</dependency>
		<dependency>
			<!-- ImportCommand calls {@code options.writeOptions().allowedCascading()} via the
			     csv / parquet importers' API surface; that transitively reaches
			     {@link io.github.dfa1.vortex.writer.WriteOptions}. Required at compile scope
			     so the JaCoCo agent can instrument the call site (without it, build fails
			     under {@code -P coverage}). Test code also writes Vortex fixtures via
			     VortexWriter, so the same dependency covers both. -->
			<groupId>io.github.dfa1.vortex</groupId>
			<artifactId>vortex-writer</artifactId>
		</dependency>
		<!-- testing -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.assertj</groupId>
			<artifactId>assertj-core</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<configuration>
					<!-- {@code @{argLine}} expands to the JaCoCo agent args when the
					     {@code coverage} profile is active; empty default otherwise (set
					     in the root pom). Without it the agent never attaches and the
					     cli module reports 0% coverage. -->
					<argLine>@{argLine} --sun-misc-unsafe-memory-access=allow</argLine>
					<includes>
						<include>**/*Test.java</include>
						<include>**/*IT.java</include>
					</includes>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-shade-plugin</artifactId>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>shade</goal>
						</goals>
						<configuration>
							<shadedArtifactAttached>true</shadedArtifactAttached>
							<shadedClassifierName>all</shadedClassifierName>
							<createDependencyReducedPom>false</createDependencyReducedPom>
							<transformers>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheNoticeResourceTransformer">
									<projectName>vortex-cli</projectName>
								</transformer>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ApacheLicenseResourceTransformer" />
								<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
									<mainClass>io.github.dfa1.vortex.cli.VortexCli</mainClass>
									<manifestEntries>
										<!--
											Enables the FFM downcalls in inspector/term/PosixTerminal
											+ WindowsTerminal (tcgetattr, cfmakeraw, ioctl,
											SetConsoleMode) without the user having to pass the
											enable-native-access flag on the command line.
											Per JEP 472 (finalized in JDK 25), the JVM otherwise
											emits a "restricted method called" warning on each first
											call and threatens to block restricted methods entirely
											in a future release; this manifest attribute is the
											standard way for an uber-jar to opt in once at build
											time. Only the cli uber-jar gets this; vortex-core and
											vortex-reader consumers still have to enable native
											access themselves for their own integrations.
										-->
										<Enable-Native-Access>ALL-UNNAMED</Enable-Native-Access>
									</manifestEntries>
								</transformer>
								<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
							</transformers>
							<filters>
								<filter>
									<artifact>*:*</artifact>
									<excludes>
										<exclude>module-info.class</exclude>
										<exclude>META-INF/*.SF</exclude>
										<exclude>META-INF/*.DSA</exclude>
										<exclude>META-INF/*.RSA</exclude>
									</excludes>
								</filter>
							</filters>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
</project>
