<?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>build.buf</groupId>
    <artifactId>protobuf-javalite</artifactId>
    <version>4.29.2</version>

    <name>protobuf-javalite supplement for use with official protobuf-javalite artifact</name>
    <url>https://github.com/bufbuild/protobuf-javalite</url>
    <description>protobuf-javalite contains additional generated classes for use with the Protobuf Java Lite runtime.</description>

    <developers>
        <developer>
            <id>bufbuild</id>
            <name>Buf</name>
            <email>dev@buf.build</email>
            <url>https://buf.build/</url>
            <organization>Buf Technologies, Inc.</organization>
            <organizationUrl>https://buf.build/</organizationUrl>
        </developer>
    </developers>

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

    <distributionManagement>
        <snapshotRepository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
        </snapshotRepository>
        <repository>
            <id>ossrh</id>
            <url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
        </repository>
    </distributionManagement>

    <scm>
        <developerConnection>scm:git:https://github.com/bufbuild/protobuf-javalite.git</developerConnection>
        <url>https://github.com/bufbuild/protobuf-javalite</url>
        <tag>v4.29.2</tag>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <buf.version>1.47.2</buf.version>
        <!-- The version of protobuf to target (both protoc and the version of the .proto files). -->
        <protobuf.version>4.29.2</protobuf.version>
        <protoc.version>${protobuf.version}</protoc.version>
        <protobuf.tag>v${protobufVersion.minorVersion}.${protobufVersion.incrementalVersion}</protobuf.tag>

        <!-- Directory where generated code is stored. -->
        <output.dir>${project.build.directory}/generated-sources/proto</output.dir>
        <!-- Proto source directory. -->
        <proto.dir>${project.build.directory}/proto</proto.dir>
        <!-- Full path to the buf artifact - needed so we can make it executable. -->
        <buf>${settings.localRepository}/build/buf/buf/${buf.version}/buf-${buf.version}-${os.detected.classifier}.exe</buf>
        <!-- Full path to the protoc artifact - needed so we can make it executable. -->
        <protoc>${settings.localRepository}/com/google/protobuf/protoc/${protoc.version}/protoc-${protoc.version}-${os.detected.classifier}.exe</protoc>
    </properties>

    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.junit</groupId>
                <artifactId>junit-bom</artifactId>
                <version>5.11.4</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-bom</artifactId>
                <version>${protobuf.version}</version>
                <scope>import</scope>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-javalite</artifactId>
                <version>${protobuf.version}</version>
            </dependency>
            <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protoc</artifactId>
                <version>${protoc.version}</version>
                <type>exe</type>
                <classifier>${os.detected.classifier}</classifier>
            </dependency>
            <dependency>
                <groupId>build.buf</groupId>
                <artifactId>buf</artifactId>
                <version>${buf.version}</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>build.buf</groupId>
                <artifactId>buf</artifactId>
                <version>${buf.version}</version>
                <type>exe</type>
                <classifier>${os.detected.classifier}</classifier>
            </dependency>
        </dependencies>
    </dependencyManagement>

    <dependencies>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protobuf-javalite</artifactId>
        </dependency>
        <dependency>
            <groupId>build.buf</groupId>
            <artifactId>buf</artifactId>
            <type>exe</type>
            <classifier>${os.detected.classifier}</classifier>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.google.protobuf</groupId>
            <artifactId>protoc</artifactId>
            <type>exe</type>
            <classifier>${os.detected.classifier}</classifier>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <resources>
            <resource>
                <directory>${proto.dir}</directory>
            </resource>
        </resources>
        <sourceDirectory>${output.dir}</sourceDirectory>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.7.1</version>
            </extension>
        </extensions>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.googlecode.maven-download-plugin</groupId>
                    <artifactId>download-maven-plugin</artifactId>
                    <version>1.13.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-antrun-plugin</artifactId>
                    <version>3.1.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-assembly-plugin</artifactId>
                    <version>3.7.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>3.13.0</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-dependency-plugin</artifactId>
                    <version>3.8.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-deploy-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-gpg-plugin</artifactId>
                    <version>3.2.7</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-install-plugin</artifactId>
                    <version>3.1.3</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-javadoc-plugin</artifactId>
                    <version>3.11.2</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-release-plugin</artifactId>
                    <version>3.1.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-source-plugin</artifactId>
                    <version>3.3.1</version>
                </plugin>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>3.5.2</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>build-helper-maven-plugin</artifactId>
                    <version>3.6.0</version>
                </plugin>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>3.5.0</version>
                </plugin>
                <plugin>
                    <groupId>org.sonatype.plugins</groupId>
                    <artifactId>nexus-staging-maven-plugin</artifactId>
                    <version>1.7.0</version>
                </plugin>
            </plugins>
        </pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>configure-protoc</id>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <target>
                                <chmod file="${buf}" perm="+x" />
                                <chmod file="${protoc}" perm="+x" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <release>8</release>
                    <source>8</source>
                    <target>8</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.googlecode.maven-download-plugin</groupId>
                <artifactId>download-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>download-plugin-proto</id>
                        <goals>
                            <goal>wget</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <url>https://raw.githubusercontent.com/protocolbuffers/protobuf/${protobuf.tag}/src/google/protobuf/compiler/plugin.proto</url>
                            <followRedirects>true</followRedirects>
                            <outputDirectory>${proto.dir}/google/protobuf/compiler</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-javadocs</id>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <releaseProfiles>release</releaseProfiles>
                    <scmCommentPrefix>[skip ci] </scmCommentPrefix>
                    <tagNameFormat>v@{project.version}</tagNameFormat>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-buf-gen-yaml</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}</directory>
                                    <filtering>true</filtering>
                                    <includes>buf.gen.yaml</includes>
                                </resource>
                            </resources>
                            <outputDirectory>${project.build.directory}</outputDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-source-plugin</artifactId>
                <executions>
                    <execution>
                        <id>attach-sources</id>
                        <phase>verify</phase>
                        <goals>
                            <goal>jar-no-fork</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>parse-version</id>
                        <goals>
                            <goal>parse-version</goal>
                        </goals>
                        <configuration>
                            <propertyPrefix>protobufVersion</propertyPrefix>
                            <versionString>${protobuf.version}</versionString>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <!-- Generate Java code for the lite runtime using buf. -->
                    <execution>
                        <id>generate-code</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>generate-sources</phase>
                        <configuration>
                            <executable>${buf}</executable>
                            <arguments>
                                <argument>generate</argument>
                                <argument>--template</argument>
                                <argument>${project.build.directory}/buf.gen.yaml</argument>
                            </arguments>
                            <workingDirectory>${proto.dir}</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.sonatype.plugins</groupId>
                <artifactId>nexus-staging-maven-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <serverId>ossrh</serverId>
                    <nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
                    <autoReleaseAfterClose>true</autoReleaseAfterClose>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>release</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-gpg-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>sign-artifacts</id>
                                <phase>verify</phase>
                                <goals>
                                    <goal>sign</goal>
                                </goals>
                                <configuration>
                                    <signer>bc</signer>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
