<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright © 2025 Cyril de Catheu (cdecatheu@hey.com)

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

        http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.

-->
<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>

    <groupId>tech.catheu</groupId>
    <artifactId>jeamlit</artifactId>
    <version>0.1.0</version>
    <packaging>jar</packaging>

    <name>Jeamlit</name>
    <description>A Streamlit-like framework for building data apps in Java</description>
    <url>https://github.com/cyrilou242/jeamlit</url>
    <inceptionYear>2025</inceptionYear>

    <licenses>
        <license>
            <name>Apache License, Version 2.0</name>
            <url>https://www.apache.org/licenses/LICENSE-2.0.txt</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <developers>
        <developer>
            <id>cyrilou242</id>
            <name>Cyril de Catheu</name>
            <email>cdecatheu@hey.com</email>
            <url>https://github.com/cyrilou242</url>
        </developer>
    </developers>

    <properties>
        <maven.compiler.source>21</maven.compiler.source>
        <maven.compiler.target>21</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <undertow.version>2.3.18.Final</undertow.version>
        <flexmark.version>0.64.8</flexmark.version>
        <sonatype.url>https://ossrh-staging-api.central.sonatype.com</sonatype.url>
    </properties>

    <scm>
        <url>https://github.com/cyrilou242/jeamlit.git</url>
        <connection>scm:git:${project.scm.url}</connection>
        <developerConnection>scm:git:${project.scm.url}</developerConnection>
        <tag>jeamlit-0.1.0-SNAPSHOT</tag>
    </scm>

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <name>Sonatype Nexus Snapshots</name>
            <url>${sonatype.url}/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <name>Nexus Release Repository</name>
            <url>${sonatype.url}/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <dependencies>
        <!-- Logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>2.0.9</version>
        </dependency>
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>1.5.18</version>
            <!-- included in fat jar, but not as a transitive dependency for users of the thin jar-->
            <optional>true</optional>
        </dependency>

        <!-- Undertow Web Server -->
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-core</artifactId>
            <version>${undertow.version}</version>
        </dependency>
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-servlet</artifactId>
            <version>${undertow.version}</version>
        </dependency>
        <dependency>
            <groupId>io.undertow</groupId>
            <artifactId>undertow-websockets-jsr</artifactId>
            <version>${undertow.version}</version>
        </dependency>

        <!-- File Watching -->
        <dependency>
            <groupId>io.methvin</groupId>
            <artifactId>directory-watcher</artifactId>
            <version>0.19.1</version>
        </dependency>

        <!-- JSON Processing -->
        <dependency>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <version>2.19.1</version>
        </dependency>

        <!-- System utils -->
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.18.0</version>
        </dependency>

        <!-- JBang for dependency resolution. -->
        <!-- TODO brings tons of dependency. Some could be excluded. -->
        <dependency>
            <groupId>dev.jbang</groupId>
            <artifactId>jbang-cli</artifactId>
            <version>0.127.18</version>
        </dependency>
        <!-- need to add this one which is runtimeOnly in jbang https://github.com/jbangdev/jbang/blob/d69682ca032fc7784ef42f3918802ddad8ab6150/build.gradle#L145 -->
        <dependency>
            <groupId>eu.maveniverse.maven.mima.runtime</groupId>
            <artifactId>standalone-static</artifactId>
            <version>2.4.20</version>
        </dependency>
        <!-- need to add this one too -->
        <dependency>
            <groupId>org.codehaus.plexus</groupId>
            <artifactId>plexus-xml</artifactId>
            <version>4.1.0</version>
        </dependency>

        <!-- template engine for the main index file and the components -->
        <dependency>
            <groupId>com.github.spullara.mustache.java</groupId>
            <artifactId>compiler</artifactId>
            <version>0.9.14</version>
        </dependency>

        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>26.0.2</version>
            <!-- TODO CYRIL - I think this needs to be compile scope if we want users to benefit from this in their IDE -->
            <scope>provided</scope>
        </dependency>

        <!-- CLI - could be in another submodule -->
        <dependency>
            <groupId>info.picocli</groupId>
            <artifactId>picocli</artifactId>
            <version>4.7.5</version>
        </dependency>

        <!--markdown rendering -->
        <dependency>
            <groupId>com.vladsch.flexmark</groupId>
            <artifactId>flexmark</artifactId>
            <version>${flexmark.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vladsch.flexmark</groupId>
            <artifactId>flexmark-ext-emoji</artifactId>
            <version>${flexmark.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vladsch.flexmark</groupId>
            <artifactId>flexmark-ext-tables</artifactId>
            <version>${flexmark.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vladsch.flexmark</groupId>
            <artifactId>flexmark-ext-gfm-strikethrough</artifactId>
            <version>${flexmark.version}</version>
        </dependency>
        <dependency>
            <groupId>com.vladsch.flexmark</groupId>
            <artifactId>flexmark-ext-autolink</artifactId>
            <version>${flexmark.version}</version>
        </dependency>

        <!-- emoji checks -->
        <dependency>
            <groupId>net.fellbaum</groupId>
            <artifactId>jemoji</artifactId>
            <version>1.7.4</version>
        </dependency>


        <!-- testing dependencies -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>5.13.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.microsoft.playwright</groupId>
            <artifactId>playwright</artifactId>
            <version>1.54.0</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
            <version>3.27.4</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.15.1</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.openrewrite.maven</groupId>
                <artifactId>rewrite-maven-plugin</artifactId>
                <version>6.16.0</version>
                <configuration>
                    <activeRecipes>
                        <recipe>org.openrewrite.staticanalysis.CodeCleanup</recipe>
                    </activeRecipes>
                    <checkstyleConfigFile>checkstyle.xml</checkstyleConfigFile>
                </configuration>
                <dependencies>
                    <dependency>
                        <groupId>org.openrewrite.recipe</groupId>
                        <artifactId>rewrite-static-analysis</artifactId>
                        <version>2.15.0</version>
                    </dependency>
                </dependencies>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <source>21</source>
                    <target>21</target>
                </configuration>
            </plugin>

            <!-- Configure test execution -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.3</version>
                <configuration>
                    <parallel>classes</parallel>
                    <threadCount>8</threadCount>
                    <perCoreThreadCount>false</perCoreThreadCount>
                </configuration>
            </plugin>

            <!-- Main executable JAR -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-shade-plugin</artifactId>
                <version>3.5.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>shade</goal>
                        </goals>
                        <configuration>
                            <createDependencyReducedPom>false</createDependencyReducedPom>
                            <shadedArtifactAttached>true</shadedArtifactAttached>
                            <shadedClassifierName>all</shadedClassifierName>
                            <transformers>
                                <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                                    <mainClass>tech.catheu.jeamlit.cli.Cli</mainClass>
                                </transformer>
                            </transformers>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- License plugin to add Apache 2.0 headers -->
            <plugin>
                <groupId>com.mycila</groupId>
                <artifactId>license-maven-plugin</artifactId>
                <version>4.6</version>
                <configuration>
                    <properties>
                        <owner>Cyril de Catheu</owner>
                        <email>cdecatheu@hey.com</email>
                        <year>2025</year>
                    </properties>
                    <licenseSets>
                        <licenseSet>
                            <header>com/mycila/maven/plugin/license/templates/APACHE-2.txt</header>
                            <excludes>
                                <exclude>**/README</exclude>
                                <exclude>**/README.md</exclude>
                                <exclude>**/LICENSE</exclude>
                                <exclude>**/*.json</exclude>
                                <exclude>**/*.properties</exclude>
                                <exclude>.mvn/**</exclude>
                                <exclude>mvnw</exclude>
                                <exclude>mvnw.cmd</exclude>
                                <exclude>mvnwDebug</exclude>
                                <exclude>mvnwDebug.cmd</exclude>
                                <exclude>.gitignore</exclude>
                                <exclude>.idea/**</exclude>
                                <exclude>target/**</exclude>
                                <exclude>examples/**</exclude>
                                <exclude>notes/**</exclude>
                                <exclude>streamlit_ref/**</exclude>
                            </excludes>
                        </licenseSet>
                    </licenseSets>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>check</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Maven Release Plugin -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.1.1</version>
                <configuration>
                    <autoVersionSubmodules>true</autoVersionSubmodules>
                    <goals>deploy</goals>
                    <developmentVersion>
                        ${parsedVersion.majorVersion}.${parsedVersion.nextMinorVersion}.0-SNAPSHOT
                    </developmentVersion>
                    <!-- activating the release profile explicitly -->
                    <useReleaseProfile>false</useReleaseProfile>
                    <releaseProfiles>release</releaseProfiles>
                    <tagNameFormat>jeamlit-${project.version}</tagNameFormat>
                </configuration>
            </plugin>

            <!-- makes project metadata available in other plugin configs -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>3.2.1</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                            <goal>create-metadata</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Nexus Staging Plugin -->
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <version>1.7.0</version>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>${sonatype.url}</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <!-- Source JAR -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.1</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                                <configuration>
                                    <includePom>true</includePom>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>

                    <!-- Javadoc JAR -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.11.3</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <doclint>none</doclint>
                            <source>21</source>
                            <quiet>true</quiet>
                        </configuration>
                    </plugin>

                    <!-- GPG Signing -->
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.2.8</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
