<?xml version="1.0" encoding="ISO-8859-1"?>
<project
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns="http://maven.apache.org/POM/4.0.0">
    <!-- @version $Revision: 1862 $ ($Author: vlads $) $Date: 2008-12-14 21:20:20 -0500 (Sun, 14 Dec 2008) $ -->
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.microemu</groupId>
        <artifactId>microemu</artifactId>
        <version>2.0.3</version><!--me-version-->
        <relativePath>../pom.xml</relativePath>
    </parent>

    <artifactId>microemulator</artifactId>
    <name>microemulator</name>
    <packaging>pom</packaging>

    <description>MicroEmulator one jar assembly for distribution</description>

    <dependencies>

        <dependency>
            <groupId>org.microemu</groupId>
            <artifactId>microemu-javase-swing</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>

        <!--
        <dependency>
            <groupId>org.microemu</groupId>
            <artifactId>microemu-javase-swt</artifactId>
            <version>${project.version}</version>
            <optional>true</optional>
        </dependency>
        -->

        <!-- Used for ready for applet Preprocessor should be only in pakaged jar -->
        <dependency>
            <groupId>org.microemu</groupId>
            <artifactId>microemu-injected</artifactId>
            <version>${project.version}</version>
            <classifier>inject</classifier>
            <optional>true</optional>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>jar-with-dependencies-fix-manifest</id>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <copy file="${basedir}/assembly.manifest" todir="${project.build.directory}" overwrite="true"/>
                                <tstamp><format property="TODAY" pattern="yyyy-MM-dd hh:mm:ss" /></tstamp>
                                <echo>pom.xml: timestamp ${TODAY}</echo>
                                <!-- Set build number -->
                                <replace dir="${project.build.directory}">
                                    <include name="assembly.manifest"/>
                                    <replacefilter token="#build#" value="${buildLabel}"/>
                                    <replacefilter token="#version#" value="${version}"/>
                                    <replacefilter token="#user.name#" value="${user.name}"/>
                                    <replacefilter token="#today#" value="${TODAY}"/>
                                    <replacefilter token="#scm.revision#" value="${scm.revision}"/>
                                </replace>
                            </tasks>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- app jar-with-dependencies -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>${assemblyPluginVersion}</version>
                <executions>
                    <execution>
                       <id>jar-with-dependencies</id>
                       <phase>package</phase>
                       <goals><goal>single</goal></goals>
                       <configuration>
                           <attach>true</attach>
                           <appendAssemblyId>false</appendAssemblyId>
                           <descriptors>
                               <descriptor>assembly-app.xml</descriptor>
                           </descriptors>
                           <archive>
                                <manifestFile>${project.build.directory}/assembly.manifest</manifestFile>
                                <!-- this does not work, if manifestFile is used -->
                                <manifest>
                                    <mainClass>org.microemu.app.Main</mainClass>
                                </manifest>
                                <!-- this does not work, bug http://jira.codehaus.org/browse/MASSEMBLY-188 -->
                                <manifestEntries>
                                    <Implementation-Version>${pom.version}</Implementation-Version>
                                    <Implementation-Build>${label}</Implementation-Build>
                                    <Build-Date>${cctimestamp}</Build-Date>
                                    <SVN-Revision>${scm.revision}</SVN-Revision>
                                    <License>GNU Lesser General Public License (LGPL)</License>
                                </manifestEntries>
                            </archive>
                       </configuration>
                    </execution>
               </executions>
            </plugin>

        </plugins>
    </build>

    <profiles>
        <profile>
            <id>build</id>

            <activation>
                <property>
                    <name>performRelease</name>
                    <value>true</value>
                </property>
            </activation>

            <build>
                <plugins>

                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>jar-files-corrections</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <copy overwrite="true"
                                            file="${basedir}/../microemu-examples/microemu-demo/target/microemu-demo-${project.version}-me.jad"
                                            tofile="${project.build.directory}/microemu-demo.jad"/>
                                        <replace value="microemu-demo.jar" token="microemu-demo-${project.version}-me.jar" dir="${project.build.directory}">
                                            <include name="microemu-demo.jad"></include>
                                        </replace>
                                    </tasks>
                                </configuration>
                            </execution>
                            <execution>
                                <id>copy-all-sources-4download</id>
                                <phase>site</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <tasks>
                                        <mkdir dir="${project.build.directory}/site/download"/>
                                        <copy overwrite="true"
                                            file="${project.build.directory}/${project.build.finalName}-sources.tar.gz"
                                            todir="${project.build.directory}/site/download"/>
                                        <copy overwrite="true"
                                            file="${project.build.directory}/${project.build.finalName}.tar.gz"
                                            todir="${project.build.directory}/site/download"/>
                                    </tasks>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>${assemblyPluginVersion}</version>
                        <executions>
                            <execution>
                                <id>sources-jar</id>
                                <phase>package</phase>
                                <goals><goal>single</goal></goals>
                                <configuration>
                                    <attach>true</attach>
                                    <descriptors>
                                        <descriptor>assembly-sources.xml</descriptor>
                                    </descriptors>
                                    <archive>
                                        <manifestEntries>
                                            <Version>${label}</Version>
                                            <Build-Time>${cctimestamp}</Build-Time>
                                            <Implementation-Version>${pom.version}</Implementation-Version>
                                            <SVN-Revision>${scm.revision}</SVN-Revision>
                                            <License>GNU Lesser General Public License (LGPL)</License>
                                        </manifestEntries>
                                    </archive>
                                </configuration>
                            </execution>
                            <execution>
                                <id>all-sources-gz</id>
                                <phase>install</phase>
                                <goals><goal>single</goal></goals>
                                <configuration>
                                    <attach>false</attach>
                                    <tarLongFileMode>gnu</tarLongFileMode>
                                    <descriptors>
                                        <descriptor>assembly-all-sources.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                            <execution>
                                <id>release-package-gz</id>
                                <phase>install</phase>
                                <goals><goal>single</goal></goals>
                                <configuration>
                                    <attach>false</attach>
                                    <appendAssemblyId>false</appendAssemblyId>
                                    <tarLongFileMode>gnu</tarLongFileMode>
                                    <descriptors>
                                        <descriptor>assembly-release.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

    </profiles>

</project>