<?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/xsd/maven-4.0.0.xsd">

    <parent>
        <groupId>com.codenameone</groupId>
        <artifactId>codenameone</artifactId>
        <version>7.0.247</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>codenameone-javase</artifactId>
    <version>7.0.247</version>
    <packaging>jar</packaging>
    <description>JavaSE port for Codename One</description>
    <name>codenameone-javase</name>
    <url>https://www.codenameone.com</url>

    <licenses>
        <license>
            <name>GPL v2 With Classpath Exception</name>
            <url>https://openjdk.java.net/legal/gplv2+ce.html</url>
            <distribution>repo</distribution>
            <comments>A business-friendly OSS license</comments>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>shai</id>
            <name>Shai Almog</name>
            <email>shai.almog@codenameone.com</email>
            <timezone>+4</timezone>
        </developer>
        <developer>
            <id>chen</id>
            <name>Chen Fishbein</name>
            <email>chen.fishbein@codenameone.com</email>
            <timezone>+4</timezone>
        </developer>
        <developer>
            <id>shannah</id>
            <name>Steve Hannah</name>
            <email>steve.hannah@codenameone.com</email>
            <timezone>-8</timezone>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/codenameone/CodenameOne</url>
        <connection>scm:git:git@github.com:codenameone/CodenameOne.git</connection>
    </scm>
    <profiles>
        <profile>
            <id>local-dev-javase</id>
            <!--
              Activate whenever cn1.binaries is in play, mirroring the
              maven/android compile-android profile. The old activation only
              fired on -Dcodename1.platform=javase, which scripts/setup-workspace.sh
              passes to its first mvn invocation but not to the second (the
              codenameone-maven-plugin -am build). That second pass would then
              rebuild javase without jcef / jfxrt on the classpath and break on
              the simulator's CEF / JavaFX sources whenever any earlier change
              tripped incremental compilation into a full rebuild, e.g. the
              new com/codename1/testing/junit/ sources in this PR.
            -->
            <activation>
                <file><exists>${cn1.binaries}</exists></file>
                <property><name>cn1.binaries</name></property>
            </activation>
            <dependencies>
                <dependency>
                    <groupId>com.codenameone</groupId>
                    <artifactId>jfxrt</artifactId>
                    <version>8</version>
                    <scope>system</scope>
                    <systemPath>${cn1.binaries}/jfxrt.jar</systemPath>
                    <optional>true</optional>
                </dependency>
                <dependency>
                    <groupId>com.codenameone</groupId>
                    <artifactId>jcef</artifactId>
                    <version>6.0.0</version>
                    <scope>system</scope>
                    <systemPath>${cn1.binaries}/javase/jcef.jar</systemPath>
                    <optional>true</optional>
                </dependency>
            </dependencies>
        </profile>
    </profiles>

    <dependencies>
        <dependency>
            <groupId>com.codenameone</groupId>
            <artifactId>codenameone-core</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.codenameone</groupId>
            <artifactId>sqlite-jdbc</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.jhlabs</groupId>
            <artifactId>filters</artifactId>
            <version>2.0.235-1</version>
        </dependency>
        <dependency>
            <groupId>javax.media</groupId>
            <artifactId>jmf</artifactId>
            <version>2.1.1e</version>
            <scope>provided</scope>
        </dependency>
        <!-- JUnit Jupiter is "provided" so com.codename1.testing.junit.*
             support classes compile against it, but downstream apps must
             add their own JUnit dependency in test scope. This keeps the
             simulator's runtime classpath free of JUnit for apps that
             don't write JUnit tests. -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.source>1.7</maven.compiler.source>
        <maven.compiler.target>1.7</maven.compiler.target>
        <src.dir>../../Ports/JavaSE/src</src.dir>

    </properties>
    <build>
        <sourceDirectory>${src.dir}</sourceDirectory>
        <resources>
            <resource>
                <directory>${src.dir}</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>build-skins</id>
                        <phase>process-resources</phase>
                        <configuration>
                            <target>
                                <echo>Installing iPhoneX.skin</echo>
                                <mkdir dir="${project.build.directory}/skins"/>
                                <get src="https://github.com/codenameone/codenameone-skins/archive/master.zip" dest="${project.build.directory}/skins/master.zip" skipexisting="true"/>
                                <unzip src="${project.build.directory}/skins/master.zip" dest="${project.build.directory}/skins"/>
                                <move file="${project.build.directory}/skins/codenameone-skins-master" tofile="${project.build.directory}/skins/codenameone-skins" />
                                <ant dir="${project.build.directory}/skins/codenameone-skins" inheritAll="false" useNativeBasedir="true">
                                    <property name="cn1.path" location="${project.basedir}/../.."/>
                                </ant>
                                <copy file="${project.build.directory}/skins/codenameone-skins/OTA/iPhoneX.skin" todir="${project.build.outputDirectory}"/>
                                <!-- Bundle every shipped native theme into the
                                     simulator fat jar so JavaSEPort.loadSkinFile can
                                     load the right .res based on the current skin's
                                     platformName (or the Simulator "Native Theme"
                                     menu override). All .res files are committed
                                     under Themes/; the modern pair is regenerated
                                     by .github/workflows/native-themes-sync.yml. -->
                                <copy todir="${project.build.outputDirectory}">
                                    <fileset dir="${project.basedir}/../../Themes">
                                        <include name="iOSModernTheme.res"/>
                                        <include name="AndroidMaterialTheme.res"/>
                                        <include name="iPhoneTheme.res"/>
                                        <include name="iOS7Theme.res"/>
                                        <include name="androidTheme.res"/>
                                        <include name="android_holo_light.res"/>
                                    </fileset>
                                </copy>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.4.1</version>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>com.codename1.impl.javase.Simulator</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>