<?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.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>5.0.3</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>18.0</version>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.2</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <build>
    <defaultGoal>package</defaultGoal>
    <plugins>
      <!-- ensure java version -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.2</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.9</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.1</version>
        <configuration>
          <arguments>-DenableCiProfile=true</arguments>
        </configuration>
      </plugin>
      <!-- always attach sources -->
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-source-plugin</artifactId>
        <version>2.4</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.1</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>
      <!-- embed dependencies -->
      <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>
              <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>
              <rules>
                <rule>
                  <pattern>org.objectweb.asm.**</pattern>
                  <result>com.google.monitoring.runtime.instrumentation.asm.@1</result>
                </rule>
                <rule>
                  <pattern>com.google.common.**</pattern>
                  <result>com.google.monitoring.runtime.instrumentation.common.@0</result>
                </rule>
                <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>2.5</version>
        <configuration>
          <archive>
            <manifestEntries>
              <Boot-Class-Path>./${project.artifactId}-${project.version}.${project.packaging}</Boot-Class-Path>
              <Premain-Class>com.google.monitoring.runtime.instrumentation.AllocationInstrumenter</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.4</version>
        <executions>
          <execution>
            <id>sign-artifacts</id>
            <phase>verify</phase>
            <goals>
              <goal>sign</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

</project>
