<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Licensed under the EUPL, Version 1.2 or - as soon they will be approved by
  ~ the European Commission - subsequent versions of the EUPL (the "Licence");
  ~ You may not use this work except in compliance with the Licence.
  ~ You may obtain a copy of the Licence at:
  ~
  ~   https://joinup.ec.europa.eu/software/page/eupl
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the Licence is distributed on an "AS IS" basis,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the Licence for the specific language governing permissions and
  ~ limitations under the Licence.
  -->
<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>no.entur</groupId>
    <artifactId>netex-protobuf</artifactId>
    <version>1.128.0</version>
    <name>Protobuf descriptor files for NeTEx</name>
    <description>Generates protobuf descriptor files based on NeTEx xsd</description>
    <properties>
        <jreleaser-maven-plugin.version>1.24.0</jreleaser-maven-plugin.version>
        <maven-deploy-plugin.version>3.1.4</maven-deploy-plugin.version>
        <maven-javadoc-plugin.version>3.12.0</maven-javadoc-plugin.version>
        <maven-source-plugin.version>3.4.0</maven-source-plugin.version>
        <maven-surefire-plugin.version>3.5.3</maven-surefire-plugin.version>
        <maven.compiler.plugin.version>3.15.0</maven.compiler.plugin.version>
        <maven.compiler.source>17</maven.compiler.source>
        <maven.compiler.target>17</maven.compiler.target>
        <os-maven-plugin.version>1.7.1</os-maven-plugin.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <proto-backwards-compatibility.version>1.0.7</proto-backwards-compatibility.version>
        <proto.version>4.35.0</proto.version>
        <protobuf-maven-plugin.version>5.1.4</protobuf-maven-plugin.version>
        <protovalidate.version>1.2.2</protovalidate.version>
        <schema2proto.version>1.122.0</schema2proto.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>no.entur</groupId>
            <artifactId>schema2proto-xsdproto</artifactId>
            <version>${schema2proto.version}</version>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-java</artifactId>
            <version>${proto.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>build.buf</groupId>
            <artifactId>protovalidate</artifactId>
            <version>${protovalidate.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.re2j</groupId>
            <artifactId>re2j</artifactId>
            <version>1.8</version>
            <scope>provided</scope>
        </dependency>
        <!-- xsd:date and xsd:time equivalents -->
        <dependency>
            <groupId>com.google.api.grpc</groupId>
            <artifactId>proto-google-common-protos</artifactId>
            <version>2.72.0</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.jreleaser</groupId>
                    <artifactId>jreleaser-maven-plugin</artifactId>
                    <version>${jreleaser-maven-plugin.version}</version>
                    <inherited>false</inherited>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>${maven-deploy-plugin.version}</version>
                </plugin>
                <plugin>
                    <!-- put this plugin into a profile so it can be disabled via command line -->
                    <groupId>io.github.ascopes</groupId>
                    <artifactId>protobuf-maven-plugin</artifactId>
                    <version>${protobuf-maven-plugin.version}</version>
                    <executions>
                        <execution>
                            <id>compile-sources</id>
                            <goals>
                                <goal>generate</goal>
                            </goals>
                            <phase>process-resources</phase>
                            <configuration>
                                <protoc>${proto.version}</protoc>
                                <sourceDirectories>
                                    <sourceDirectory>${project.build.directory}/proto</sourceDirectory>
                                </sourceDirectories>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>${os-maven-plugin.version}</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <goals>
                            <goal>detect</goal>
                        </goals>
                        <phase>validate</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-resources-plugin</artifactId>
                <version>3.5.0</version>
                <executions>
                    <execution>
                        <id>copy-custom-types</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>process-resources</phase>
                        <configuration>
                            <outputDirectory>${basedir}/target/proto/no/entur/netex/protobuf</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/src/main/proto</directory>
                                    <includes>
                                        <include>*.proto</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <executions>
                    <execution>
                        <id>unpack</id>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>com.google.protobuf</groupId>
                                    <artifactId>protobuf-java</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <includes>**/*.proto</includes>
                                    <outputDirectory>${project.build.directory}/proto_deps</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>com.google.api.grpc</groupId>
                                    <artifactId>proto-google-common-protos</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <includes>**/*.proto</includes>
                                    <outputDirectory>${project.build.directory}/proto_deps</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>build.buf</groupId>
                                    <artifactId>protovalidate</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <includes>**/*.proto</includes>
                                    <outputDirectory>${project.build.directory}/proto_deps</outputDirectory>
                                </artifactItem>
                                <artifactItem>
                                    <groupId>no.entur</groupId>
                                    <artifactId>schema2proto-xsdproto</artifactId>
                                    <type>jar</type>
                                    <overWrite>true</overWrite>
                                    <includes>**/*.proto</includes>
                                    <outputDirectory>${project.build.directory}/proto</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>xml-maven-plugin</artifactId>
                <configuration>
                    <transformationSets>
                        <transformationSet>
                            <includes>
                                <include>**/*.xsd</include>
                            </includes>
                            <dir>src/main/resources/xsd</dir>
                            <stylesheet>src/main/resources/xslt/remove_unwanted_structures.xslt</stylesheet>
                        </transformationSet>
                    </transformationSets>
                </configuration>
                <dependencies>
                    <!-- https://mvnrepository.com/artifact/net.sf.saxon/Saxon-HE -->
                    <dependency>
                        <groupId>net.sf.saxon</groupId>
                        <artifactId>Saxon-HE</artifactId>
                        <version>13.0</version>
                    </dependency>
                </dependencies>
                <executions>
                    <execution>
                        <goals>
                            <goal>transform</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>no.entur</groupId>
                <artifactId>schema2proto-maven-plugin</artifactId>
                <version>${schema2proto.version}</version>
                <executions>
                    <execution>
                        <id>generate-proto</id>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <configFile>netex_to_protobuf_config.yaml</configFile>
                            <xsdFile>${project.build.directory}/generated-resources/xml/xslt/NeTEx_publication.xsd</xsdFile>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.salesforce.servicelibs</groupId>
                <artifactId>proto-backwards-compatibility</artifactId>
                <version>${proto-backwards-compatibility.version}</version>
                <configuration>
                    <protoSourceRoot>target/proto</protoSourceRoot>
                    <lockDir>${basedir}</lockDir>
                    <options>--debug=true</options>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>backwards-compatibility-check</goal>
                        </goals>
                        <phase>process-resources</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.5.0</version>
                <configuration>
                    <classesDirectory>target/proto</classesDirectory>
                    <includes>
                        <include>**/*.proto</include>
                    </includes>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.ekryd.sortpom</groupId>
                <artifactId>sortpom-maven-plugin</artifactId>
                <version>4.0.0</version>
                <configuration>
                    <predefinedSortOrder>custom_1</predefinedSortOrder>
                    <nrOfIndentSpace>4</nrOfIndentSpace>
                    <lineSeparator>\n</lineSeparator>
                    <sortProperties>true</sortProperties>
                    <keepBlankLines>false</keepBlankLines>
                    <createBackupFile>false</createBackupFile>
                    <sortDependencies>scope</sortDependencies>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>sort</goal>
                        </goals>
                        <phase>initialize</phase>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>${maven.compiler.plugin.version}</version>
                <configuration>
                    <source>${maven.compiler.source}</source>
                    <target>${maven.compiler.target}</target>
                    <fork>true</fork>
                    <meminitial>2048m</meminitial>
                    <maxmem>8192m</maxmem>
                    <encoding>UTF-8</encoding>
                    <compilerArgs>
                        <!--arg>-Werror</arg-->
                        <arg>-Xlint:all</arg>
                    </compilerArgs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>${maven-javadoc-plugin.version}</version>
                <configuration>
                    <doclint>none</doclint>
                    <source>17</source>
                    <detectJavaApiLink>false</detectJavaApiLink>
                    <minmemory>2048m</minmemory>
                    <maxmemory>8192m</maxmemory>
                </configuration>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <attach>true</attach>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.jreleaser</groupId>
                <artifactId>jreleaser-maven-plugin</artifactId>
                <inherited>false</inherited>
                <configuration>
                    <jreleaser>
                        <signing>
                            <active>ALWAYS</active>
                            <armored>true</armored>
                        </signing>
                        <deploy>
                            <maven>
                                <mavenCentral>
                                    <sonatype>
                                        <active>RELEASE</active>
                                        <url>https://central.sonatype.com/api/v1/publisher</url>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </sonatype>
                                </mavenCentral>
                                <nexus2>
                                    <maven-central>
                                        <active>SNAPSHOT</active>
                                        <url>https://ossrh-staging-api.central.sonatype.com/service/local</url>
                                        <snapshotUrl>https://central.sonatype.com/repository/maven-snapshots</snapshotUrl>
                                        <applyMavenCentralRules>true</applyMavenCentralRules>
                                        <snapshotSupported>true</snapshotSupported>
                                        <closeRepository>true</closeRepository>
                                        <releaseRepository>true</releaseRepository>
                                        <stagingRepositories>target/staging-deploy</stagingRepositories>
                                    </maven-central>
                                </nexus2>
                            </maven>
                        </deploy>
                        <release>
                            <github>
                                <skipTag>false</skipTag>
                                <skipRelease>true</skipRelease>
                            </github>
                        </release>
                    </jreleaser>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <url>https://github.com/entur/netex-protobuf</url>
    <organization>
        <name>Entur AS</name>
        <url>http://www.entur.org/</url>
    </organization>
    <licenses>
        <license>
            <name>EUPL-1.2 with modifications</name>
            <url>https://joinup.ec.europa.eu/software/page/eupl</url>
            <distribution>repo</distribution>
        </license>
    </licenses>
    <developers>
        <developer>
            <name>Arne Seime</name>
            <email>arne.seime@entur.org</email>
            <organization>Entur</organization>
            <organizationUrl>http://www.entur.org</organizationUrl>
        </developer>
    </developers>
    <scm>
        <connection>scm:git:ssh://git@github.com/entur/netex-protobuf.git</connection>
        <developerConnection>scm:git:ssh://git@github.com/entur/netex-protobuf.git</developerConnection>
        <url>https://github.com/entur/netex-protobuf/tree/master</url>
        <tag>HEAD</tag>
    </scm>
    <profiles>
        <profile>
            <id>protoc</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.github.ascopes</groupId>
                        <artifactId>protobuf-maven-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>publication</id>
            <properties>
                <altDeploymentRepository>local::file:./target/staging-deploy</altDeploymentRepository>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>io.github.ascopes</groupId>
                        <artifactId>protobuf-maven-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                        <version>${maven-source-plugin.version}</version>
                        <executions>
                            <execution>
                                <id>attach-sources</id>
                                <goals>
                                    <goal>jar</goal>
                                </goals>
                                <configuration>
                                    <attach>true</attach>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
