<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>
    <groupId>com.gluonhq.scenebuilder</groupId>
    <artifactId>parent</artifactId>
    <packaging>pom</packaging>
    <version>24.0.1</version>
    <name>Scene Builder</name>
    <description>Scene Builder is a visual, drag n drop, layout tool for designing JavaFX application user interfaces</description>
    <inceptionYear>2012</inceptionYear>
    <url>https://github.com/gluonhq/scenebuilder</url>

    <modules>
        <module>kit</module>
        <module>app</module>
        <module>gluon-plugin</module>
    </modules>

    <properties>
        <java.version>22</java.version>
        <maven.compiler.source>${java.version}</maven.compiler.source>
        <maven.compiler.target>${java.version}</maven.compiler.target>
        <maven.compiler.release>${java.version}</maven.compiler.release>
        <javafx.version>24.0.1</javafx.version>
        <maven.resolver.version>2.0.0-alpha-8</maven.resolver.version>
        <charm.glisten.version>6.2.3</charm.glisten.version>
        <gluon.attach.version>4.0.22</gluon.attach.version>
        <junit.jupiter.version>5.10.0</junit.jupiter.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.github.repository>gluonhq/scenebuilder</project.github.repository>
        <repository.url>github.com:${project.github.repository}</repository.url>
        <jreleaser.files.active>RELEASE</jreleaser.files.active>
        <altDeploymentRepository>local::file:./target/staging-deploy</altDeploymentRepository>
        <main.class.name/>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>${junit.jupiter.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-params</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.19.0</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.openjfx</groupId>
                    <artifactId>javafx-maven-plugin</artifactId>
                    <version>0.0.8</version>
                    <configuration>
                        <mainClass>${main.class.name}</mainClass>
                        <options>
                            <option>-Djavafx.allowjs=true</option>
                            <option>--add-opens=javafx.fxml/javafx.fxml=com.gluonhq.scenebuilder.app</option>
                            <option>--add-opens=javafx.fxml/javafx.fxml=com.gluonhq.scenebuilder.kit</option>
                            <option>--add-opens=javafx.controls/com.sun.javafx.scene.control.skin.caspian=com.gluonhq.scenebuilder.kit</option>
                            <option>--add-opens=javafx.controls/com.sun.javafx.scene.control.skin.modena=com.gluonhq.scenebuilder.kit</option>
                            <option>--enable-native-access=javafx.graphics</option>
                            <option>--sun-misc-unsafe-memory-access=allow</option>
                        </options>
                    </configuration>
                </plugin>

                <!-- Build KIT wherever parent is cleaned -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.13.0</version>
                    <configuration>
                        <useIncrementalCompilation>false</useIncrementalCompilation>
                    </configuration>
                </plugin>

                <!-- Enforce code formatting and style -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-checkstyle-plugin</artifactId>
                    <version>3.5.0</version>
                    <configuration>
                        <configLocation>checkstyle.xml</configLocation>
                        <encoding>UTF-8</encoding>
                        <consoleOutput>true</consoleOutput>
                        <failsOnError>true</failsOnError>
                        <includeTestSourceDirectory>true</includeTestSourceDirectory>
                    </configuration>
                    <dependencies>
                        <dependency>
                            <groupId>com.puppycrawl.tools</groupId>
                            <artifactId>checkstyle</artifactId>
                            <version>10.18.2</version>
                        </dependency>
                    </dependencies>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.2.0</version>
                </plugin>

                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>

                <!-- Ensure that available tests are executed -->
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.0.0-M5</version>
                    <configuration>
                        <reuseForks>false</reuseForks>
                        <forkCount>1</forkCount>
                        <argLine>--add-opens=javafx.fxml/javafx.fxml=com.gluonhq.scenebuilder.kit -Djavafx.allowjs=true</argLine>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.3.0</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <phase>initialize</phase>
                        <id>parse-version</id>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>copy-resources</id>
                        <phase>process-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>src/files</directory>
                                    <filtering>true</filtering>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.jreleaser</groupId>
                <artifactId>jreleaser-maven-plugin</artifactId>
                <version>1.18.0</version>
                <inherited>false</inherited>
                <configuration>
                    <jreleaser>
                        <environment>
                            <properties>
                                <artifactsDir>artifacts</artifactsDir>
                                <s3Path>{{tagName}}</s3Path>
                            </properties>
                        </environment>
                        <project>
                            <!-- should not exceed 79 chars -->
                            <name>SceneBuilder</name>
                            <description>Scene Builder is a visual layout tool for designing JavaFX application GUIs</description>
                            <longDescription>${project.description}</longDescription>
                            <tags>javafx,gui,tool</tags>
                            <snapshot>
                                <fullChangelog>true</fullChangelog>
                            </snapshot>
                        </project>
                        <checksum>
                            <files>false</files>
                        </checksum>
                        <release>
                            <github>
                                <branch>master</branch>
                                <tagName>{{projectVersion}}</tagName>
                                <files>false</files>
                                <checksums>false</checksums>
                                <signatures>false</signatures>
                                <changelog>
                                    <formatted>ALWAYS</formatted>
                                    <preset>conventional-commits</preset>
                                    <format>- {{commitShortHash}} {{commitTitle}}</format>
                                    <contributors>
                                        <format>* {{contributorName}}{{#contributorUsernameAsLink}} ({{.}}){{/contributorUsernameAsLink}}</format>
                                    </contributors>
                                    <hide>
                                        <contributors>
                                            <contributor>GitHub</contributor>
                                            <contributor>bot</contributor>
                                        </contributors>
                                    </hide>
                                    <labelers>
                                        <labeler>
                                            <title>Bump</title>
                                            <label>dependencies</label>
                                        </labeler>
                                    </labelers>
                                    <categories>
                                        <category>
                                            <key>deps</key>
                                            <title>Dependencies</title>
                                            <labels>dependencies</labels>
                                            <order>200</order>
                                        </category>
                                    </categories>
                                    <hide>
                                        <categories>merge</categories>
                                    </hide>
                                </changelog>
                            </github>
                        </release>
                        <upload>
                            <s3>
                                <gluon>
                                    <active>RELEASE</active>
                                    <checksums>false</checksums>
                                    <signatures>false</signatures>
                                    <path>scenebuilder/{{artifactFile}}</path>
                                </gluon>
                            </s3>
                        </upload>
                        <distributions>
                            <SceneBuilder>
                                <type>NATIVE_PACKAGE</type>
                                <brew>
                                    <active>NEVER</active>
                                </brew>
                                <chocolatey>
                                    <active>NEVER</active>
                                    <remoteBuild>true</remoteBuild>
                                </chocolatey>
                                <macports>
                                    <active>NEVER</active>
                                </macports>
                                <snap>
                                    <active>NEVER</active>
                                    <remoteBuild>true</remoteBuild>
                                </snap>
                                <artifacts>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-amd64.dmg</path>
                                        <platform>osx-x86_64</platform>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/install/mac/{{artifactFile}}</s3GluonPath>
                                        </extraProperties>
                                    </artifact>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}-aarch64.dmg</path>
                                        <platform>osx-aarch64</platform>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/install/mac/{{artifactFile}}</s3GluonPath>
                                        </extraProperties>
                                    </artifact>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}.msi</path>
                                        <platform>windows-x86_64</platform>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/install/win/{{artifactFile}}</s3GluonPath>
                                        </extraProperties>
                                    </artifact>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}.rpm</path>
                                        <platform>linux-x86_64</platform>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/install/linux/{{artifactFile}}</s3GluonPath>
                                            <skipSnap>true</skipSnap>
                                        </extraProperties>
                                    </artifact>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}.deb</path>
                                        <platform>linux-x86_64</platform>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/install/linux/{{artifactFile}}</s3GluonPath>
                                        </extraProperties>
                                    </artifact>
                                </artifacts>
                            </SceneBuilder>
                            <scenebuilder-kit>
                                <type>SINGLE_JAR</type>
                                <artifacts>
                                    <artifact>
                                        <path>{{artifactsDir}}/{{distributionName}}-{{projectVersion}}.jar</path>
                                        <extraProperties>
                                            <s3GluonPath>scenebuilder/{{s3Path}}/{{artifactFile}}</s3GluonPath>
                                        </extraProperties>
                                    </artifact>
                                </artifacts>
                            </scenebuilder-kit>
                        </distributions>
                        <files>
                            <active>${jreleaser.files.active}</active>
                            <artifacts>
                                <artifact>
                                    <path>target/settings.properties</path>
                                </artifact>
                                <artifact>
                                    <path>target/version.json</path>
                                </artifact>
                                <artifact>
                                    <path>target/version-8.4.0.json</path>
                                </artifact>
                            </artifacts>
                        </files>
                        <signing>
                            <active>ALWAYS</active>
                            <armored>true</armored>
                        </signing>
                        <deploy>
                            <maven>
                                <mavenCentral>
                                    <maven-central>
                                        <active>RELEASE</active>
                                        <url>https://central.sonatype.com/api/v1/publisher</url>
                                        <snapshotSupported>false</snapshotSupported>
                                        <applyMavenCentralRules>true</applyMavenCentralRules>
                                        <stagingRepositories>
                                            <stagingRepository>target/staging-deploy</stagingRepository>
                                        </stagingRepositories>
                                    </maven-central>
                                </mavenCentral>
                                <nexus2>
                                    <snapshot-deploy>
                                        <active>SNAPSHOT</active>
                                        <url>https://central.sonatype.com/api/v1/publisher</url>
                                        <snapshotUrl>https://central.sonatype.com/repository/maven-snapshots/</snapshotUrl>
                                        <snapshotSupported>true</snapshotSupported>
                                        <applyMavenCentralRules>true</applyMavenCentralRules>
                                        <closeRepository>true</closeRepository>
                                        <releaseRepository>true</releaseRepository>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </snapshot-deploy>
                                </nexus2>
                            </maven>
                        </deploy>
                    </jreleaser>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <organization>
        <name>Gluon</name>
        <url>https://www.gluonhq.com</url>
    </organization>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/gluonhq/scenebuilder/issues</url>
    </issueManagement>

    <licenses>
        <license>
            <name>BSD 3-Clause</name>
            <url>https://opensource.org/licenses/BSD-3-Clause</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <name>Abhinay Agarwal</name>
            <email>abhinay.agarwal@gluonhq.com</email>
            <organization>Gluon</organization>
            <organizationUrl>https://www.gluonhq.com</organizationUrl>
        </developer>
        <developer>
            <name>Joeri Sykora</name>
            <email>joeri.sykora@gluonhq.com</email>
            <organization>Gluon</organization>
            <organizationUrl>https://www.gluonhq.com</organizationUrl>
        </developer>
        <developer>
            <name>José Pereda</name>
            <email>jose.pereda@gluonhq.com</email>
            <organization>Gluon</organization>
            <organizationUrl>https://www.gluonhq.com</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>${repository.url}</url>
        <connection>scm:git:${repository.url}.git</connection>
        <developerConnection>scm:git:${repository.url}.git</developerConnection>
    </scm>

    <reporting>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.5.0</version>
            </plugin>
        </plugins>
    </reporting>
</project>
