<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
-->
<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>
    <groupId>org.gatein.shindig</groupId>
    <artifactId>shindig-project</artifactId>
    <version>1.0-r790473-Patch07</version>
    <relativePath>../pom.xml</relativePath>
  </parent>

  <artifactId>shindig-features</artifactId>
  <version>1.0-r790473-Patch07</version>
  <packaging>jar</packaging>

  <name>Apache Shindig Features</name>
  <description>Packages all the features that shindig provides into a single jar file to allow
    loading from the classpath
  </description>

  <build>
    <resources>
      <resource>
        <targetPath>features</targetPath>
        <directory>${basedir}/src/main/javascript/features</directory>
      </resource>
      <resource>
        <targetPath>META-INF</targetPath>
        <directory>${basedir}</directory>
        <includes>
          <include>NOTICE</include>
        </includes>
      </resource>
    </resources>
    <testResources>
      <testResource>
        <targetPath>features</targetPath>
        <directory>${basedir}/src/test/javascript/features</directory>
      </testResource>
    </testResources>

    <pluginManagement>
      <!-- set versions of common plugins for reproducibility, ordered alphabetically by owner -->
      <plugins>
        <!-- Misc -->
        <plugin>
          <groupId>de.berlios.jsunit</groupId>
          <artifactId>jsunit-maven2-plugin</artifactId>
          <version>1.3</version>
          <dependencies>
            <dependency>
                <groupId>rhino</groupId>
                <artifactId>js</artifactId>
                <version>1.7R1</version>
            </dependency>
          </dependencies>
        </plugin>
        <plugin>
          <groupId>net.sf.alchim</groupId>
          <artifactId>yuicompressor-maven-plugin</artifactId>
          <version>0.7.1</version>
        </plugin>
      </plugins>
    </pluginManagement>

    <!-- ordered alphabetically by owner -->
    <plugins>
      <plugin>
        <groupId>de.berlios.jsunit</groupId>
        <artifactId>jsunit-maven2-plugin</artifactId>
        <executions>
          <execution>
            <configuration>
              <sourceDirectory>${basedir}/src/main/javascript/features</sourceDirectory>
              <sources>
                <source>../../../../src/test/javascript/features/mocks/env.js</source>
                <source>../../../../src/test/javascript/features/mocks/window.js</source>
                <source>../../../../src/test/javascript/features/mocks/xhr.js</source>
                <source>core/config.js</source>
                <source>core/json.js</source>
                <source>core/auth.js</source>
                <source>core/util.js</source>
                <source>core/prefs.js</source>
                <source>core/log.js</source>
                <source>core.io/io.js</source>
                <source>i18n/currencycodemap.js</source>
                <source>i18n/datetimeformat.js</source>
                <source>i18n/datetimeparse.js</source>
                <source>i18n/formatting.js</source>
                <source>i18n/numberformat.js</source>
                <source>setprefs/setprefs.js</source>
                <source>views/views.js</source>
                <source>xmlutil/xmlutil.js</source>
                <source>opensocial-data-context/datacontext.js</source>
                <source>opensocial-data/data.js</source>
                <source>opensocial-reference/opensocial.js</source>
                <source>opensocial-reference/activity.js</source>
                <source>opensocial-reference/address.js</source>
                <source>opensocial-reference/bodytype.js</source>
                <source>opensocial-reference/collection.js</source>
                <source>opensocial-reference/container.js</source>
                <source>opensocial-reference/datarequest.js</source>
                <source>opensocial-reference/dataresponse.js</source>
                <source>opensocial-reference/email.js</source>
                <source>opensocial-reference/enum.js</source>
                <source>opensocial-reference/environment.js</source>
                <source>opensocial-reference/idspec.js</source>
                <source>opensocial-reference/mediaitem.js</source>
                <source>opensocial-reference/message.js</source>
                <source>opensocial-reference/name.js</source>
                <source>opensocial-reference/navigationparameters.js</source>
                <source>opensocial-reference/organization.js</source>
                <source>opensocial-reference/person.js</source>
                <source>opensocial-reference/phone.js</source>
                <source>opensocial-reference/responseitem.js</source>
                <source>opensocial-reference/url.js</source>
                <source>opensocial-base/fieldtranslations.js</source>
                <source>opensocial-base/jsonactivity.js</source>
                <source>opensocial-base/jsonperson.js</source>
                <source>opensocial-jsonrpc/jsonrpccontainer.js</source>
                <source>osapi/osapi.js</source>
                <source>osapi/batch.js</source>
                <source>osapi/jsonrpctransport.js</source>
                <source>osapi/peoplehelpers.js</source>
                <source>../../../../src/test/javascript/lib/testutils.js</source>
               <source>oauthpopup/oauthpopup.js</source>
              </sources>
              <testSourceDirectory>${basedir}/src/test/javascript/features</testSourceDirectory>
              <testSuites>
                <testSuite>
                  <name>FeatureTests</name>
                  <type>TESTCASES</type>
                  <includes>
                    <include>mocks/*.js</include>
                    <include>*/*test.js</include>
                  </includes>
                </testSuite>
              </testSuites>
            </configuration>
            <goals>
              <goal>jsunit-test</goal>
            </goals>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <configuration>
          <encoding>UTF-8</encoding>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
      </plugin>
      <plugin>
        <!-- TODO: Replace this with the more generic javascript plugin that
          allows the use of arbitrary compressor / compilers.
          The maven-javascript-plugin does not seem to work.
        -->
        <!-- <groupId>net.sf.hammerfest</groupId> -->
        <!-- <artifactId>maven-javascript-plugin</artifactId> -->
        <groupId>net.sf.alchim</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <suffix>.opt</suffix>
          <excludes>
            <exclude>**/*.xml</exclude>
            <!-- Caja & swfobject are already minified -->
            <exclude>**/caja/*.js</exclude>
            <exclude>**/swfobject/*.js</exclude>
          </excludes>
          <jswarn>false</jswarn>
          <statistics>false</statistics>
        </configuration>
      </plugin>
    </plugins>
  </build>

  <profiles>
    <profile>
      <id>reporting</id>
      <build>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <executions>
              <execution>
                <id>create-jsdoc-home</id>
                <phase>site</phase>
                <goals>
                  <goal>unpack</goal>
                </goals>
                <configuration>
                  <artifactItems>
                    <artifactItem>
                      <groupId>org.jsdoctoolkit</groupId>
                      <artifactId>jsdoc</artifactId>
                      <version>2.1.0</version>
                      <type>jar</type>
                      <overWrite>true</overWrite>
                      <outputDirectory>${project.build.directory}/jsdoc-toolkit</outputDirectory>
                    </artifactItem>
                  </artifactItems>
                </configuration>
              </execution>
            </executions>
          </plugin>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <executions>
              <execution>
                <id>run-jsdoc</id>
                <phase>site</phase>
                <configuration>
                  <tasks>

                    <taskdef name="jsdoctoolkit" classname="uk.co.darrenhurley.ant.tasks.JsDocToolkit" />

                    <mkdir dir="${project.reporting.outputDirectory}/jsdoc" />

                    <jsdoctoolkit jsdochome="${project.build.directory}/jsdoc-toolkit/" template="jsdoc" outputdir="${project.reporting.outputDirectory}/jsdoc">
                      <fileset dir="${basedir}/src/main/javascript/features">
                        <include name="**/*.js" />
                      </fileset>
                    </jsdoctoolkit>

                  </tasks>
                </configuration>
                <goals>
                  <goal>run</goal>
                </goals>
              </execution>
            </executions>
            <dependencies>
              <dependency>
                <groupId>org.jsdoctoolkit</groupId>
                <artifactId>jsdoctoolkit-ant-task</artifactId>
                <version>1.0</version>
                <exclusions>
                  <exclusion>
                    <groupId>ant</groupId>
                    <artifactId>ant-contrib</artifactId>
                  </exclusion>
                </exclusions>
              </dependency>
              <dependency>
                <groupId>rhino</groupId>
                <artifactId>js</artifactId>
                <version>1.7R1</version>
              </dependency>
            </dependencies>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>
</project>
