<?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/maven-v4_0_0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.codehaus.tycho</groupId>
    <artifactId>tycho</artifactId>
    <version>0.3.0-SNAPSHOT-1271</version>
  </parent>

  <artifactId>tycho-osgi-components</artifactId>

  <name>Tycho OSGi Components</name>
  <description>Components for OSGi operations</description>

  <build>
    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <excludes>
          <exclude>META-INF/plexus/components.xml</exclude>
        </excludes>
      </resource>
    </resources>

    <plugins>
      <plugin>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-maven-plugin</artifactId>
        <version>1.3.8</version>
        <executions>
          <execution>
            <phase>process-classes</phase>
            <goals>
              <goal>descriptor</goal>
              <goal>merge-descriptors</goal>
            </goals>
            <configuration>
              <fileName>generated-components.xml</fileName>
              <descriptors>
                <descriptor>${project.build.outputDirectory}/generated-components.xml</descriptor>
                <descriptor>src/main/resources/META-INF/plexus/components.xml</descriptor>
              </descriptors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      
    </plugins>
  </build>

  <dependencies>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-core</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-project</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven</groupId>
      <artifactId>maven-plugin-api</artifactId>
    </dependency>
    <dependency>
      <groupId>org.apache.maven.artifact</groupId>
      <artifactId>maven-artifact</artifactId>
    </dependency>
    <dependency>
      <groupId>org.codehaus.plexus</groupId>
      <artifactId>plexus-utils</artifactId>
    </dependency>
    <dependency>
      <groupId>org.eclipse</groupId>
      <artifactId>org.eclipse.osgi</artifactId>
    </dependency>

    <dependency>
      <groupId>org.codehaus.tycho</groupId>
      <artifactId>tycho-testing-harness</artifactId>
      <version>${project.version}</version>
      <scope>test</scope>
    </dependency>
  </dependencies>

  <profiles>
    <profile>
      <id>osgi</id>
      <activation>
        <property>
          <name>tycho-version</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.tycho</groupId>
          <artifactId>tycho-p2-app</artifactId>
          <version>${project.version}</version>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <!-- assemble p2 client to test with -->
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>2.0</version>
            <executions>
              <execution>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.codehaus.tycho</groupId>
                      <artifactId>tycho-p2-runtime</artifactId>
                      <version>${tycho-p2-runtime-version}</version>
                      <type>zip</type>
                      <outputDirectory>target/dependency</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <phase>generate-test-resources</phase>
                <goals>
                  <goal>directory-single</goal>
                </goals>
                <configuration>
                  <descriptor>src/test/assembly/test-assembly.xml</descriptor>
                  <outputDirectory>target</outputDirectory>
                  <finalName>p2</finalName>
                </configuration>
              </execution>
            </executions>
          </plugin>
    
          <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>2.4.3</version>
            <configuration>
              <systemProperties>
                <property>
                  <name>tycho.p2.location</name>
                  <value>${project.basedir}/target/p2-bin.dir/p2/p2</value>
                </property>
              </systemProperties>
            </configuration>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
