<?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>
  <name>Tycho Distribution</name>

  <parent>
    <artifactId>tycho</artifactId>
    <groupId>org.codehaus.tycho</groupId>
    <version>0.4.0-DEV-3065</version>
  </parent>

  <artifactId>tycho-distribution</artifactId>

  <dependencies>
    <dependency>
      <groupId>org.codehaus.tycho</groupId>
      <artifactId>tycho-osgi-components</artifactId>
      <version>${project.version}</version>
    </dependency>
    <dependency>
      <groupId>org.eclipse</groupId>
      <artifactId>org.eclipse.osgi</artifactId>
    </dependency>
    <dependency>
      <groupId>org.sonatype.tycho</groupId>
      <artifactId>tycho-equinox</artifactId>
      <version>${project.version}</version>
    </dependency>     
    <dependency>
      <groupId>org.sonatype.tycho</groupId>
      <artifactId>tycho-p2-facade</artifactId>
      <version>${project.version}</version>
    </dependency>
  </dependencies>

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-dependency-plugin</artifactId>
        <executions>
          <execution>
            <id>copy</id>
            <configuration>
              <outputAbsoluteArtifactFilename>true</outputAbsoluteArtifactFilename>
              <artifactItems>
                <artifactItem>
                  <groupId>org.apache.maven</groupId>
                  <artifactId>apache-maven</artifactId>
                  <version>${maven-version}</version>
                  <classifier>bin</classifier>
                  <type>tar.gz</type>
                </artifactItem>
              </artifactItems>
            </configuration>
            <phase>process-sources</phase>
            <goals>
              <goal>unpack</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>bootstrap</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>create-bootstrap-distro</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>directory-single</goal>
                </goals>
                <configuration>
                  <attach>false</attach>
                  <descriptor>src/main/assembly/bin.xml</descriptor>
                  <outputDirectory>target</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

    <profile>
      <id>full</id>
      <activation>
        <property>
          <name>tycho-version</name>
        </property>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.sonatype.tycho</groupId>
          <artifactId>tycho-p2-runtime</artifactId>
          <version>${project.version}</version>
          <type>zip</type>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>copy-osgi</id>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.sonatype.tycho</groupId>
                      <artifactId>tycho-p2-runtime</artifactId>
                      <version>${project.version}</version>
                      <type>zip</type>
                      <outputDirectory>${project.build.directory}/dependency/tycho-p2-runtime</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
                <phase>process-sources</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-assembly-plugin</artifactId>
            <executions>
              <execution>
                <id>create-distro</id>
                <phase>process-sources</phase>
                <goals>
                  <goal>single</goal>
                </goals>
                <configuration>
                  <descriptor>src/main/assembly/osgi-bin.xml</descriptor>
                  <outputDirectory>target</outputDirectory>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>

  </profiles>
</project>
