<?xml version="1.0"?>
<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>
  <artifactId>google-cloud-spanner-jdbc</artifactId>
  <version>1.2.0</version><!-- {x-version-update:google-cloud-spanner-jdbc:current} -->
  <packaging>jar</packaging>
  <name>Google Cloud Spanner JDBC</name>
  <url>https://github.com/googleapis/google-cloud-java/tree/master/google-cloud-clients/google-cloud-contrib/google-cloud-spanner-jdbc</url>
  <description>
    JDBC driver for Google Cloud Spanner.
  </description>
  <parent>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-contrib</artifactId>
    <version>0.110.0-alpha</version><!-- {x-version-update:google-cloud-contrib:current} -->
  </parent>
  <properties>
    <site.installationModule>google-cloud-spanner-jdbc</site.installationModule>
  </properties>
  <dependencies>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>google-cloud-spanner</artifactId>
    </dependency>
    <dependency>
      <groupId>com.google.cloud</groupId>
      <artifactId>google-cloud-storage</artifactId>
    </dependency>
    <dependency>
      <groupId>${project.groupId}</groupId>
      <artifactId>google-cloud-spanner</artifactId>
      <version>1.37.0</version><!-- {x-version-update:google-cloud-spanner:current} -->
      <type>test-jar</type>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.api</groupId>
      <artifactId>gax-grpc</artifactId>
      <classifier>testlib</classifier>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>com.google.truth</groupId>
      <artifactId>truth</artifactId>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mockito</groupId>
      <artifactId>mockito-core</artifactId>
      <version>1.9.5</version>
      <scope>test</scope>
    </dependency>
  </dependencies>
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>3.0.0-M3</version>
        <configuration>
          <excludedGroups>com.google.cloud.spanner.IntegrationTest</excludedGroups>
          <reportNameSuffix>sponge_log</reportNameSuffix>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-failsafe-plugin</artifactId>
        <version>3.0.0-M3</version>
        <configuration>
          <systemPropertyVariables>
            <spanner.testenv.config.class>com.google.cloud.spanner.GceTestEnvConfig</spanner.testenv.config.class>
            <spanner.testenv.instance>projects/gcloud-devel/instances/spanner-testing</spanner.testenv.instance>
          </systemPropertyVariables>
          <groups>com.google.cloud.spanner.IntegrationTest</groups>
          <excludedGroups>com.google.cloud.spanner.FlakyTest</excludedGroups>
          <forkedProcessTimeoutInSeconds>2400</forkedProcessTimeoutInSeconds>
        </configuration>
        <executions>
          <execution>
            <goals>
              <goal>integration-test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>
  <profiles>
    <profile>
      <!-- Profile for generating new sql test scripts. See ConnectionImplGeneratedSqlScriptTest 
        for more information. -->
      <id>generate-test-sql-scripts</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <executions>
              <execution>
                <id>generateTestScripts</id>
                <phase>compile</phase>
                <goals>
                  <goal>java</goal>
                </goals>
                <configuration>
                  <mainClass>com.google.cloud.spanner.jdbc.SqlTestScriptsGenerator</mainClass>
                  <systemProperties>
                    <systemProperty>
                      <key>do_log_statements</key>
                      <value>true</value>
                    </systemProperty>
                  </systemProperties>
                  <classpathScope>test</classpathScope>
                  <skip>false</skip>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
    <profile>
      <!-- Profile for building a jar containing all dependencies and the 
        JDBC driver. This jar can then be used with third-party tools that support 
        generic JDBC drivers to connect to Cloud Spanner databases. -->
      <id>build-jdbc-driver</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <version>3.2.1</version>
            <executions>
              <execution>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <createSourcesJar>true</createSourcesJar>
                  <shadeSourcesContent>true</shadeSourcesContent>
                  <shadedArtifactAttached>false</shadedArtifactAttached>
                  <createDependencyReducedPom>false</createDependencyReducedPom>
                  <artifactSet>
                    <includes>
                      <include>*:*</include>
                    </includes>
                    <excludes>
                      <exclude>java:*</exclude>
                      <exclude>junit:*</exclude>
                    </excludes>
                  </artifactSet>
                  <transformers>
                    <transformer
                      implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
                    <transformer
                      implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                      <resource>META-INF/services</resource>
                      <file>java.sql.Driver</file>
                    </transformer>
                    <transformer
                      implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                      <resource>com.google.cloud.spanner.jdbc</resource>
                      <file>ClientSideStatements.json</file>
                    </transformer>
                    <transformer
                      implementation="org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                      <resource>com.google.cloud.spanner.jdbc</resource>
                      <file>*.sql</file>
                    </transformer>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
