<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>
	<parent>
		<artifactId>pdf-over</artifactId>
		<groupId>at.a-sit</groupId>
		<version>4.1.2-SNAPSHOT</version>
		<relativePath>..</relativePath>
	</parent>
	<artifactId>pdf-over-gui</artifactId>
	<name>PDF-Over GUI</name>

	<dependencies>
		<dependency>
			<groupId>org.eclipse.swt</groupId>
			<artifactId>${swt.artifactId}</artifactId>
			<version>${swt.version}</version>
		</dependency>
		<dependency>
			<groupId>org.codehaus.izpack</groupId>
			<artifactId>izpack-standalone-compiler</artifactId>
			<version>${izpack-standalone.version}</version>
			<optional>true</optional>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-log4j12</artifactId>
		</dependency>
		<dependency>
			<groupId>at.a-sit</groupId>
			<artifactId>pdf-over-signator</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
		<dependency>
			<groupId>at.a-sit</groupId>
			<artifactId>pdf-over-sigpdfas4</artifactId>
			<version>${project.parent.version}</version>
		</dependency>
		<dependency>
			<groupId>commons-httpclient</groupId>
			<artifactId>commons-httpclient</artifactId>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
		</dependency>
		<dependency>
			<groupId>com.sun</groupId>
			<artifactId>pdfview</artifactId>
		</dependency>
		<dependency>
			<groupId>org.jpedal</groupId>
			<artifactId>jbig2</artifactId>
		</dependency>
	</dependencies>

	<build>
		<pluginManagement>
			<plugins>
				<!-- Ignore/Execute plugin execution -->
				<plugin>
					<groupId>org.eclipse.m2e</groupId>
					<artifactId>lifecycle-mapping</artifactId>
					<version>1.0.0</version>
					<configuration>
						<lifecycleMappingMetadata>
							<pluginExecutions>
								<!-- copy-dependency plugin -->
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>org.apache.maven.plugins</groupId>
										<artifactId>maven-dependency-plugin</artifactId>
										<versionRange>[1.0.0,)</versionRange>
										<goals>
											<goal>copy-dependencies</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore />
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>2.2</version>
				<configuration>
					<descriptorRefs>
						<descriptorRef>jar</descriptorRef>
					</descriptorRefs>
					<archive>
						<manifest>
							<addClasspath>true</addClasspath>
							<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
							<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
							<classpathPrefix />
							<mainClass>at.asit.pdfover.gui.Main</mainClass>
						</manifest>
					</archive>
					<outputDirectory>${staging.dir}/lib</outputDirectory>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-dependency-plugin</artifactId>
				<executions>
					<execution>
						<!-- copy product jars to izpack staging lib -->
						<id>copy-product-dependencies</id>
						<phase>package</phase>
						<goals>
							<goal>copy-dependencies</goal>
						</goals>
						<configuration>
							<outputDirectory>${staging.dir}/lib</outputDirectory>
							<excludeTransitive>false</excludeTransitive>
							<stripVersion>false</stripVersion>
							<overWriteReleases>true</overWriteReleases>
							<overWriteSnapshots>true</overWriteSnapshots>
							<overWriteIfNewer>true</overWriteIfNewer>
							<excludeScope>system</excludeScope> <!-- this excludes tools.jar, e.g. -->
							<excludeGroupIds>org.codehaus.izpack,org.eclipse.swt</excludeGroupIds>
						</configuration>
					</execution>
					<execution>
						<!-- copy os-specific swt jars to izpack staging dir -->
						<id>copy</id>
						<phase>package</phase>
						<goals>
							<goal>copy</goal>
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>org.eclipse.swt</groupId>
									<artifactId>${swt.artifactId.32}</artifactId>
									<version>${swt.version}</version>
									<type>jar</type>
									<overWrite>true</overWrite>
									<outputDirectory>${staging.dir}/lib-swt</outputDirectory>
									<destFileName>swt-${target.name}-32.jar</destFileName>
								</artifactItem>
								<artifactItem>
									<groupId>org.eclipse.swt</groupId>
									<artifactId>${swt.artifactId.64}</artifactId>
									<version>${swt.version}</version>
									<type>jar</type>
									<overWrite>true</overWrite>
									<outputDirectory>${staging.dir}/lib-swt</outputDirectory>
									<destFileName>swt-${target.name}-64.jar</destFileName>
								</artifactItem>
							</artifactItems>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>exec-maven-plugin</artifactId>
				<version>1.2.1</version>
				<executions>
					<execution>
						<phase>install</phase>
						<goals>
							<goal>exec</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<!-- Add custom manifest entries to izpack installer jar -->
					<executable>jar</executable>
					<workingDirectory>${staging.dir}</workingDirectory>
					<arguments>
						<argument>-ufm</argument>
						<argument>setup.jar</argument>
						<argument>ManifestEntries.mf</argument>
					</arguments>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jarsigner-plugin</artifactId>
				<version>1.2</version>
				<executions>
					<execution>
						<id>sign</id>
						<phase>install</phase>
						<goals>
							<goal>sign</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<archiveDirectory>${staging.dir}</archiveDirectory>
					<includes>
						<include>*.jar</include>
					</includes>
					<verify>true</verify>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.codehaus.groovy.maven</groupId>
				<artifactId>gmaven-plugin</artifactId>
				<version>1.0</version>
				<executions>
					<execution>
						<phase>package</phase>
						<goals>
							<goal>execute</goal>
						</goals>
						<configuration>
							<source>
								project.properties["version.exe"] = project.version.split("-")[0] + ".0";
							</source>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-resources-plugin</artifactId>
				<version>2.4.2</version>
				<executions>
					<execution>
						<id>copy-resources</id>
						<phase>validate</phase>
						<goals>
							<goal>copy-resources</goal>
						</goals>
						<configuration>
							<encoding>UTF-8</encoding>
							<outputDirectory>${staging.dir}</outputDirectory>
							<resources>
								<resource>
									<directory>src/main/resources</directory>
									<includes>
										<include>icons/*</include>
										<include>scripts/*</include>
										<include>ReadMe.txt</include>
									</includes>
								</resource>
								<resource>
									<directory>src/main/resources/izpack</directory>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>com.akathist.maven.plugins.launch4j</groupId>
				<artifactId>launch4j-maven-plugin</artifactId>
				<version>1.5.2</version>
				<executions>
					<execution>
						<id>l4j-gui</id>
						<phase>package</phase>
						<goals>
							<goal>launch4j</goal>
						</goals>
						<configuration>
							<headerType>gui</headerType>
							<dontWrapJar>true</dontWrapJar>
							<jar>lib/${artifactId}-${version}.jar</jar>
							<outfile>${staging.dir}/PDF-Over.exe</outfile>
							<errTitle>Error</errTitle>
							<classPath>
								<mainClass>at.asit.pdfover.gui.Main</mainClass>
								<jarLocation>lib/</jarLocation>
							</classPath>
							<chdir>.</chdir>
							<icon>src/main/resources/icons/icon.ico</icon>
							<jre>
								<minVersion>1.6.0</minVersion>
							</jre>
							<versionInfo>
								<fileVersion>${version.exe}</fileVersion>
								<txtFileVersion>${version}</txtFileVersion>
								<fileDescription>PDF-Over PDF signer</fileDescription>
								<copyright>(C) 2012 A-SIT</copyright>
								<productVersion>${version.exe}</productVersion>
								<txtProductVersion>${version}</txtProductVersion>
								<productName>PDF-Over</productName>
								<internalName>PDF-Over</internalName>
								<originalFilename>PDF-Over.exe</originalFilename>
							</versionInfo>
						</configuration>
					</execution>
					<execution>
						<id>l4j-cli</id>
						<phase>package</phase>
						<goals>
							<goal>launch4j</goal>
						</goals>
						<configuration>
							<headerType>console</headerType>
							<dontWrapJar>true</dontWrapJar>
							<jar>lib/${artifactId}-${version}.jar</jar>
							<outfile>${staging.dir}/PDF-Over-cli.exe</outfile>
							<errTitle>Error</errTitle>
							<classPath>
								<mainClass>at.asit.pdfover.gui.Main</mainClass>
								<jarLocation>lib/</jarLocation>
							</classPath>
							<chdir>.</chdir>
							<icon>src/main/resources/icons/icon.ico</icon>
							<jre>
								<minVersion>1.6.0</minVersion>
							</jre>
							<versionInfo>
								<fileVersion>${version.exe}</fileVersion>
								<txtFileVersion>${version}</txtFileVersion>
								<fileDescription>PDF-Over PDF signer CLI</fileDescription>
								<copyright>(C) 2012 A-SIT</copyright>
								<productVersion>${version.exe}</productVersion>
								<txtProductVersion>${version}</txtProductVersion>
								<productName>PDF-Over</productName>
								<internalName>PDF-Over-cli</internalName>
								<originalFilename>PDF-Over-cli.exe</originalFilename>
							</versionInfo>
						</configuration>
					</execution>
					<execution>
						<id>l4j-uninst</id>
						<phase>package</phase>
						<goals>
							<goal>launch4j</goal>
						</goals>
						<configuration>
							<headerType>gui</headerType>
							<dontWrapJar>true</dontWrapJar>
							<jar>uninstaller.jar</jar>
							<outfile>${staging.dir}/Uninstaller.exe</outfile>
							<errTitle>Error</errTitle>
							<classPath>
								<mainClass>com.izforge.izpack.uninstaller.Uninstaller</mainClass>
								<addDependencies>false</addDependencies>
								<preCp>uninstaller.jar</preCp>
							</classPath>
							<chdir>.</chdir>
							<icon>src/main/resources/icons/icon.ico</icon>
							<jre>
								<minVersion>1.6.0</minVersion>
							</jre>
							<versionInfo>
								<fileVersion>${version.exe}</fileVersion>
								<txtFileVersion>${version}</txtFileVersion>
								<fileDescription>PDF-Over Uninstaller</fileDescription>
								<copyright>A-SIT (Secure Information Technology Center - Austria)</copyright>
								<productVersion>${version.exe}</productVersion>
								<txtProductVersion>${version}</txtProductVersion>
								<productName>PDF-Over</productName>
								<internalName>Uninstaller</internalName>
								<originalFilename>Uninstaller.exe</originalFilename>
							</versionInfo>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.codehaus.izpack</groupId>
				<artifactId>izpack-maven-plugin</artifactId>
				<version>1.0-alpha-5</version>
				<dependencies>
					<dependency>
						<groupId>org.codehaus.izpack</groupId>
						<artifactId>izpack-standalone-compiler</artifactId>
						<version>${izpack-standalone.version}</version>
					</dependency>
				</dependencies>
				<configuration>
					<izpackBasedir>${staging.dir}</izpackBasedir>
					<installerFile>${staging.dir}/setup.jar</installerFile>
					<attach>false</attach>
				</configuration>
				<executions>
					<execution>
						<id>standard-installer</id>
						<phase>package</phase>
						<goals>
							<goal>izpack</goal>
						</goals>
					</execution>
				</executions>
			</plugin>
		</plugins>

		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<excludes>
					<exclude>izpack/*</exclude>
					<exclude>scripts/*</exclude>
					<exclude>ReadMe.txt</exclude>
					<exclude>keystore.jks</exclude>
				</excludes>
			</resource>
		</resources>
	</build>

	<properties>
		<izpack-standalone.version>4.3.5</izpack-standalone.version>
		<project.maindir>${project.basedir}/..</project.maindir>
		<target.name>linux</target.name>
		<staging.dir>${project.build.directory}/staging/${target.name}</staging.dir>
		<swt.version>4.3</swt.version>
	</properties>

	<profiles>
		<!--
			Note: Build system profile has to come first!
			Else it overwrites the chosen profile
		 -->
		<profile>
			<id>linux-64</id>
			<activation>
				<os>
					<name>linux</name>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.gtk.linux.x86</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.64}</swt.artifactId>
				<target.name>linux</target.name>
			</properties>
		</profile>
		<profile>
			<id>linux</id>
			<activation>
				<os>
					<name>linux</name>
					<arch>x86</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.gtk.linux.x86</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.gtk.linux.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.32}</swt.artifactId>
				<target.name>linux</target.name>
			</properties>
		</profile>

		<profile>
			<id>windows</id>
			<activation>
				<os>
					<family>windows</family>
					<arch>x86</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.win32.win32.x86</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.win32.win32.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.32}</swt.artifactId>
				<target.name>windows</target.name>
			</properties>
		</profile>
		<profile>
			<id>windows-64</id>
			<activation>
				<os>
					<family>windows</family>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.win32.win32.x86</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.win32.win32.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.64}</swt.artifactId>
				<target.name>windows</target.name>
			</properties>
		</profile>

		<profile>
			<id>mac</id>
			<activation>
				<os>
					<name>mac os x</name>
					<arch>x86</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.32}</swt.artifactId>
				<target.name>mac</target.name>
			</properties>
		</profile>
		<profile>
			<id>mac-2</id>
			<activation>
				<os>
					<name>mac os x</name>
					<arch>i386</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.32}</swt.artifactId>
				<target.name>mac</target.name>
			</properties>
		</profile>
		<profile>
			<id>mac-64</id>
			<activation>
				<os>
					<name>mac os x</name>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.64}</swt.artifactId>
				<target.name>mac</target.name>
			</properties>
		</profile>
		<profile>
			<id>mac-64-2</id>
			<activation>
				<os>
					<name>mac os x</name>
					<arch>x86_64</arch>
				</os>
			</activation>
			<properties>
				<swt.artifactId.32>org.eclipse.swt.cocoa.macosx</swt.artifactId.32>
				<swt.artifactId.64>org.eclipse.swt.cocoa.macosx.x86_64</swt.artifactId.64>
				<swt.artifactId>${swt.artifactId.64}</swt.artifactId>
				<target.name>mac</target.name>
			</properties>
		</profile>

		<profile>
			<id>dummy-sign</id>
			<!-- Standard profile - sign using a dummy cert -->
			<activation>
				<property>
					<!-- Simple hack to deactivate this profile when using pkcs11-sign -->
					<name>!pkcs11-pass</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jarsigner-plugin</artifactId>
						<version>1.2</version>
						<configuration>
							<keystore>src/main/resources/keystore.jks</keystore>
							<alias>test-applet signer</alias>
							<storepass>storepass</storepass>
							<keypass>keypass</keypass>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>pkcs11-sign</id>
			<!-- Activate this profile to sign the package using the secure token -->
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jarsigner-plugin</artifactId>
						<version>1.2</version>
						<configuration>
							<keystore>NONE</keystore>
							<storetype>PKCS11</storetype>
							<providerClass>iaik.pkcs.pkcs11.provider.IAIKPkcs11</providerClass>
							<alias>a-sit-2</alias>
							<storepass>${pkcs11-pass}</storepass>
							<keystoreConfig>
								<delete>false</delete>
								<gen>false</gen>
							</keystoreConfig>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>ks-sign</id>
			<!-- Activate this profile to sign the package using a java keystore -->
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jarsigner-plugin</artifactId>
						<version>1.2</version>
						<configuration>
							<keystore>${ks-file}</keystore>
							<alias>a-sit-3</alias>
							<storepass>${ks-pass}</storepass>
							<keypass>${ks-pass}</keypass>
							<keystoreConfig>
								<delete>false</delete>
								<gen>false</gen>
							</keystoreConfig>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

	<repositories>
		<repository>
			<id>swt-repo</id>
			<url>https://swt-repo.googlecode.com/svn/repo/</url>
		</repository>
	</repositories>
</project>