<?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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.datasyslab</groupId>
    <artifactId>proj4sedona</artifactId>
    <version>0.1.2</version>
    <packaging>jar</packaging>

    <name>Proj4Sedona</name>
    <description>A high-performance Java library for coordinate system transformations, ported from Proj4js</description>
    <url>https://github.com/jiayuasu/proj4sedona</url>

    <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>jiayuasu</id>
            <name>Jia Yu</name>
            <organization>DataSysLab</organization>
            <organizationUrl>https://datasyslab.org</organizationUrl>
        </developer>
    </developers>

    <scm>
        <connection>scm:git:git://github.com/jiayuasu/proj4sedona.git</connection>
        <developerConnection>scm:git:ssh://github.com:jiayuasu/proj4sedona.git</developerConnection>
        <url>https://github.com/jiayuasu/proj4sedona/tree/main</url>
    </scm>

    <properties>
        <maven.compiler.source>11</maven.compiler.source>
        <maven.compiler.target>11</maven.compiler.target>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.10.0</junit.version>
    </properties>

    <dependencies>
        <!-- GeoTIFF reading (for datum grids) - https://github.com/geotiffjs/geotiff.java -->
        <dependency>
            <groupId>org.datasyslab</groupId>
            <artifactId>geotiff</artifactId>
            <version>0.0.1-20260125</version>
        </dependency>

        <!-- JSON parsing for PROJJSON -->
        <dependency>
            <groupId>com.google.code.gson</groupId>
            <artifactId>gson</artifactId>
            <version>2.10.1</version>
        </dependency>

        <!-- JTS Topology Suite for geometry transformations -->
        <dependency>
            <groupId>org.locationtech.jts</groupId>
            <artifactId>jts-core</artifactId>
            <version>1.20.0</version>
            <optional>true</optional>
        </dependency>

        <!-- Testing -->
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.11.0</version>
                <configuration>
                    <source>11</source>
                    <target>11</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.1.2</version>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <!-- Benchmarks profile: generates reference data, runs speed + correctness benchmarks, outputs MD report -->
        <profile>
            <id>benchmarks</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <!-- Generate pyproj reference data -->
                            <execution>
                                <id>generate-pyproj-reference</id>
                                <phase>pre-integration-test</phase>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <configuration>
                                    <executable>python3</executable>
                                    <workingDirectory>${project.basedir}/scripts/pyproj-reference</workingDirectory>
                                    <arguments>
                                        <argument>generate_all.py</argument>
                                        <argument>--output-dir</argument>
                                        <argument>${project.build.directory}/pyproj-reference</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                            <!-- Run benchmarks (speed + correctness) and generate MD report -->
                            <execution>
                                <id>run-benchmarks</id>
                                <phase>integration-test</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                                <configuration>
                                    <mainClass>org.datasyslab.proj4sedona.benchmark.SpeedBenchmark</mainClass>
                                    <classpathScope>test</classpathScope>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>

        <!-- Release profile for Maven Central deployment -->
        <profile>
            <id>release</id>
            <activation>
                <property>
                    <name>performRelease</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>3.3.0</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar-no-fork</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>3.6.0</version>
                        <executions>
                            <execution>
                                <id>attach-javadocs</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <version>3.1.0</version>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.sonatype.central</groupId>
                        <artifactId>central-publishing-maven-plugin</artifactId>
                        <version>0.7.0</version>
                        <extensions>true</extensions>
                        <configuration>
                            <publishingServerId>central</publishingServerId>
                            <autoPublish>true</autoPublish>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
