<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.7.2</version>
      <relativePath>../pom.xml</relativePath>
  </parent>
  <groupId>com.github.lltyk</groupId>
  <artifactId>dojo-shrinksafe</artifactId>
  <packaging>jar</packaging>
  <name>Dojo Toolkit :: Shrinksafe</name>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
      <groupId>rhino</groupId>
      <artifactId>js</artifactId>
      <version>1.7R1</version>
      <scope>provided</scope>
    </dependency>
  </dependencies>
  <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>
        <groupId>org.sonatype.plugins</groupId>
        <artifactId>jarjar-maven-plugin</artifactId>
        <executions>
          <execution>
            <phase>package</phase>
            <goals>
              <goal>jarjar</goal>
            </goals>
            <configuration>
              <includes>
                <include>rhino:js</include>
              </includes>
              <rules>
                <rule>
                  <pattern>org.mozilla.javascript.**</pattern>
                  <result>com.github.lltyk.rhino17r1.@1</result>
                </rule>
                <rule>
                  <pattern>org.mozilla.classfile.**</pattern>
                  <result>com.github.lltyk.rhino17r1.classfile.@1</result>
                </rule>
<!--                <keep>
                  <pattern>com.google.inject.**</pattern>
                </keep>-->
              </rules>
            </configuration>
          </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>
    <pluginManagement>
    	<plugins>
    		<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
    		<plugin>
    			<groupId>org.eclipse.m2e</groupId>
    			<artifactId>lifecycle-mapping</artifactId>
    			<version>1.0.0</version>
    			<configuration>
    				<lifecycleMappingMetadata>
    					<pluginExecutions>
    						<pluginExecution>
    							<pluginExecutionFilter>
    								<groupId>org.codehaus.mojo</groupId>
    								<artifactId>
    									wagon-maven-plugin
    								</artifactId>
    								<versionRange>
    									[1.0-beta-1,)
    								</versionRange>
    								<goals>
    									<goal>download-single</goal>
    								</goals>
    							</pluginExecutionFilter>
    							<action>
    								<ignore></ignore>
    							</action>
    						</pluginExecution>
    						<pluginExecution>
    							<pluginExecutionFilter>
    								<groupId>
    									org.apache.maven.plugins
    								</groupId>
    								<artifactId>
    									maven-antrun-plugin
    								</artifactId>
    								<versionRange>[1.4,)</versionRange>
    								<goals>
    									<goal>run</goal>
    								</goals>
    							</pluginExecutionFilter>
    							<action>
    								<ignore></ignore>
    							</action>
    						</pluginExecution>
    					</pluginExecutions>
    				</lifecycleMappingMetadata>
    			</configuration>
    		</plugin>
    	</plugins>
    </pluginManagement>
  </build>
</project>
