<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>
    <artifactId>client</artifactId>

    <parent>
        <groupId>ctbrec</groupId>
        <artifactId>master</artifactId>
        <version>5.2.3</version>
        <relativePath>../master</relativePath>
    </parent>

    <properties>
        <name.final>${project.groupId}-${project.version}</name.final>
    </properties>

    <build>
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
            </resource>
            <resource>
                <directory>src/main/java</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*.css</include>
                </includes>
            </resource>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>version</include>
                </includes>
            </resource>
        </resources>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>ctbrec</groupId>
            <artifactId>common</artifactId>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-media</artifactId>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-swing</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>jetty-servlet</artifactId>
        </dependency>
    </dependencies>

    <profiles>
        <profile>
            <id>win</id>
            <activation>
                <property>
                    <name>javafx.platform</name>
                    <value>win</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.akathist.maven.plugins.launch4j</groupId>
                        <artifactId>launch4j-maven-plugin</artifactId>
                        <version>2.4.1</version>
                        <configuration>
                            <headerType>gui</headerType>
                            <jar>${name.final}.jar</jar>
                            <dontWrapJar>true</dontWrapJar>
                            <icon>src/main/resources/icon.ico</icon>
                            <errTitle>ctbrec</errTitle>
                            <classPath>
                                <mainClass>ctbrec.ui.Launcher</mainClass>
                                <addDependencies>true</addDependencies>
                                <jarLocation>lib/</jarLocation>
                                <preCp>.</preCp>
                            </classPath>
                            <downloadUrl>https://jdk.java.net/</downloadUrl>
                            <jre>
                                <path>jre</path>
                                <bundledJre64Bit>true</bundledJre64Bit>
                                <minVersion>15</minVersion>
                                <maxHeapSize>1024</maxHeapSize>
                                <opts>
                                    <opt>-Dfile.encoding=utf-8</opt>
                                </opts>
                            </jre>
                            <versionInfo>
                                <fileVersion>${project.version}.0</fileVersion>
                                <txtFileVersion>${project.version}.0</txtFileVersion>
                                <fileDescription>Software to record live streams</fileDescription>
                                <copyright>2023 0xb00bface</copyright>
                                <productVersion>${project.version}.0</productVersion>
                                <txtProductVersion>${project.version}.0</txtProductVersion>
                                <productName>CTB Recorder</productName>
                                <internalName>ctbrec</internalName>
                                <originalFilename>ctbrec.exe</originalFilename>
                            </versionInfo>
                        </configuration>
                        <executions>
                            <execution>
                                <id>l4j-win</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>launch4j</goal>
                                </goals>
                                <configuration>
                                    <outfile>target/ctbrec.exe</outfile>
                                    <splash>
                                        <file>src/main/resources/splash.bmp</file>
                                        <waitForWindow>true</waitForWindow>
                                        <timeout>60</timeout>
                                        <timeoutErr>true</timeoutErr>
                                    </splash>
                                </configuration>
                            </execution>
                            <execution>
                                <id>l4j-win-no-splash</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>launch4j</goal>
                                </goals>
                                <configuration>
                                    <outfile>target/ctbrec-no-splash.exe</outfile>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>zip</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>ctbrec-${project.version}</finalName>
                                    <descriptors>
                                        <descriptor>src/assembly/win64-jre.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>linux</id>
            <activation>
                <property>
                    <name>javafx.platform</name>
                    <value>linux</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>zip</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>ctbrec-${project.version}</finalName>
                                    <descriptors>
                                        <descriptor>src/assembly/linux-jre.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>macos</id>
            <activation>
                <property>
                    <name>javafx.platform</name>
                    <value>mac</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <!-- <plugin> <groupId>de.perdian.maven.plugins</groupId> <artifactId>macosappbundler-maven-plugin</artifactId>
                        <version>1.10.1</version> <configuration> <plist> <CFBundleIconFile>src/main/resources/icon.icns</CFBundleIconFile>
                        <CFBundleDisplayName>CTB Recorder</CFBundleDisplayName> <CFBundleDevelopmentRegion>English</CFBundleDevelopmentRegion>
                        <CFBundleName>ctbrec</CFBundleName> <CFBundleURLTypes> <string>msa</string>
                        </CFBundleURLTypes> <JVMMainClassName>ctbrec.ui.Launcher</JVMMainClassName>
                        <JVMVersion>11+</JVMVersion> <JVMOptions> <string>-Dfile.encoding=utf-8</string>
                        </JVMOptions> <JVMRuntimePath>Contents/Java/jdk/Contents/Home</JVMRuntimePath>
                        </plist> <jdk> <include>true</include> <location>jre/jdk_macos</location>
                        </jdk> </configuration> <executions> <execution> <phase>package</phase> <goals>
                        <goal>bundle</goal> </goals> </execution> </executions> </plugin> <plugin>
                        <artifactId>maven-assembly-plugin</artifactId> <version>3.1.0</version> <executions>
                        <execution> <id>zip</id> <phase>verify</phase> <goals> <goal>single</goal>
                        </goals> <configuration> <finalName>ctbrec-${project.version}</finalName>
                        <descriptors> <descriptor>src/assembly/macos-bundle.xml</descriptor> </descriptors>
                        </configuration> </execution> </executions> </plugin> -->
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>zip</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                                <configuration>
                                    <finalName>ctbrec-${project.version}</finalName>
                                    <descriptors>
                                        <descriptor>src/assembly/macos-jre.xml</descriptor>
                                    </descriptors>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
