<?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>ru.sbtqa</groupId>
  <artifactId>yandexdriver-bin</artifactId>
  <version>20.7.0</version>
  <name>yandexdriver-bin</name>
  <description>Package yandexdriver as maven artifact</description>
  <url>http://github.com/sbtqa/yandexdriver-bin</url>

  <licenses>
    <license>
      <name>Yandexdriver license</name>
      <url>
        https://github.com/yandex/YandexDriver/blob/master/LICENSE
      </url>
      <distribution>repo</distribution>
    </license>
  </licenses>

  <developers>
    <developer>
      <name>Viktor Sidochenko</name>
      <email>viktor.sidochenko@gmail.com</email>
      <organization>sbtqa</organization>
      <organizationUrl>http://github.com/sbtqa</organizationUrl>
    </developer>
  </developers>

  <scm>
    <connection>scm:git:git://github.com/sbtqa/yandexdriver-bin</connection>
    <developerConnection>scm:git:ssh://github.com:sbtqa/yandexdriver-bin.git</developerConnection>
    <url>https://github.com/sbtqa/yandexdriver-bin/tree/master</url>
  </scm>

  <properties>
    <win32.version>899</win32.version>
    <win32.phase.wget>pre-integration-test</win32.phase.wget>
    <win32.phase.attach>package</win32.phase.attach>

    <linux64.version></linux64.version>
    <linux64.phase.wget>pre-integration-test</linux64.phase.wget>
    <linux64.phase.attach>package</linux64.phase.attach>

    <mac64.version>869</mac64.version>
    <mac64.phase.wget>pre-integration-test</mac64.phase.wget>
    <mac64.phase.attach>package</mac64.phase.attach>

    <maven.compilier.plugin.version>3.3</maven.compilier.plugin.version>
    <nexus.staging.maven.plugin.version>1.6.3</nexus.staging.maven.plugin.version>
    <maven.source.plugin.version>2.2.1</maven.source.plugin.version>
    <maven.javadoc.plugin.version>2.9.1</maven.javadoc.plugin.version>
    <maven.gpg.plugin.version>1.5</maven.gpg.plugin.version>
  </properties>

  <build>
    <plugins>
      <plugin>
        <groupId>com.googlecode.maven-download-plugin</groupId>
        <artifactId>download-maven-plugin</artifactId>
        <version>1.4.0</version>
        <executions>
          <execution>
            <id>download-win32</id>
            <phase>${win32.phase.wget}</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>
                https://github.com/yandex/YandexDriver/releases/download/v${project.version}-stable/yandexdriver-${project.version}.${win32.version}-win.zip
              </url>
              <unpack>true</unpack>
              <outputDirectory>${project.build.directory}/win32</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>download-linux64</id>
            <phase>${linux64.phase.wget}</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>
                https://github.com/yandex/YandexDriver/releases/download/v${project.version}-stable/yandexdriver-${project.version}.${linux64.version}-linux.zip
              </url>
              <unpack>true</unpack>
              <outputDirectory>${project.build.directory}/linux64</outputDirectory>
            </configuration>
          </execution>
          <execution>
            <id>download-mac64</id>
            <phase>${mac64.phase.wget}</phase>
            <goals>
              <goal>wget</goal>
            </goals>
            <configuration>
              <url>
                https://github.com/yandex/YandexDriver/releases/download/v${project.version}-stable/yandexdriver-${project.version}.${mac64.version}-mac.zip
              </url>
              <unpack>true</unpack>
              <outputDirectory>${project.build.directory}/mac64</outputDirectory>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>1.10</version>
        <executions>
          <execution>
            <id>attach-linux64</id>
            <phase>${linux64.phase.attach}</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/linux64/yandexdriver</file>
                  <type>bin</type>
                  <classifier>linux64</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
          <execution>
            <id>attach-win32</id>
            <phase>${win32.phase.attach}</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/win32/yandexdriver.exe</file>
                  <type>bin</type>
                  <classifier>win32</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
          <execution>
            <id>attach-mac64</id>
            <phase>${mac64.phase.attach}</phase>
            <goals>
              <goal>attach-artifact</goal>
            </goals>
            <configuration>
              <artifacts>
                <artifact>
                  <file>${project.build.directory}/mac64/yandexdriver</file>
                  <type>bin</type>
                  <classifier>mac64</classifier>
                </artifact>
              </artifacts>
            </configuration>
          </execution>
        </executions>
      </plugin>
      </plugins>
  </build>

  <profiles>
    <profile>
      <id>release</id>
      <activation>
        <property>
          <name>release</name>
          <value>true</value>
        </property>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compilier.plugin.version}</version>
          </plugin>
          <plugin>
            <groupId>org.sonatype.plugins</groupId>
            <artifactId>nexus-staging-maven-plugin</artifactId>
            <version>${nexus.staging.maven.plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
              <serverId>ossrh</serverId>
              <nexusUrl>https://oss.sonatype.org/</nexusUrl>
              <autoReleaseAfterClose>true</autoReleaseAfterClose>
            </configuration>
          </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-no-fork</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <version>${maven.javadoc.plugin.version}</version>
            <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>${maven.gpg.plugin.version}</version>
            <executions>
              <execution>
                <id>sign-artifacts</id>
                <phase>verify</phase>
                <goals>
                  <goal>sign</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

</project>
