<?xml version="1.0" encoding="utf-8"?>
<!--
 ~ Copyright (c) WSO2 Inc. (http://wso2.com) All Rights Reserved.
 ~
 ~ Licensed 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>1.0.0-SNAPSHOT</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>wso2iot-broker-p2-profile</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 IoT - Broker - P2 Profile Gen</name>
    <url>http://wso2.com/products/message-broker/</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>2.8</version>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>1-unpack-p2-agent-distribution</id>
                        <phase>test</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.wso2.maven</groupId>
                <artifactId>carbon-p2-plugin</artifactId>
                <version>${carbon.p2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>2-p2-repo-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-repo-gen</goal>
                        </goals>
                        <configuration>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <publishArtifacts>true</publishArtifacts>
                            <publishArtifactRepository>true</publishArtifactRepository>
                            <featureArtifacts>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.logging.mgt.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.analytics-common:org.wso2.carbon.databridge.datapublisher.feature:${carbon.analytics.common.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.system.statistics.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.soaptracer.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.security.mgt.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.message.flows.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.tryit.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.core.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.contentsearch.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.ui.menu.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.registry:org.wso2.carbon.registry.resource.properties.feature:${carbon.registry.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.wsdl.tools.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.um.ws.service.feature:${carbon.um.ws.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.messaging:org.wso2.carbon.andes.feature:${carbon.messaging.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.common.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.commons:org.wso2.carbon.tenant.mgt.common.feature:${carbon.commons.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.usage.agent.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.throttling.agent.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.multitenancy:org.wso2.carbon.tenant.deployment.feature:${carbon.multitenancy.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.identity.authenticator.saml2.sso.server.feature:${identity.carbon.auth.saml2.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature:${identity.carbon.auth.saml2.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.user.mgt.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.identity.core.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.identity:org.wso2.carbon.identity.core.ui.feature:${carbon.identity.framework.version}
                                </featureArtifactDef>
                                <!--carbon core features -->
                                <featureArtifactDef>
                                    org.wso2.carbon:org.wso2.carbon.core.feature:${carbon.kernel.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon:org.wso2.carbon.core.runtime.feature:${carbon.kernel.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.messaging:org.wso2.carbon.messaging.metrics.feature:${carbon.messaging.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.metrics:org.wso2.carbon.metrics.feature:${carbon.metrics.version}
                                </featureArtifactDef>
                                <!-- mb styles -->
                                <featureArtifactDef>
                                    org.wso2.mb:org.wso2.mb.styles.feature:${product.mb.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.mb:org.wso2.stratos.mb.dashboard.ui.feature:${product.mb.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ciphertool:org.wso2.ciphertool.feature:${cipher.tool.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.analytics.shared:org.wso2.carbon.analytics.shared.data.agents.log4j.feature:${analytics.shared.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature:${carbon.device.mgt.plugin.version}
                                </featureArtifactDef>
                            </featureArtifacts>
                        </configuration>
                    </execution>
                    <execution>
                        <id>3-p2-profile-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-profile-gen</goal>
                        </goals>
                        <configuration>
                            <profile>default</profile>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <destination>
                                ${basedir}/target/wso2carbon-core-${carbon.kernel.version}/repository/components
                            </destination>
                            <deleteOldProfileFiles>true</deleteOldProfileFiles>
                            <features>
                                <feature>
                                    <id>org.wso2.carbon.logging.mgt.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.databridge.datapublisher.feature.group</id>
                                    <version>${carbon.analytics.common.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.system.statistics.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.soaptracer.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.security.mgt.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.message.flows.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>

                                <feature>
                                    <id>org.wso2.carbon.tryit.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.contentsearch.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.core.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.ui.menu.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.resource.properties.feature.group
                                    </id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.wsdl.tools.feature.group</id>
                                    <version>${carbon.commons.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.registry.core.ui.feature.group</id>
                                    <version>${carbon.registry.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.um.ws.service.feature.group</id>
                                    <version>${carbon.um.ws.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.messaging.andes.feature.group</id>
                                    <version>${carbon.messaging.version}</version>
                                </feature>
                                <!--Cloud service deployment feature -->
                                <feature>
                                    <id>org.wso2.carbon.tenant.deployment.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <!-- multitenancy feature groups -->
                                <feature>
                                    <id>org.wso2.carbon.tenant.common.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>
                                        org.wso2.carbon.identity.authenticator.saml2.sso.server.feature.group
                                    </id>
                                    <version>${identity.carbon.auth.saml2.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.tenant.usage.agent.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.tenant.throttling.agent.feature.group</id>
                                    <version>${carbon.multitenancy.version}</version>
                                </feature>
                                <feature>
                                    <id>
                                        org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature.group
                                    </id>
                                    <version>${identity.carbon.auth.saml2.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.user.mgt.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.identity.core.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.identity.core.ui.feature.group</id>
                                    <version>${carbon.identity.framework.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.messaging.metrics.feature.group</id>
                                    <version>${carbon.messaging.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.metrics.feature.group</id>
                                    <version>${carbon.metrics.version}</version>
                                </feature>
                                <!-- mb style -->
                                <feature>
                                    <id>org.wso2.stratos.mb.dashboard.ui.feature.group</id>
                                    <version>${product.mb.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.mb.styles.feature.group</id>
                                    <version>${product.mb.version}</version>
                                </feature>
                                <!--cipher tool-->
                                <feature>
                                    <id>org.wso2.ciphertool.feature.group</id>
                                    <version>${cipher.tool.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.analytics.shared.data.agents.log4j.feature.group</id>
                                    <version>${analytics.shared.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.andes.extensions.device.mgt.mqtt.authorization.feature.group</id>
                                    <version>${carbon.device.mgt.plugin.version}</version>
                                </feature>

                            </features>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.1</version>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <configuration>
                            <tasks>
                                <replace token="false" value="true" dir="target/wso2carbon-core-${carbon.kernel.version}/repository/components">
                                    <include name="**/bundles.info" />
                                </replace>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>