<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>com.movingtech</groupId>
  <artifactId>plasma-sdk</artifactId>
  <version>1.0.17</version>  <!-- Update this version for each release -->
  <packaging>pom</packaging>

  <name>Plasma SDK</name>
  <description>Android SDK for Plasma push notifications and user engagement</description>
  <url>https://github.com/nammayatri/plasma</url>

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

  <developers>
    <developer>
      <id>movingtech</id>
      <name>MovingTech Plasma Team</name>
      <email>sdk@nammayatri.in</email>
      <organization>MovingTech</organization>
      <organizationUrl>https://nammayatri.in</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/nammayatri/plasma.git</connection>
    <developerConnection>scm:git:ssh://github.com:nammayatri/plasma.git</developerConnection>
    <url>https://github.com/nammayatri/plasma</url>
  </scm>

  <build>
    <plugins>
      <!-- Copy AAR from Gradle build output to Maven target directory -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <version>3.3.1</version>
        <executions>
          <execution>
            <id>copy-aar</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>copy-resources</goal>
            </goals>
            <configuration>
              <outputDirectory>${project.build.directory}</outputDirectory>
              <resources>
                <resource>
                  <directory>${project.basedir}/../build/outputs/aar</directory>
                  <includes>
                    <include>plasma-sdk-release.aar</include>
                  </includes>
                </resource>
              </resources>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Attach the AAR from target directory -->
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.6.0</version>
        <executions>
          <execution>
            <id>attach-artifacts</id>
            <phase>package</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/plasma-sdk-release.aar</file>
                  <type>aar</type>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>

      <!-- Sonatype Central Publishing plugin -->
      <plugin>
        <groupId>org.sonatype.central</groupId>
        <artifactId>central-publishing-maven-plugin</artifactId>
        <version>0.9.0</version>
        <extensions>true</extensions>
        <configuration>
          <publishingServerId>central</publishingServerId>
        </configuration>
      </plugin>

      <!-- Sign the POM and all attached artifacts -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>3.2.5</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
            <configuration>
              <gpgArguments>
                <arg>--pinentry-mode</arg>
                <arg>loopback</arg>
              </gpgArguments>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
</project>
