<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2011 Google Inc.
  ~
  ~ Licensed 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>com.google.caliper</groupId>
  <artifactId>caliper-parent</artifactId>
  <version>1.0-beta-3</version>
  <packaging>pom</packaging>

  <name>Caliper Maven Parent</name>
  <description>Maven parent POM for Caliper modules</description>

  <url>https://github.com/google/caliper</url>

  <inceptionYear>2009</inceptionYear>

  <organization>
    <name>Google Inc.</name>
    <url>http://www.google.com</url>
  </organization>

  <developers>
    <developer>
      <name>Gregory Kick</name>
      <organization>Google Inc.</organization>
    </developer>
    <developer>
      <name>Colin Decker</name>
      <organization>Google Inc.</organization>
    </developer>
    <developer>
      <name>Jesse Wilson</name>
    </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>

  <scm>
    <connection>scm:git:https://github.com/google/caliper.git</connection>
    <developerConnection>scm:git:git@github.com:google/caliper.git</developerConnection>
    <url>https://github.com/google/caliper</url>
  </scm>

  <issueManagement>
    <system>GitHub Issues</system>
    <url>https://github.com/google/caliper/issues</url>
  </issueManagement>

  <distributionManagement>
    <snapshotRepository>
      <id>sonatype-nexus-snapshots</id>
      <name>Sonatype Nexus Snapshots</name>
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url>
    </snapshotRepository>
    <repository>
      <id>sonatype-nexus-staging</id>
      <name>Nexus Release Repository</name>
      <url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
    </repository>
  </distributionManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <dagger.version>2.22.1</dagger.version>
    <autovalue.version>1.8.1</autovalue.version>
    <maven-source-plugin.version>3.2.1</maven-source-plugin.version>
    <maven-javadoc-plugin.version>3.3.0</maven-javadoc-plugin.version>
  </properties>

  <modules>
    <module>caliper</module>
    <module>caliper-api</module>
    <module>caliper-core</module>
    <module>caliper-examples</module>
    <module>caliper-runner</module>
    <module>caliper-util</module>
    <module>caliper-worker</module>
    <module>caliper-worker-android</module>
    <module>caliper-worker-jvm</module>
  </modules>

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>com.google.code.findbugs</groupId>
        <artifactId>jsr305</artifactId>
        <version>1.3.9</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.7</version>
      </dependency>
      <dependency>
        <groupId>joda-time</groupId>
        <artifactId>joda-time</artifactId>
        <version>2.10.10</version>
      </dependency>
      <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.19.4</version>
      </dependency>
      <dependency>
        <groupId>com.squareup.okhttp</groupId>
        <artifactId>okhttp</artifactId>
        <version>2.7.5</version>
      </dependency>
      <dependency>
        <groupId>com.google.dagger</groupId>
        <artifactId>dagger</artifactId>
        <version>${dagger.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.dagger</groupId>
        <artifactId>dagger-producers</artifactId>
        <version>${dagger.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.auto.value</groupId>
        <artifactId>auto-value-annotations</artifactId>
        <version>${autovalue.version}</version>
      </dependency>
      <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>30.1.1-jre</version>
      </dependency>
      <dependency>
        <groupId>com.google.code.java-allocation-instrumenter</groupId>
        <artifactId>java-allocation-instrumenter</artifactId>
        <version>3.3.0</version>
      </dependency>
      <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.13.2</version>
      </dependency>
      <dependency>
        <groupId>com.google.truth</groupId>
        <artifactId>truth</artifactId>
        <version>1.1.3</version>
      </dependency>
      <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-all</artifactId>
        <version>1.10.19</version>
      </dependency>
    </dependencies>
  </dependencyManagement>

  <build>
    <defaultGoal>package</defaultGoal>

    <pluginManagement>
      <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>
            <annotationProcessorPaths>
              <path>
                <groupId>com.google.auto.value</groupId>
                <artifactId>auto-value</artifactId>
                <version>${autovalue.version}</version>
              </path>
              <path>
                <groupId>com.google.dagger</groupId>
                <artifactId>dagger-compiler</artifactId>
                <version>${dagger.version}</version>
              </path>
              <!-- TODO(cpovirk): Remove this after updating AutoValue's dep. -->
              <path>
                <groupId>com.squareup</groupId>
                <artifactId>javapoet</artifactId>
                <version>1.11.1</version>
              </path>
            </annotationProcessorPaths>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-jar-plugin</artifactId>
          <version>3.2.0</version>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-eclipse-plugin</artifactId>
          <version>2.10</version>
          <configuration>
            <downloadSources>true</downloadSources>
            <downloadJavadocs>true</downloadJavadocs>
            <workspace>../eclipse-ws/</workspace>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-release-plugin</artifactId>
          <version>2.5.3</version>
          <configuration>
            <arguments>-DenableCiProfile=true</arguments>
          </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>generate-javadocs</id>
              <phase>site</phase>
              <goals>
                <goal>javadoc</goal>
              </goals>
            </execution>
          </executions>
          <configuration>
            <links>
              <link>https://docs.oracle.com/javase/8/docs/api/</link>
            </links>
            <version>true</version>
            <show>public</show>
            <doclint>none</doclint>
          </configuration>
        </plugin>
        <plugin>
          <groupId>org.apache.maven.plugins</groupId>
          <artifactId>maven-shade-plugin</artifactId>
          <version>3.2.4</version>
          <executions>
            <execution>
              <phase>package</phase>
              <goals>
                <goal>shade</goal>
              </goals>
              <configuration>
                <shadedArtifactAttached>true</shadedArtifactAttached>
                <shadedClassifierName>all</shadedClassifierName>
                <!-- disable relocation as it is breaking some reflection -->
                <!-- <relocations>
                  <relocation>
                    <pattern>com.google</pattern>
                    <shadedPattern>com.google.caliper.shaded.com.google</shadedPattern>
                    <excludes>
                      <exclude>com.google.caliper.**</exclude>
                    </excludes>
                  </relocation>
                  <relocation>
                    <pattern>com.sun.jersey</pattern>
                    <shadedPattern>com.google.caliper.shaded.com.sun.jersey</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>com.sun.ws</pattern>
                    <shadedPattern>com.google.caliper.shaded.com.sun.ws</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>javax.inject</pattern>
                    <shadedPattern>com.google.caliper.shaded.javax.inject</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>javax.ws</pattern>
                    <shadedPattern>com.google.caliper.shaded.javax.ws</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>org.aopalliance</pattern>
                    <shadedPattern>com.google.caliper.shaded.org.aopalliance</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>org.joda</pattern>
                    <shadedPattern>com.google.caliper.shaded.org.joda</shadedPattern>
                  </relocation>
                  <relocation>
                    <pattern>org.objectweb</pattern>
                    <shadedPattern>com.google.caliper.shaded.org.objectweb</shadedPattern>
                  </relocation>
                </relocations> -->
                <transformers>
                  <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
                    <manifestEntries>
                      <Premain-Class>com.google.monitoring.runtime.instrumentation.AllocationInstrumenter</Premain-Class>
                      <Can-Redefine-Classes>true</Can-Redefine-Classes>
                      <Can-Retransform-Classes>true</Can-Retransform-Classes>
                    </manifestEntries>
                  </transformer>
                </transformers>
              </configuration>
            </execution>
          </executions>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

  <profiles>
    <profile>
        <id>sonatype-oss-release</id>
        <build>
          <plugins>
            <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>3.0.1</version>
              <executions>
                <execution>
                  <id>sign-artifacts</id>
                  <phase>verify</phase>
                  <goals>
                    <goal>sign</goal>
                  </goals>
                </execution>
              </executions>
            </plugin>
          </plugins>
      </build>
    </profile>
  </profiles>

</project>
