<?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.182</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.182</tag>
    </scm>

    <modules>
        <module>distributions/console</module>
        <module>distributions/myaccount</module>
    </modules>

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

        <plugins>

            <!-- Initialize the repository by downloading dependency artifact -->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <version>3.0.0</version>
                <artifactId>maven-antrun-plugin</artifactId>
                <inherited>false</inherited>
                <executions>
                    <!-- Initialize Identity Apps Dependency -->
                    <execution>
                        <id>build-pack</id>
                        <phase>initialize</phase>
                        <configuration>
                            <target>
                                <ant antfile="init-repo.xml">
                                    <target name="init-repo" />
                                </ant>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <!-- Initialize Extensions -->
                    <execution>
                        <id>init-extensions</id>
                        <phase>process-sources</phase>
                        <configuration>
                            <target>
                                <ant antfile="init-ext.xml">
                                    <target name="init-extensions" />
                                </ant>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                    <!-- Initialize Extensions -->
                    <execution>
                        <id>init-artefacts</id>
                        <phase>prepare-package</phase>
                        <configuration>
                            <target>
                                <ant antfile="init-artefacts.xml">
                                    <target name="init-artefacts" />
                                </ant>
                            </target>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Initialize Identity Apps module which is downloaded in the `initialize` phase -->
            <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>generate-sources</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>
                    <execution>
                        <id>maven clean install (authentication-portal)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps/apps/authentication-portal</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>maven clean install (email-otp-authentication-portal)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps/apps/email-otp-authentication-portal</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>maven clean install (recovery-portal)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps/apps/recovery-portal</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>maven clean install (sms-otp-authentication-portal)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps/apps/sms-otp-authentication-portal</workingDirectory>
                        </configuration>
                    </execution>
                    <execution>
                        <id>maven clean install (x509-certificate-authentication-portal)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>mvn</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <workingDirectory>${basedir}/target/identity-apps/apps/x509-certificate-authentication-portal</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>
            
        </plugins>
    </build>

    <properties>
        <identity.apps.version>1.1.65</identity.apps.version>
        <identity.apps.theme>asgardio</identity.apps.theme>
    </properties>
</project>
