<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.dojotoolkit</groupId>
      <artifactId>dojo-maven</artifactId>
      <version>1.6.1</version>
      <relativePath>../pom.xml</relativePath>
  </parent>
  <groupId>org.dojotoolkit</groupId>
  <artifactId>dojo-shrinksafe</artifactId>
  <packaging>jar</packaging>
  <name>Dojo Toolkit :: Shrinksafe</name>
  <dependencies>
    <dependency>
      <groupId>rhino</groupId>
      <artifactId>js</artifactId>
      <version>1.7R1</version> 
    </dependency>     
  </dependencies>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <build>
    <defaultGoal>install</defaultGoal>
    <sourceDirectory>${project.build.directory}/generated-src</sourceDirectory>     
    <resources>
      <resource>
        <directory>${project.build.directory}/generated-src/org/dojotoolkit/shrinksafe/resources</directory>
        <targetPath>org/dojotoolkit/shrinksafe/resources</targetPath>
      </resource>
    </resources>
    <plugins>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>wagon-maven-plugin</artifactId>
        <version>1.0-beta-1</version>
        <executions>
          <execution>
            <id>download-dojo</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>download-single</goal>
            </goals>
            <configuration>
              <serverId>dojotoolkit</serverId>
              <url>http://download.dojotoolkit.org/release-${dojo.version}</url>
              <fromFile>dojo-release-${dojo.version}-shrinksafe.tar.gz</fromFile>
              <toDir>${project.build.directory}</toDir>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>unpack</id>
            <configuration>
              <tasks>     
                <untar compression="gzip" src="${project.build.directory}/dojo-release-${dojo.version}-shrinksafe.tar.gz" dest="${project.build.directory}">
                  <patternset>
                    <include name="**/src/**"/>
                  </patternset>
                  <globmapper from="dojo-release-${dojo.version}-shrinksafe/src/*" to="generated-src/*"/>
                </untar>                
              </tasks>
            </configuration>
            <phase>process-sources</phase>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>    

      <plugin>
        <artifactId>maven-jar-plugin</artifactId>
        <configuration>
          <archive>
	    <addMavenDescriptor>false</addMavenDescriptor>
	    <manifestFile>${project.build.directory}/generated-src/manifest</manifestFile>
          </archive>
        </configuration>
      </plugin>

      <plugin>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
    </plugins>
  </build>
</project>
