<!--
  ~ Copyright (c) 2016, 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.ei</groupId>
        <artifactId>wso2-micro-integrator-parent</artifactId>
        <version>4.1.0-m2</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>micro-integrator-p2-profile</artifactId>
    <packaging>pom</packaging>
    <name>WSO2 Enterprise Integrator - micro-integrator P2 Profile Generation</name>
    <url>http://www.wso2.org</url>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>2-unpack-equinox-executable</id>
                        <phase>test</phase>
                        <goals>
                            <goal>unpack</goal>
                        </goals>
                        <configuration>
                            <artifactItems>
                                <artifactItem>
                                    <groupId>org.eclipse.equinox</groupId>
                                    <artifactId>org.eclipse.equinox.executable</artifactId>
                                    <version>3.5.0.v20110530-7P7NFUFFLWUl76mart</version>
                                    <type>zip</type>
                                    <overWrite>false</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.apache.synapse:org.apache.synapse.wso2.feature:${synapse.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.crypto.feature:${project.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.synapse:org.apache.synapse.transport.fix.feature:${synapse.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.synapse:org.apache.synapse.transport.nhttp.feature:${synapse.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.synapse:org.apache.synapse.transport.vfs.feature:${synapse.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.synapse:org.apache.synapse.transport.vfs.smb2.feature:${synapse.version}
                                </featureArtifactDef>
<!--                                &lt;!&ndash;1. Carbon-Mediation&ndash;&gt;-->
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.mediators.server.feature:${project.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.initializer.feature:${project.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.relay.server.feature:${carbon.mediation.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.mediator.smooks.server.feature:${carbon.mediation.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.mediator.datamapper.server.feature:${carbon.mediation.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.mediator.datamapper.engine.feature:${carbon.mediation.version}
                                </featureArtifactDef>


<!--                                &lt;!&ndash;TODO&ndash;&gt;-->
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.inbound.endpoints.server.feature:${project.version}
                                </featureArtifactDef>
                               <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.mediation.ntask.feature:${project.version}
                                </featureArtifactDef>
                                <!-- This feature is used for synapse admin service. Hence, commented out as it seems to be unnecessary.
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.application.mgt.synapse.server.feature:${carbon.mediation.version}>
                                </featureArtifactDef>-->

                                <!--2 Carbon-Kernel-->
                                <featureArtifactDef>
                                    org.wso2.carbon:org.wso2.carbon.core.runtime.feature:${carbon.kernel.version}
                                </featureArtifactDef>

                                <!--Analytics-->
                                <featureArtifactDef>
                                    org.wso2.carbon.analytics-common:org.wso2.carbon.databridge.datapublisher.feature:${carbon.analytics.common.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.analytics.messageflow.data.publisher.feature:${project.version}
                                </featureArtifactDef>
                                 <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.observability.feature:${project.version}
                                </featureArtifactDef>

                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.ntask.core.feature:${project.version}
                                </featureArtifactDef>

                                <!--11 Axis2 Transports-->
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.jms.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.mail.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.tcp.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.udp.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.xmpp.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.rabbitmq.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.apache.axis2.transport:org.apache.axis2.transport.mqtt.feature:${axis2.transport.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ciphertool:org.wso2.ciphertool.feature:${cipher.tool.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.carbon.mediation:org.wso2.carbon.transports.sap.feature:${sap-adapter.feature.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.websocket.feature:${project.version}
                                </featureArtifactDef>

                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.server.feature:${project.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.identity.xacml.mediator.feature:${project.version}
                                </featureArtifactDef>
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.mediator.dataservice.feature:${project.version}
                                </featureArtifactDef>

                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.security.server.feature:${project.version}
                                </featureArtifactDef>

                                <!-- DSS -->
                                <featureArtifactDef>
                                    org.wso2.ei:org.wso2.micro.integrator.dataservices.server.feature:${project.version}
                                </featureArtifactDef>
                            </featureArtifacts>
                        </configuration>
                    </execution>
                    <!--Need for Feature profile START-->
                    <!--Need carbon.product file for this.-->
                    <execution>
                        <id>publishing-product</id>
                        <phase>package</phase>
                        <goals>
                            <goal>publish-product</goal>
                        </goals>
                        <configuration>
                            <productConfigurationFile>${basedir}/carbon.product</productConfigurationFile>
                            <executable>
                                ${basedir}/target/org.eclipse.equinox.executable_3.5.0.v20110530-7P7NFUFFLWUl76mart
                            </executable>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                        </configuration>
                    </execution>
                    <execution>
                        <id>creating-default-product</id>
                        <phase>package</phase>
                        <goals>
                            <goal>materialize-product</goal>
                        </goals>
                        <configuration>
                            <productConfigurationFile>${basedir}/carbon.product</productConfigurationFile>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <targetPath>
                                file:${basedir}/target/wso2carbon-core-${carbon.kernel.version}/wso2/components
                            </targetPath>
                            <profile>micro-integrator-default</profile>
                        </configuration>
                    </execution>
                    <!--END-->
                    <!--*.feature.group should be added for multi profiles? Only a sub set from the above (feature) list?-->
                    <execution>
                        <id>3-p2-profile-generation</id>
                        <phase>package</phase>
                        <goals>
                            <goal>p2-profile-gen</goal>
                        </goals>
                        <configuration>
                            <profile>micro-integrator-default</profile>
                            <metadataRepository>file:${basedir}/target/p2-repo</metadataRepository>
                            <artifactRepository>file:${basedir}/target/p2-repo</artifactRepository>
                            <destination>
                                ${basedir}/target/wso2carbon-core-${carbon.kernel.version}/wso2/components
                            </destination>
                            <deleteOldProfileFiles>true</deleteOldProfileFiles>
                            <features>
                                <feature>
                                    <id>org.apache.synapse.wso2.feature.group</id>
                                    <version>${synapse.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.synapse.transport.fix.feature.group</id>
                                    <version>${synapse.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.synapse.transport.nhttp.feature.group</id>
                                    <version>${synapse.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.synapse.transport.vfs.feature.group</id>
                                    <version>${synapse.version}</version>
                                </feature>
                                <!-- SMB2 -->
                                <feature>
                                    <id>org.apache.synapse.transport.vfs.smb2.feature.group</id>
                                    <version>${synapse.version}</version>
                                </feature>
                                <!--1 Carbon Mediation -->
                                <feature>
                                    <id>org.wso2.micro.integrator.mediators.server.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.relay.server.feature.group</id>
                                    <version>${carbon.mediation.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.mediator.smooks.server.feature.group</id>
                                    <version>${carbon.mediation.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.mediator.datamapper.server.feature.group</id>
                                    <version>${carbon.mediation.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.mediator.datamapper.engine.feature.group</id>
                                    <version>${carbon.mediation.version}</version>
                                </feature>

                                <feature>
                                    <id>org.wso2.carbon.transports.sap.feature.group</id>
                                    <version>${sap-adapter.feature.version}</version>
                                </feature>

                                <feature>
                                    <id>org.wso2.micro.integrator.websocket.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>

                                <feature>
                                    <id>org.wso2.micro.integrator.inbound.endpoints.server.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.mediation.ntask.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                               <!--TODO This feature corresponds to Admin Services, hence we might not need this
                                <feature>
                                    <id>org.wso2.carbon.mediation.configadmin.server.feature.group</id>
                                    <version>${carbon.mediation.version}</version>
                                </feature>-->
                                <feature>
                                    <id>org.wso2.micro.integrator.identity.xacml.mediator.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.mediator.dataservice.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>


                                <!-- 2 Carbon-Kernel -->
                                <feature>
                                    <id>org.wso2.carbon.core.runtime.feature.group</id>
                                    <version>${carbon.kernel.version}</version>
                                </feature>

                                <!-- 3 Carbon Commons -->
                                <!--Need to remove Registry dependency-->
                                <feature>
                                    <id>org.wso2.micro.integrator.ntask.core.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.carbon.databridge.datapublisher.feature.group</id>
                                    <version>${carbon.analytics.common.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.analytics.messageflow.data.publisher.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.observability.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>

                                <!--11 Axis2 Transports-->
                                <feature>
                                    <id>org.apache.axis2.transport.jms.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.mail.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.tcp.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.udp.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.xmpp.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.rabbitmq.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>
                                <feature>
                                    <id>org.apache.axis2.transport.mqtt.feature.group</id>
                                    <version>${axis2.transport.version}</version>
                                </feature>

                                <!-- 12 Ciphertool -->
                                <feature>
                                    <id>org.wso2.ciphertool.feature.group</id>
                                    <version>${cipher.tool.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.server.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.initializer.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.security.server.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <feature>
                                    <id>org.wso2.micro.integrator.crypto.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                                <!-- DSS -->
                                <feature>
                                    <id>org.wso2.micro.integrator.dataservices.server.feature.group</id>
                                    <version>${project.version}</version>
                                </feature>
                            </features>
                        </configuration>
                    </execution>

                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>creating-required-resources</id>
                        <phase>generate-resources</phase>
                        <configuration>
                            <target>
                                <mkdir dir="target/wso2carbon-core-${carbon.kernel.version}/wso2/deployment/server" />
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <replace token="false" value="true" dir="target/wso2carbon-core-${carbon.kernel.version}/wso2/components">
                                    <include name="**/bundles.info" />
                                </replace>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>
