<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.opentripplanner</groupId>
    <artifactId>graphql-codegen</artifactId>
    <version>0.0.2</version>
    <packaging>maven-plugin</packaging>

    <name>GraphQL code generator</name>
    <description>
        Maven plugin that generates Java types and data fetcher interfaces for a GraphQL API
        from its schema.
    </description>
    <url>https://github.com/opentripplanner/graphql-codegen</url>

    <licenses>
        <license>
            <name>MIT License</name>
            <url>https://opensource.org/license/mit</url>
            <distribution>repo</distribution>
        </license>
    </licenses>

    <organization>
        <name>OpenTripPlanner Project</name>
        <url>https://www.opentripplanner.org</url>
    </organization>

    <developers>
        <developer>
            <name>OpenTripPlanner Project</name>
            <organization>OpenTripPlanner Project</organization>
            <organizationUrl>https://www.opentripplanner.org</organizationUrl>
        </developer>
    </developers>

    <scm>
        <url>https://github.com/opentripplanner/graphql-codegen</url>
        <connection>scm:git:https://github.com/opentripplanner/graphql-codegen.git</connection>
        <developerConnection>scm:git:git@github.com:opentripplanner/graphql-codegen.git</developerConnection>
        <tag>0.0.2</tag>
    </scm>

    <issueManagement>
        <system>GitHub</system>
        <url>https://github.com/opentripplanner/graphql-codegen/issues</url>
    </issueManagement>

    <prerequisites>
        <maven>${maven.version}</maven>
    </prerequisites>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <maven.compiler.release>25</maven.compiler.release>

        <!-- Lib versions - keep list sorted on property name -->
        <graphql-java.version>26.1</graphql-java.version>
        <jackson.version>3.2.3</jackson.version>
        <javapoet.version>0.22.0</javapoet.version>
        <junit.version>6.1.3</junit.version>
        <!-- The oldest Maven version the plugin supports; the Maven API is compiled against it. -->
        <maven.version>3.9.0</maven.version>
        <maven-plugin-tools.version>3.16.0</maven-plugin-tools.version>

        <!-- Formatting. Use '-Dplugin.spotless.goal=check' to only verify the formatting. -->
        <plugin.spotless.version>3.10.4</plugin.spotless.version>
        <plugin.spotless.goal>apply</plugin.spotless.goal>
        <plugin.spotless.skip>false</plugin.spotless.skip>
        <!-- The npm packages used by the Spotless 'prettier' step. Keep them in sync with each
             other; prettier-plugin-java only supports a limited range of prettier versions. -->
        <prettier.version>3.9.6</prettier.version>
        <prettier.java.version>2.10.3</prettier.java.version>
    </properties>

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

    <dependencies>
        <!-- Maven API, provided by Maven at runtime -->
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>${maven.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>${maven-plugin-tools.version}</version>
            <scope>provided</scope>
        </dependency>

        <!-- 3rd party dependencies -->
        <dependency>
            <groupId>com.graphql-java</groupId>
            <artifactId>graphql-java</artifactId>
            <version>${graphql-java.version}</version>
        </dependency>
        <dependency>
            <groupId>tools.jackson.dataformat</groupId>
            <artifactId>jackson-dataformat-yaml</artifactId>
        </dependency>
        <dependency>
            <groupId>com.palantir.javapoet</groupId>
            <artifactId>javapoet</artifactId>
            <version>${javapoet.version}</version>
        </dependency>

        <!-- test 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>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <!--
                  Spotless runs Prettier (with the prettier-java plugin) to format the code, using
                  the same style as OpenTripPlanner.
                  Note! Spotless requires node/npm to be available on the PATH.
                -->
                <groupId>com.diffplug.spotless</groupId>
                <artifactId>spotless-maven-plugin</artifactId>
                <version>${plugin.spotless.version}</version>
                <configuration>
                    <skip>${plugin.spotless.skip}</skip>
                    <java>
                        <includes>
                            <include>src/main/java/**/*.java</include>
                            <include>src/test/java/**/*.java</include>
                        </includes>
                        <removeUnusedImports>
                            <engine>cleanthat-javaparser-unnecessaryimport</engine>
                        </removeUnusedImports>
                        <prettier>
                            <devDependencies>
                                <prettier>${prettier.version}</prettier>
                                <prettier-plugin-java>${prettier.java.version}</prettier-plugin-java>
                            </devDependencies>
                            <config>
                                <plugins>prettier-plugin-java</plugins>
                                <parser>java</parser>
                                <printWidth>100</printWidth>
                                <tabWidth>2</tabWidth>
                                <useTabs>false</useTabs>
                                <endOfLine>lf</endOfLine>
                            </config>
                        </prettier>
                    </java>
                    <formats>
                        <format>
                            <includes>
                                <include>*.md</include>
                            </includes>
                            <prettier>
                                <devDependencies>
                                    <prettier>${prettier.version}</prettier>
                                </devDependencies>
                                <config>
                                    <parser>markdown</parser>
                                    <proseWrap>always</proseWrap>
                                    <printWidth>100</printWidth>
                                </config>
                            </prettier>
                        </format>
                    </formats>
                </configuration>
                <executions>
                    <execution>
                        <id>prettier-format</id>
                        <phase>validate</phase>
                        <goals>
                            <goal>${plugin.spotless.goal}</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.16.0</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.3</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.5.1</version>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>${maven-plugin-tools.version}</version>
                <configuration>
                    <goalPrefix>graphql-codegen</goalPrefix>
                </configuration>
            </plugin>
            <plugin>
                <!--
                  Runs the projects in src/it against the plugin. Use '-Dinvoker.skip' to skip them,
                  or '-Dinvoker.test=<name>' to run a single one.
                -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-invoker-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                    <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                    <settingsFile>src/it/settings.xml</settingsFile>
                    <postBuildHookScript>verify</postBuildHookScript>
                    <goals>
                        <goal>verify</goal>
                    </goals>
                </configuration>
                <executions>
                    <execution>
                        <id>integration-test</id>
                        <goals>
                            <goal>install</goal>
                            <goal>integration-test</goal>
                            <goal>verify</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <version>3.3.1</version>
                <configuration>
                    <tagNameFormat>@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <version>3.4.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.12.0</version>
                <configuration>
                    <doclint>none</doclint>
                </configuration>
                <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.2.8</version>
                <executions>
                    <execution>
                        <id>sign-artifacts</id>
                        <!-- We sign in the verify phase, which means it will happen before install and deploy (the last two phases)
                             but not before earlier phases like test or package. -->
                        <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.12.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>true</autoPublish>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>
