<?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">
	<modelVersion>4.0.0</modelVersion>

	<groupId>one.jpro.platform.jpms</groupId>
	<artifactId>${core.artifact.artifactId}</artifactId>
	<packaging>jar</packaging>
	<version>${core.artifact.version}-${core.artifact.release}</version>

	<name>JPro Platform CSSFX JPMS Module</name>
	<description>A modularized version of CSSFX, repackaged for use with the JPro platform, providing support for dynamic CSS reloading in JavaFX applications.</description>

	<properties>
		<!-- change release here-->
		<core.artifact.groupId>fr.brouillard.oss</core.artifact.groupId>
		<core.artifact.artifactId>cssfx</core.artifact.artifactId>
		<core.artifact.version>11.5.1</core.artifact.version>
		<core.artifact.release>jpms</core.artifact.release>

		<!-- Project Encoding -->
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.build.resourceEncoding>UTF-8</project.build.resourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

		<!-- transitive dependency versions -->
		<javafx-controls.version>17.0.12</javafx-controls.version>

		<maven-assembly-plugin.version>3.7.1</maven-assembly-plugin.version>
		<moditect-maven-plugin.version>1.2.2.Final</moditect-maven-plugin.version>
		<maven-antrun-plugin.version>3.1.0</maven-antrun-plugin.version>
		<build-helper-maven-plugin.version>3.6.0</build-helper-maven-plugin.version>
		<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
		<central-publishing-maven-plugin.version>0.6.0</central-publishing-maven-plugin.version>
	</properties>

	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<scm>
		<url>https://github.com/JPro-one/jpro-jpms-deps/tree/main/cssfx</url>
	</scm>

	<developers>
		<developer>
			<id>jpro</id>
			<name>JPro Team</name>
			<email>info@jpro.one</email>
		</developer>
	</developers>

	<issueManagement>
		<system>GitHub</system>
		<url>https://github.com/JPro-one/jpro-jpms-deps/issues</url>
	</issueManagement>

	<url>https://www.jpro.one/</url>

	<organization>
		<name>JPro-one</name>
		<url>https://www.jpro.one/</url>
	</organization>

	<!-- transitive dependencies of the repackaged artifact -->
	<dependencies>
		<dependency>
			<groupId>org.openjfx</groupId>
			<artifactId>javafx-controls</artifactId>
			<version>${javafx-controls.version}</version>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>${basedir}/</directory>
				<includes>
					<include>LICENSE.txt</include>
				</includes>
			</resource>
		</resources>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.moditect</groupId>
					<artifactId>moditect-maven-plugin</artifactId>
					<version>${moditect-maven-plugin.version}</version>
				</plugin>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-antrun-plugin</artifactId>
					<version>${maven-antrun-plugin.version}</version>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<id>sources</id>
						<goals>
							<goal>copy</goal>
						</goals>
						<phase>prepare-package</phase>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>${core.artifact.groupId}</groupId>
									<artifactId>${core.artifact.artifactId}</artifactId>
									<version>${core.artifact.version}</version>
									<classifier>sources</classifier>
								</artifactItem>
								<artifactItem>
									<groupId>${core.artifact.groupId}</groupId>
									<artifactId>${core.artifact.artifactId}</artifactId>
									<version>${core.artifact.version}</version>
									<classifier>javadoc</classifier>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>

			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>attach-artifacts</id>
						<phase>package</phase>
						<goals>
							<goal>attach-artifact</goal>
						</goals>
						<configuration>
							<artifacts>
								<artifact>
									<file>${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-sources.jar</file>
									<type>jar</type>
									<classifier>sources</classifier>
								</artifact>
								<artifact>
									<file>${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-javadoc.jar</file>
									<type>jar</type>
									<classifier>javadoc</classifier>
								</artifact>
							</artifacts>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.moditect</groupId>
				<artifactId>moditect-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-module-infos</id>
						<phase>prepare-package</phase>
						<goals>
							<goal>add-module-info</goal>
						</goals>
						<configuration>
							<outputDirectory>${project.build.directory}/moditect</outputDirectory>
							<overwriteExistingFiles>true</overwriteExistingFiles>
							<modules>
								<module>
									<artifact>
										<groupId>${core.artifact.groupId}</groupId>
										<artifactId>${core.artifact.artifactId}</artifactId>
										<version>${core.artifact.version}</version>
									</artifact>
									<moduleInfo>
										<name>fr.brouillard.oss.cssfx</name>
										<open>true</open>
										<requires>javafx.controls</requires>
										<exports>*;</exports>
									</moduleInfo>
								</module>
							</modules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-antrun-plugin</artifactId>
				<executions>
					<execution>
						<id>rename-sources</id>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<echo message="renaming sources file" />
								<copy file="${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-sources.jar"
									  tofile="${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-sources.jar" />
							</target>
						</configuration>
					</execution>
					<execution>
						<id>rename-javadoc</id>
						<phase>package</phase>
						<goals>
							<goal>run</goal>
						</goals>
						<configuration>
							<target>
								<echo message="renaming javadoc file" />
								<copy file="${project.build.directory}/dependency/${project.artifactId}-${core.artifact.version}-javadoc.jar"
									  tofile="${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-javadoc.jar" />
							</target>
						</configuration>
					</execution>
					<execution>
						<phase>prepare-package</phase>
						<configuration>
							<target>
								<echo message="unzipping files" />
								<unzip
									src="${project.build.directory}/moditect/${project.artifactId}-${core.artifact.version}.jar"
									dest="${project.build.directory}/classes/">
								</unzip>
							</target>
						</configuration>
						<goals>
							<goal>run</goal>
						</goals>
					</execution>
				</executions>
			</plugin>

			<!-- Deploy to Artifactory -->
			<plugin>
				<groupId>org.sonatype.central</groupId>
				<artifactId>central-publishing-maven-plugin</artifactId>
				<version>${central-publishing-maven-plugin.version}</version>
				<extensions>true</extensions>
				<configuration>
					<publishingServerId>jpro-central-repository</publishingServerId>
				</configuration>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>signArtifacts</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-artifacts</id>
								<phase>package</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<artifacts>
										<artifact>
											<file>${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-sources.jar</file>
											<type>jar</type>
											<classifier>sources</classifier>
										</artifact>
										<artifact>
											<file>${project.build.directory}/${project.artifactId}-${core.artifact.version}-${core.artifact.release}-javadoc.jar</file>
											<type>jar</type>
											<classifier>javadoc</classifier>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>${maven-gpg-plugin.version}</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
