<?xml version="1.0" encoding="UTF-8"?>

<!--
 * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.com). All Rights Reserved.
 * 
 * This software is the property of WSO2 Inc. and its suppliers, if any.
 * Dissemination of any information or reproduction of any material contained
 * herein in any form is strictly forbidden, unless permitted by WSO2 expressly.
 * You may not alter or remove any copyright or other notice from copies of this content."
-->

<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.wso2</groupId>
        <artifactId>wso2</artifactId>
        <version>1.2</version>
    </parent>
    <groupId>org.wso2.identity.apps</groupId>
    <artifactId>identity-apps-cloud</artifactId>
    <packaging>pom</packaging>
    <version>0.0.2</version>
    <name>WSO2 Identity Cloud Apps - Parent</name>
    <description>WSO2 Identity Cloud Web Apps</description>

    <url>http://wso2.org</url>

    <scm>
        <url>https://github.com/wso2-enterprise/iam-cloud-app-extensions.git</url>
        <developerConnection>scm:git:https://github.com/wso2-enterprise/iam-cloud-app-extensions.git</developerConnection>
        <connection>scm:git:https://github.com/wso2-enterprise/iam-cloud-app-extensions.git</connection>
        <tag>v0.0.2</tag>
    </scm>

    <modules>
        <module>distrubutions/developer-portal</module>
    </modules>

    <build>
        <finalName>${project.artifactId}</finalName>

        <plugins>

            <!-- Build all npm packages (apps & modules) -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <version>1.6.0</version>
                <artifactId>exec-maven-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <execution>
                        <id>npm install (initialize)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm run build (compile)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>build</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps</workingDirectory>
                        </configuration>
                    </execution>
                </executions>
                <configuration>
                    <environmentVariables>
                        <NPM_CONFIG_PREFIX>${basedir}/npm</NPM_CONFIG_PREFIX>
                        <NPM_CONFIG_CACHE>${NPM_CONFIG_PREFIX}/cache</NPM_CONFIG_CACHE>
                        <NPM_CONFIG_TMP>${project.build.directory}/npmtmp</NPM_CONFIG_TMP>
                    </environmentVariables>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <version>3.0.0</version>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <!-- Create custom identity apps -->
                    <execution>
                        <id>build-pack</id>
                        <phase>process-resources</phase>
                        <configuration>
                            <target>
                                <ant antfile="build.xml">
                                    <target name="go" />
                                </ant>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            
        </plugins>
    </build>

    <properties>
        <identity.apps.version>1.0.259</identity.apps.version>
    </properties>
</project>
