<?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>
	<description>PDFsam App</description>
	<url>https://pdfsam.org</url>
	<parent>
		<groupId>org.pdfsam</groupId>
		<artifactId>pdfsam-parent</artifactId>
		<version>4.2.2</version>
		<relativePath>../pom.xml</relativePath>
	</parent>

	<artifactId>pdfsam-basic</artifactId>
	<packaging>jar</packaging>
	<name>PDFsam Basic Edition application</name>

	<issueManagement>
		<system>GitHub</system>
		<url>https://github.com/torakiki/pdfsam/issues</url>
	</issueManagement>

	<licenses>
		<license>
			<name>GNU Affero General Public License</name>
			<url>http://www.gnu.org/licenses/agpl-3.0.html</url>
			<distribution>repo</distribution>
			<comments>AGPLv3</comments>
		</license>
	</licenses>

	<profiles>
		<profile>
			<id>splash-non-mac</id>
			<activation>
				<os>
					<family>!mac</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<configuration>
							<archive>
								<manifest>
									<addClasspath>true</addClasspath>
									<classpathPrefix>lib/</classpathPrefix>
									<mainClass>
										org.pdfsam.basic.App
									</mainClass>
								</manifest>
								<manifestEntries>
									<Built-By>Andrea Vacondio</Built-By>
									<Automatic-Module-Name>org.pdfsam.basic</Automatic-Module-Name>
									<SplashScreen-Image>images/basic/splash.gif</SplashScreen-Image>
								</manifestEntries>
								<addMavenDescriptor>false</addMavenDescriptor>
							</archive>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>no-splash-on-mac</id>
			<activation>
				<os>
					<family>mac</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<configuration>
							<archive>
								<manifest>
									<addClasspath>true</addClasspath>
									<classpathPrefix>lib/</classpathPrefix>
									<mainClass>
										org.pdfsam.basic.App
									</mainClass>
								</manifest>
								<!-- see https://bugs.openjdk.java.net/browse/JDK-8166942 -->
								<manifestEntries>
									<Built-By>Andrea Vacondio</Built-By>
									<Automatic-Module-Name>org.pdfsam.basic</Automatic-Module-Name>
								</manifestEntries>
								<addMavenDescriptor>false</addMavenDescriptor>
							</archive>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>basic-release-non-mac</id>
			<activation>
				<property>
					<name>release</name>
				</property>
				<os>
					<family>!mac</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>parse-version</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>parse-version</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>jlink</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>jlink</executable>
									<arguments>
										<argument>--add-modules</argument>
										<argument>java.base,java.datatransfer,java.logging,java.naming,java.sql,java.desktop,java.xml,java.scripting,jdk.unsupported,java.prefs</argument>
										<argument>--output</argument>
										<argument>${project.build.directory}/assembled/runtime</argument>
										<argument>--compress</argument>
										<argument>2</argument>
										<argument>--no-header-files</argument>
										<argument>--no-man-pages</argument>
										<argument>--strip-debug</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-dependencies</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>copy-dependencies</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/assembled/lib</outputDirectory>
									<includeScope>compile</includeScope>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>basic-release-mac</id>
			<activation>
				<property>
					<name>release</name>
				</property>
				<os>
					<family>mac</family>
				</os>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>parse-version</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>parse-version</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<extensions>true</extensions>
						<executions>
							<execution>
								<id>jlink</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<longModulepath>false</longModulepath>
									<executable>jlink</executable>
									<arguments>
										<argument>--module-path</argument>
										<argument>${env.FX_HOME}:mods</argument>
										<argument>--add-modules</argument>
										<argument>java.base,java.datatransfer,java.logging,java.naming,java.sql,java.desktop,java.xml,java.scripting,jdk.unsupported,java.prefs,javafx.base,javafx.graphics,javafx.controls,javafx.media</argument>
										<argument>--output</argument>
										<argument>${project.build.directory}/assembled/runtime</argument>
										<argument>--compress</argument>
										<argument>2</argument>
										<argument>--no-header-files</argument>
										<argument>--no-man-pages</argument>
										<argument>--strip-debug</argument>
									</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-dependencies</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>copy-dependencies</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/assembled/lib</outputDirectory>
									<includeScope>compile</includeScope>
									<excludeGroupIds>org.openjfx</excludeGroupIds>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>basic-release-all</id>
			<activation>
				<property>
					<name>release</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-to-assembled</id>
								<phase>package</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/assembled</outputDirectory>
									<resources>
										<resource>
											<directory>${basedir}</directory>
											<includes>
												<include>
													LICENSE.txt
												</include>
											</includes>
										</resource>
										<resource>
											<directory>${basedir}/doc</directory>
											<targetPath>${project.build.directory}/assembled/doc</targetPath>
										</resource>
										<resource>
											<directory>${project.build.directory}</directory>
											<targetPath>${project.build.directory}/assembled</targetPath>
											<includes>
												<include>
													${project.build.finalName}.jar
												</include>
											</includes>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/assembled/bin</targetPath>
											<directory>${basedir}/src/assembly/resources/bin</directory>
											<filtering>true</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>fix-permissions</id>
								<phase>package</phase>
								<configuration>
									<target>
										<chmod file="${project.build.directory}/assembled/lib" perm="644" includes="**/*.*" />
										<chmod dir="${project.build.directory}/assembled/bin" perm="755" includes="**/*.sh" />
										<chmod dir="${project.build.directory}/assembled/runtime/bin" perm="755" includes="**/*.*" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>maven-assembly-plugin</artifactId>
						<executions>
							<execution>
								<id>pdfsam-assembly</id>
								<phase>package</phase>
								<goals>
									<goal>single</goal>
								</goals>
								<configuration>
									<finalName>pdfsam-${project.version}-${os.detected.name}</finalName>
									<appendAssemblyId>false</appendAssemblyId>
									<descriptors>
										<descriptor>src/assembly/portable.xml</descriptor>
									</descriptors>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>win</id>
			<activation>
				<os>
					<family>windows</family>
				</os>
				<property>
					<name>release</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>com.akathist.maven.plugins.launch4j</groupId>
						<artifactId>launch4j-maven-plugin</artifactId>
						<version>1.7.25</version>
						<executions>
							<execution>
								<id>exe-creation</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>launch4j</goal>
								</goals>
								<configuration>
									<headerType>gui</headerType>
									<outfile>${project.build.directory}/assembled/pdfsam.exe</outfile>
									<jar>${project.build.finalName}.jar</jar>
									<dontWrapJar>true</dontWrapJar>
									<icon>src/assembly/resources/pdfsam.ico</icon>
									<errTitle>Cannot find Java Runtime Environment</errTitle>
									<vars>
										<var>PATH=%EXEDIR%\runtime</var>
									</vars>
									<jre>
										<path>runtime</path>
										<minVersion>11</minVersion>
										<bundledJre64Bit>true</bundledJre64Bit>
									</jre>
									<versionInfo>
										<fileVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</fileVersion>
										<txtFileVersion>${project.version}</txtFileVersion>
										<fileDescription>PDFsam Basic</fileDescription>
										<copyright>Sober Lemur S.a.s di Vacondio Andrea</copyright>
										<companyName>Sober Lemur S.a.s di Vacondio Andrea</companyName>
										<productVersion>${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.0</productVersion>
										<txtProductVersion>${project.version}</txtProductVersion>
										<productName>PDF Split And Merge Basic Edition</productName>
										<internalName>PDFsam</internalName>
										<originalFilename>pdfsam.exe</originalFilename>
										<language>
											ENGLISH_US
										</language>
									</versionInfo>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-win-resources</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/assembled</outputDirectory>
									<resources>
										<resource>
											<directory>${basedir}/src/assembly/resources</directory>
											<includes>
												<include>
													pdfsam.l4j.ini
												</include>
											</includes>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/msi</targetPath>
											<directory>${basedir}/src/msi</directory>
											<filtering>true</filtering>
											<exclude>*.dll</exclude>
											<include>*.*</include>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/msi</targetPath>
											<directory>${basedir}/src/msi</directory>
											<include>*.dll</include>
										</resource>
										<resource>
											<targetPath>${project.build.directory}/msi/resources</targetPath>
											<directory>${basedir}/src/msi/resources</directory>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>package-msi</id>
								<phase>pre-integration-test</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>
										${project.build.directory}/msi/Build.cmd
									</executable>
								</configuration>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<!-- this is needed to create a detached signature of the artifact -->
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-msi</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<artifacts>
										<artifact>
											<file>${project.build.directory}/pdfsam-${parsedVersion.majorVersion}.${parsedVersion.minorVersion}.${parsedVersion.incrementalVersion}.msi</file>
											<type>msi</type>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>linux</id>
			<activation>
				<os>
					<family>linux</family>
				</os>
				<property>
					<name>release</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-assembly-plugin</artifactId>
						<executions>
							<execution>
								<id>pdfsam-assembly</id>
								<phase>package</phase>
								<configuration>
									<descriptors>
										<descriptor>src/assembly/portable-linux.xml</descriptor>
									</descriptors>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<artifactId>jdeb</artifactId>
						<groupId>org.vafer</groupId>
						<version>1.7</version>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>jdeb</goal>
								</goals>
								<configuration>
									<deb>[[buildDir]]/pdfsam_[[version]]-1_amd64.[[extension]]</deb>
									<dataSet>
										<data>
											<src>${project.build.directory}/assembled/bin/pdfsam.sh</src>
											<dst>pdfsam-basic</dst>
											<type>file</type>
											<mapper>
												<type>perm</type>
												<prefix>/opt/pdfsam-basic/bin</prefix>
												<filemode>755</filemode>
											</mapper>
										</data>
										<data>
											<src>${project.build.directory}/assembled</src>
											<type>directory</type>
											<excludes>pdfsam.exe,pdfsam.l4j.ini,bin/pdfsam.sh,bin/pdfsam.bat</excludes>
											<mapper>
												<type>perm</type>
												<prefix>/opt/pdfsam-basic</prefix>
												<filemode>644</filemode>
												<dirmode>755</dirmode>
											</mapper>
										</data>
										<data>
											<type>link</type>
											<linkName>/usr/bin/pdfsam</linkName>
											<linkTarget>/opt/pdfsam-basic/bin/pdfsam-basic</linkTarget>
											<symlink>true</symlink>
											<mapper>
												<type>perm</type>
												<filemode>755</filemode>
											</mapper>
										</data>
										<data>
											<src>${project.basedir}/src/deb/doc/changelog.Debian.gz</src>
											<dst>/usr/share/doc/pdfsam-basic/changelog.Debian.gz</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/doc/copyright</src>
											<dst>/usr/share/doc/pdfsam-basic/copyright</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/pdfsam-basic.desktop</src>
											<dst>/usr/share/applications/pdfsam-basic.desktop</dst>
											<type>file</type>
										</data>
										<data>
											<src>${project.basedir}/src/deb/icon.svg</src>
											<dst>/opt/pdfsam-basic/icon.svg</dst>
											<type>file</type>
										</data>
									</dataSet>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>mac</id>
			<activation>
				<os>
					<family>mac</family>
				</os>
				<property>
					<name>release</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-dmg-script</id>
								<phase>package</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/dmg</outputDirectory>
									<resources>
										<resource>
											<directory>${basedir}/src/dmg</directory>
											<filtering>true</filtering>
											<include>*.sh</include>
										</resource>
										<resource>
											<directory>${basedir}/src/dmg</directory>
											<includes>
												<include>*.icns</include>
												<include>*.plist</include>
												<include>**/*</include>
											</includes>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<executions>
							<execution>
								<id>fix-dmg-script-permissions</id>
								<phase>pre-integration-test</phase>
								<configuration>
									<target>
										<chmod dir="${project.build.directory}/dmg" perm="755" includes="*.sh" />
									</target>
								</configuration>
								<goals>
									<goal>run</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>package-dmg</id>
								<phase>integration-test</phase>
								<goals>
									<goal>exec</goal>
								</goals>
								<configuration>
									<executable>
										${project.build.directory}/dmg/package_dmg.sh
									</executable>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<!-- this is needed to create a detached signature of the artifact -->
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-dmg</id>
								<phase>post-integration-test</phase>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<artifacts>
										<artifact>
											<file>${project.build.directory}/pdfsam-${project.version}.dmg</file>
											<type>dmg</type>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<build>
		<extensions>
			<extension>
				<groupId>kr.motd.maven</groupId>
				<artifactId>os-maven-plugin</artifactId>
				<version>1.6.1</version>
			</extension>
		</extensions>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
				<includes>
					<include>**/*.properties</include>
				</includes>
			</resource>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>false</filtering>
				<excludes>
					<exclude>**/*.properties</exclude>
				</excludes>
			</resource>
		</resources>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
		</dependency>
		<dependency>
			<groupId>org.pdfsam</groupId>
			<artifactId>eventstudio</artifactId>
		</dependency>
		<dependency>
			<groupId>org.pdfsam</groupId>
			<artifactId>pdfsam-gui</artifactId>
			<version>${project.version}</version>
			<exclusions>
				<exclusion>
					<artifactId>commons-logging</artifactId>
					<groupId>commons-logging</groupId>
				</exclusion>
			</exclusions>
		</dependency>
		<dependency>
			<groupId>ch.qos.logback</groupId>
			<artifactId>logback-classic</artifactId>
			<version>${logback.version}</version>
		</dependency>
		<dependency>
			<groupId>org.pdfsam</groupId>
			<artifactId>pdfsam-injector</artifactId>
		</dependency>
		<dependency>
			<groupId>javax.inject</groupId>
			<artifactId>javax.inject</artifactId>
		</dependency>
		<!-- test dependencies -->
		<dependency>
			<groupId>jdepend</groupId>
			<artifactId>jdepend</artifactId>
			<scope>test</scope>
		</dependency>
	</dependencies>
</project>
