<?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>

    <parent>
        <artifactId>byte-buddy-parent</artifactId>
        <groupId>net.bytebuddy</groupId>
        <version>1.4.26</version>
    </parent>

    <artifactId>byte-buddy-agent</artifactId>
    <packaging>bundle</packaging>

    <properties>
        <bytebuddy.agent>net.bytebuddy.agent.Installer</bytebuddy.agent>
        <attach.package.sun>com.sun.tools.attach</attach.package.sun>
        <attach.package.ibm>com.ibm.tools.attach</attach.package.ibm>
    </properties>

    <name>Byte Buddy Java agent</name>
    <description>The Byte Buddy Java agent allows to access the JVM's HotSwap feature.</description>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <!-- Define bundle plugin in order to allow for 'bundle' packaging. -->
            <plugin>
                <groupId>org.apache.felix</groupId>
                <artifactId>maven-bundle-plugin</artifactId>
                <version>${version.plugin.bundle}</version>
                <extensions>true</extensions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>extras</id>
            <activation>
                <activeByDefault>false</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <!-- Specify OSGi packaging and agent manifest headers. -->
                    <plugin>
                        <groupId>org.apache.felix</groupId>
                        <artifactId>maven-bundle-plugin</artifactId>
                        <version>${version.plugin.bundle}</version>
                        <extensions>true</extensions>
                        <configuration>
                            <instructions>
                                <Premain-Class>${bytebuddy.agent}</Premain-Class>
                                <Agent-Class>${bytebuddy.agent}</Agent-Class>
                                <Can-Redefine-Classes>true</Can-Redefine-Classes>
                                <Can-Retransform-Classes>true</Can-Retransform-Classes>
                                <Can-Set-Native-Method-Prefix>true</Can-Set-Native-Method-Prefix>
                                <Import-Package>${attach.package.sun};resolution:="optional",${attach.package.ibm};resolution:="optional"</Import-Package>
                            </instructions>
                        </configuration>
                        <executions>
                            <execution>
                                <goals>
                                    <goal>bundle</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
