<?xml version="1.0" encoding="utf-8"?>
<!--
/*
 *  Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
 *
 *  WSO2 LLC. licenses this file to you 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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>org.wso2.integration.inbound</groupId>
  <artifactId>mi-inbound-googlepubsub</artifactId>
  <version>1.0.0</version>
  <name>mi-inbound-googlepubsub</name>
  <url>http://wso2.org</url>
  <properties>
    <carbon.mediation.version>4.7.175</carbon.mediation.version>
    <maven-shade-plugin.version>3.4.1</maven-shade-plugin.version>
    <guava.version>31.1-jre</guava.version>
    <grpc.version>1.70.0</grpc.version>
    <java.version>1.8</java.version>
  </properties>
  <dependencies>
    <!-- Carbon Mediation -->
    <dependency>
      <groupId>org.wso2.carbon.mediation</groupId>
      <artifactId>org.wso2.carbon.inbound.endpoint</artifactId>
      <version>${carbon.mediation.version}</version>
    </dependency>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-pubsub</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api-client</groupId>
      <artifactId>google-api-client</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.http-client</groupId>
      <artifactId>google-http-client-gson</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.code.gson</groupId>
      <artifactId>gson</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.auth</groupId>
      <artifactId>google-auth-library-credentials</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.auth</groupId>
      <artifactId>google-auth-library-oauth2-http</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>gax</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>api-common</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>grpc-google-cloud-pubsub-v1</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>proto-google-cloud-pubsub-v1</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>gax-grpc</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>proto-google-iam-v1</artifactId>
    </dependency>
    <dependency>
      <groupId>org.threeten</groupId>
      <artifactId>threetenbp</artifactId>
      <version>1.6.8</version>
    </dependency>
    <dependency>
      <groupId>com.google.protobuf</groupId>
      <artifactId>protobuf-java</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.api.grpc</groupId>
      <artifactId>proto-google-common-protos</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-netty-shaded</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-stub</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-core</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-auth</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-all</artifactId>
    </dependency>
    <dependency>
      <groupId>io.grpc</groupId>
      <artifactId>grpc-okhttp</artifactId>
    </dependency>
    <dependency>
      <groupId>io.perfmark</groupId>
      <artifactId>perfmark-api</artifactId>
      <version>0.26.0</version>
    </dependency>
  </dependencies>
  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.cloud</groupId>
        <artifactId>libraries-bom</artifactId>
        <version>26.31.0</version>
        <type>pom</type>
        <scope>import</scope>
      </dependency>
          <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>${guava.version}</version>
          </dependency>
      <dependency>
        <groupId>io.grpc</groupId>
        <artifactId>grpc-bom</artifactId>
        <version>1.70.0</version>  <!-- or whatever single version you need -->
        <type>pom</type>
        <scope>import</scope>
      </dependency>
    </dependencies>
  </dependencyManagement>
  <scm>
    <connection>scm:git:https://github.com/wso2-extensions/mi-inbound-googlepubsub.git</connection>
    <url>https://github.com/wso2-extensions/mi-inbound-googlepubsub.git</url>
    <developerConnection>scm:git:https://github.com/wso2-extensions/mi-inbound-googlepubsub.git</developerConnection>
    <tag>v1.0.0</tag>
  </scm>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.1</version>
        <configuration>
          <source>1.8</source>
          <target>1.8</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>${maven-shade-plugin.version}</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>shade</goal>
            </goals>
            <configuration>
              <createDependencyReducedPom>false</createDependencyReducedPom>
              <shadedArtifactAttached>false</shadedArtifactAttached>
              <outputFile>${project.build.directory}/${project.build.finalName}.jar</outputFile>
              <artifactSet>
                <includes>
                  <!-- Explicitly include Pub/Sub proto classes -->
                  <include>com.google.api.grpc:proto-google-cloud-pubsub-v1</include>
                  <include>com.google.api.grpc:grpc-google-cloud-pubsub-v1</include>
                  <include>com.google.api.grpc:proto-google-iam-v1</include>
                  <include>com.google.auth:google-auth-library-credentials</include>
                  <include>com.google.auth:google-auth-library-oauth2-http</include>
                  <include>com.google.api-client:google-api-client</include>
                  <include>com.google.http-client:google-http-client</include>
                  <include>com.google.http-client:google-http-client-jackson2</include>
                  <include>com.google.http-client:google-http-client-gson</include>
                  <include>com.google.code.gson:gson</include>
                  <include>com.google.protobuf:protobuf-java</include>
                  <include>com.google.api.grpc:proto-google-common-protos</include>
                  <include>com.google.cloud:*</include>
                  <include>com.google.api:*</include>
                  <include>com.google.guava:*</include>
                  <include>io.perfmark:perfmark-api</include>
                  <include>io.grpc:*</include>
                  <include>org.threeten:*</include>
                </includes>
              </artifactSet>
              <filters>
                <filter>
                  <artifact>*:*</artifact>
                  <excludes>
                    <exclude>META-INF/*.SF</exclude>
                    <exclude>META-INF/*.DSA</exclude>
                    <exclude>META-INF/*.RSA</exclude>
                  </excludes>
                </filter>
              </filters>
              <transformers>
                <!-- Merge service files -->
                <transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
              </transformers>
              <relocations>
                <relocation>
                  <pattern>com.google</pattern>
                  <shadedPattern>com.google.wso2.shaded</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.google.gson</pattern>
                  <shadedPattern>com.google.wso2.shaded.gson</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>io.grpc</pattern>
                  <shadedPattern>io.grpc.wso2.shaded</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>io.perfmark</pattern>
                  <shadedPattern>io.perfmark.wso2.shaded</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>org.threeten</pattern>
                  <shadedPattern>org.threeten.wso2.shaded</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.google.longrunning</pattern>
                  <shadedPattern>com.google.wso2.shaded.longrunning</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.google.protobuf</pattern>
                  <shadedPattern>com.google.wso2.shaded.protobuf</shadedPattern>
                </relocation>
                <relocation>
                  <pattern>com.google.rpc</pattern>
                  <shadedPattern>com.google.wso2.shaded.rpc</shadedPattern>
                </relocation>
              </relocations>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- Assembly Plugin -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-assembly-plugin</artifactId>
        <version>3.3.0</version>
        <executions>
          <execution>
            <id>make-assembly</id>
            <phase>package</phase>
            <goals>
              <goal>single</goal>
            </goals>
            <configuration>
              <filters>
                <filter>${basedir}/src/main/assembly/filter.properties</filter>
              </filters>
              <descriptors>
                <descriptor>src/main/assembly/zip-assembly.xml</descriptor>
              </descriptors>
              <appendAssemblyId>false</appendAssemblyId>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <repositories>
    <repository>
      <id>wso2-nexus</id>
      <name>WSO2 Nexus Repository</name>
      <url>https://maven.wso2.org/nexus/content/groups/wso2-public/</url>
      <releases>
        <enabled>true</enabled>
        <updatePolicy>daily</updatePolicy>
        <checksumPolicy>ignore</checksumPolicy>
      </releases>
    </repository>
  </repositories>
  <distributionManagement>
    <repository>
      <id>nexus-releases</id>
      <name>WSO2 Release Distribution Repository</name>
      <url>https://maven.wso2.org/nexus/content/repositories/releases/</url>
    </repository>
  </distributionManagement>
</project>
