<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2015 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>
  <parent>
    <groupId>org.sonatype.oss</groupId>
    <artifactId>oss-parent</artifactId>
    <version>7</version>
  </parent>

  <groupId>com.google.code.java-allocation-instrumenter</groupId>
  <artifactId>java-allocation-instrumenter</artifactId>
  <packaging>jar</packaging>
  <version>3.1.0</version>

  <name>java-allocation-instrumenter</name>
  <description>
    A Java agent that rewrites bytecode to instrument allocation sites.
  </description>

  <inceptionYear>2009</inceptionYear>
  <url>https://github.com/google/allocation-instrumenter/</url>

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

  <developers>
    <developer>
      <name>Jeremy Manson</name>
      <organization>Google Inc.</organization>
    </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/allocation-instrumenter.git</connection>
    <developerConnection>scm:git:git@github.com:google/allocation-instrumenter.git
    </developerConnection>
    <url>https://github.com/google/allocation-instrumenter/</url>
  </scm>

  <issueManagement>
    <system>Google Code Issue Tracking</system>
    <url>http://code.google.com/p/java-allocation-instrumenter/issues/list</url>
  </issueManagement>

  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <projectAsmVersion>6.0</projectAsmVersion>
    <gpg.skip>true</gpg.skip>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-analysis</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-commons</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-tree</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-util</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>org.ow2.asm</groupId>
      <artifactId>asm-xml</artifactId>
      <version>${projectAsmVersion}</version>
    </dependency>
    <dependency>
      <groupId>com.google.guava</groupId>
      <artifactId>guava</artifactId>
      <version>23.5-android</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <!-- specify target Java version -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.6.1</version>
        <configuration>
          <source>1.6</source>
          <target>1.6</target>
        </configuration>
      </plugin>
      <!-- configure eclipse project -->
      <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>
      <!-- define release properties -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-release-plugin</artifactId>
        <version>2.5.3</version>
        <configuration>
          <arguments>-DenableCiProfile=true</arguments>
        </configuration>
      </plugin>
      <!-- always attach sources -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>3.0.1</version>
        <executions>
          <execution>
            <id>attach-sources</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <!-- always attach javadoc -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-javadoc-plugin</artifactId>
        <version>2.10.4</version>
        <executions>
          <execution>
            <id>attach-javadocs</id>
            <goals>
              <goal>jar</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <links>
            <link>http://docs.oracle.com/javase/8/docs/api/</link>
          </links>
          <version>true</version>
          <show>public</show>
        </configuration>
      </plugin>
      <!-- preprocess bootstrap method -->
      <plugin>
        <groupId>com.google.code.maven-replacer-plugin</groupId>
        <artifactId>replacer</artifactId>
        <version>1.5.3</version>
        <executions>
          <execution>
            <phase>generate-sources</phase>
            <goals>
              <goal>replace</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <file>${project.basedir}/src/main/java/com/google/monitoring/runtime/instrumentation/Bootstrap.java.in</file>
          <outputFile>${project.build.directory}/generated-sources/java/com/google/monitoring/runtime/instrumentation/AllocationInstrumenterBootstrap.java</outputFile>
          <replacements>
            <replacement>
              <token>CLASS_NAME</token>
              <value>AllocationInstrumenter</value>
            </replacement>
            <replacement>
              <token>PACKAGE</token>
              <value>com.google.monitoring.runtime.instrumentation</value>
            </replacement>
            <replacement>
              <token>PATH_TO_CLASS</token>
              <value>com/google/monitoring/runtime/instrumentation</value>
            </replacement>
            <replacement>
              <token>PREMAIN_CLASS</token>
              <value>com.google.monitoring.runtime.instrumentation.AllocationInstrumenter</value>
            </replacement>
            <replacement>
              <token>GENERATOR</token>
              <value>https://github.com/google/allocation-instrumenter/blob/master/pom.xml</value>
            </replacement>
          </replacements>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${project.build.directory}/generated-sources/java/</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- shade Guava and ASM; strip module-info file from ASM -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-shade-plugin</artifactId>
        <version>3.1.0</version>
        <executions>
          <execution>
            <phase>package</phase>
            <goals><goal>shade</goal></goals>
          </execution>
        </executions>
        <configuration>
          <createDependencyReducedPom>false</createDependencyReducedPom>
          <artifactSet>
            <includes>
              <include>org.ow2.asm:asm</include>
              <include>org.ow2.asm:asm-analysis</include>
              <include>org.ow2.asm:asm-commons</include>
              <include>org.ow2.asm:asm-tree</include>
              <include>org.ow2.asm:asm-util</include>
              <include>org.ow2.asm:asm-xml</include>
              <include>com.google.guava:guava</include>
            </includes>
          </artifactSet>
          <filters>
            <filter>
              <artifact>*:*</artifact>
              <excludes>
                <exclude>META-INF/module-info.class</exclude>
              </excludes>
            </filter>
          </filters>
          <relocations>
            <relocation>
              <pattern>com.google.common.</pattern>
              <shadedPattern>com.google.monitoring.runtime.instrumentation.common.</shadedPattern>
            </relocation>
            <relocation>
              <pattern>org.objectweb.asm.</pattern>
              <shadedPattern>com.google.monitoring.runtime.instrumentation.asm.</shadedPattern>
            </relocation>
          </relocations>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>jarjar-maven-plugin</artifactId>
        <version>1.9</version>
        <executions>
          <execution>
            <id>embed-jars</id>
            <phase>prepare-package</phase>
            <goals>
              <goal>jarjar</goal>
            </goals>
            <configuration>
              <rules>
                <keep>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.collect.ComputingCache</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.collect.ComputingConcurrentHashMap</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.collect.ForwardingMap</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.collect.MapMaker</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.base.FunctionalEquivalence</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.base.PairwiseEquivalence</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.base.Supplier</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.base.Suppliers</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.common.primitives.Ints</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.asm.**</pattern>
                  <pattern>com.google.monitoring.runtime.instrumentation.*</pattern>
               </keep>
              </rules>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <!-- customize manifest -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-jar-plugin</artifactId>
        <version>3.0.2</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Premain-Class>com.google.monitoring.runtime.instrumentation.AllocationInstrumenterBootstrap</Premain-Class>
              <Can-Redefine-Classes>true</Can-Redefine-Classes>
              <Can-Retransform-Classes>true</Can-Retransform-Classes>
              <Main-Class>NotSuitableAsMain</Main-Class>
            </manifestEntries>
          </archive>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-gpg-plugin</artifactId>
        <version>1.6</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
