<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
  ~  Copyright (c) 2009, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~  WSO2 Inc. 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/maven-v4_0_0.xsd">

    <parent>
        <groupId>org.wso2.iot</groupId>
        <artifactId>wso2iot-broker-parent</artifactId>
        <version>3.1.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2iot-broker</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 IoT - Broker - Product Distribution</name>
    <url>http://wso2.com/products/message-broker</url>
    <description>WSO2 IoT Broker Distribution</description>

    <dependencies>
        <dependency>
            <groupId>org.apache.rampart</groupId>
            <artifactId>rampart</artifactId>
            <type>mar</type>
        </dependency>
        <dependency>
            <groupId>slf4j.wso2</groupId>
            <artifactId>slf4j</artifactId>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.andes.wso2</groupId>
            <artifactId>andes-client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.geronimo.specs.wso2</groupId>
            <artifactId>geronimo-jms_1.1_spec</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.commons</groupId>
            <artifactId>org.wso2.carbon.event.client</artifactId>
        </dependency>
        <dependency>
            <groupId>org.wso2.carbon.commons</groupId>
            <artifactId>org.wso2.carbon.event.client.stub</artifactId>
        </dependency>
        <dependency>
            <groupId>jline</groupId>
            <artifactId>jline</artifactId>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.0-alpha-4</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>unpack-wso2carbon</id>
                        <phase>package</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.wso2.carbon</groupId>
                                    <artifactId>wso2carbon-core</artifactId>
                                    <version>${carbon.kernel.version}</version>
                                    <type>zip</type>
                                    <overWrite>true</overWrite>
                                    <outputDirectory>target</outputDirectory>
                                </artifactItem>
                            </artifactItems>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <id>extract-docs-from-components</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <tasks>
                                <property name="tempdir" value="target/docs-temp" />
                                <mkdir dir="${tempdir}" />
                                <unzip dest="${tempdir}">
                                    <fileset dir="target">
                                        <include name="wso2iot-broker-${product.iot.broker.version}.zip" />
                                    </fileset>
                                </unzip>
                                <!-- Disabling default way of checking authorizations due to https://wso2.org/jira/browse/IDENTITY-3489-->
                                <replace file="target/wso2carbon-core-${carbon.kernel.version}/repository/conf/user-mgt.xml" token="&lt;Property name=&quot;GetAllRolesOfUserEnabled&quot;&gt;true&lt;/Property&gt;" value="&lt;!--Property name=&quot;GetAllRolesOfUserEnabled&quot;&gt;true&lt;/Property--&gt;" />
                                <copy todir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/" overwrite="false">
                                    <fileset dir="${tempdir}/wso2iot-broker-${product.iot.broker.version}/repository/components/">
                                    </fileset>
                                </copy>
                                <unzip dest="${tempdir}">
                                    <fileset dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/">
                                        <include name="*.ui*.jar" />
                                    </fileset>
                                </unzip>
                                <move todir="${tempdir}/web/" includeemptydirs="false">
                                    <fileset dir="${tempdir}/web/">
                                        <exclude name="**/yui/**" />
                                        <!--<exclude name="**/tenant-login/**" />-->
                                        <exclude name="**/codepress/**" />
                                        <exclude name="**/editarea/**" />
                                        <exclude name="**/ajax/**" />
                                        <exclude name="**/WEB-INF/**" />
                                        <include name="**/*.html" />
                                    </fileset>
                                    <mapper type="glob" from="*.html" to="*.xml" />
                                </move>
                                <mkdir dir="src/site/xdoc" />
                                <copy todir="src/site/xdoc" overwrite="false" includeemptydirs="false">
                                    <fileset dir="${tempdir}/web">
                                        <exclude name="**/yui/**" />
                                        <exclude name="**/codepress/**" />
                                        <exclude name="**/editarea/**" />
                                        <exclude name="**/ajax/**" />
                                        <exclude name="**/WEB-INF/**" />
                                        <exclude name="**/*.html" />
                                        <exclude name="**/*.js" />
                                        <exclude name="**/*.jsp" />
                                        <exclude name="**/*.xsl" />
                                        <exclude name="*.*" />
                                    </fileset>
                                </copy>
                                <copy todir="target/site/" overwrite="false" includeemptydirs="false">
                                    <fileset dir="src/site/xdoc/">
                                        <include name="**/images/*.*" />
                                    </fileset>
                                </copy>
                                <!--<delete dir="${tempdir}" />-->
                                <property name="tempdir2" value="target/identity-ui" />
                                <mkdir dir="${tempdir2}" />
                                <!--Moving "Users and Roles" to Configure Tab-->
                                <unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.user.mgt.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />

                                <replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;identity_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
                                <zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.user.mgt.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />

                                <!--Moving "User Stores" menu to Configure Tab-->
                                <delete dir="${tempdir2}" />
                                <mkdir dir="${tempdir2}" />
                                <unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.identity.user.store.configuration.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />

                                <replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;identity_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
                                <zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.identity.user.store.configuration.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />

                                <!--Moving "Keystores" menu to Configure Tab-->
                                <delete dir="${tempdir2}" />
                                <mkdir dir="${tempdir2}" />
                                <unzip src="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.security.mgt.ui_${carbon.identity.framework.version}.jar" dest="${tempdir2}" />

                                <replace file="${tempdir2}/META-INF/component.xml" token="&lt;parent-menu&gt;manage_menu&lt;/parent-menu&gt;" value="&lt;parent-menu&gt;configure_menu&lt;/parent-menu&gt;" />
                                <zip destfile="target/wso2carbon-core-${carbon.kernel.version}/repository/components/plugins/org.wso2.carbon.security.mgt.ui_${carbon.identity.framework.version}.jar" basedir="${tempdir2}" />
                            </tasks>
                        </configuration>
                    </execution>
                    <execution>
                        <id>clean_target</id>
                        <phase>install</phase>
                        <configuration>
                            <tasks>
                                <delete dir="target/archive-tmp" />
                                <delete dir="target/dependency-maven-plugin-markers" />
                                <delete dir="target/maven-archiver" />
                                <delete dir="target/wso2carbon-core-${carbon.kernel.version}" />
                                <delete dir="target/sources" />
                                <delete dir="target/site" />
                                <delete dir="src/site" />
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-site-plugin</artifactId>
                <version>3.3</version>
                <configuration>
                    <reportPlugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-project-info-reports-plugin</artifactId>
                            <version>2.4</version>
                            <reportSets>
                                <reportSet>
                                    <reports>
                                        <report>index</report>
                                    </reports>
                                </reportSet>
                            </reportSets>
                        </plugin>
                    </reportPlugins>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>site</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2-beta-2</version>
                <executions>
                    <execution>
                        <id>pre_dist</id>
                        <phase>test</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>${basedir}/src/main/assembly/filter.properties</filter>
                            </filters>
                            <descriptors>
                                <descriptor>src/main/assembly/dist.xml</descriptor>
                            </descriptors>
                        </configuration>
                    </execution>
                    <execution>
                        <id>dist</id>
                        <phase>package</phase>
                        <goals>
                            <goal>attached</goal>
                        </goals>
                        <configuration>
                            <filters>
                                <filter>${basedir}/src/main/assembly/filter.properties</filter>
                            </filters>
                            <descriptors>
                                <descriptor>src/main/assembly/bin.xml</descriptor>
                            </descriptors>
                            <archiverConfig>
                                <defaultDirectoryMode>0775</defaultDirectoryMode>
                                <directoryMode>0775</directoryMode>
                                <defaultFileMode>0644</defaultFileMode>
                                <fileMode>0644</fileMode>
                            </archiverConfig>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-deploy-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>