<?xml version="1.0" encoding="UTF-8"?>
<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>com.scytl.products.ov.sdm</groupId>
        <artifactId>ov-secure-data-manager</artifactId>
        <version>2.1.6</version>
    </parent>

 <groupId>com.scytl.products.ov.sdm.frontend</groupId>
 <artifactId>ov-sdm-frontend</artifactId>
 <name>Secure Data Manager Frontend</name>
 <packaging>pom</packaging>

<profiles>
        <!-- DEFAULT ONLINE PROFILE-->
        <profile>
            <id>default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptor>assembly/package.xml</descriptor>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                        <executions>
                            <execution>
                                <id>create-archive</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <target name="building">
                                        <!--  WINDOWS EXEC  -->
                                        <exec executable="cmd" dir="${project.basedir}" osfamily="windows" failonerror="true">
                                            <arg line="/c npm install --unsafe-perm --no-optional" />
                                        </exec>
                                        <exec executable="cmd" dir="${project.basedir}" osfamily="windows" failonerror="true">
                                            <arg line="/c bower install --allow-root" />
                                        </exec>
                                        <exec executable="cmd" dir="${project.basedir}" osfamily="windows" failonerror="true">
                                            <arg line="/c grunt app" />
                                        </exec>
                                        <!--  LINUX EXEC  -->
                                        <exec executable="npm" dir="${project.basedir}" osfamily="unix" failonerror="true">
                                            <arg line="install --unsafe-perm --no-optional" />
                                        </exec>
                                        <exec executable="./node_modules/bower/bin/bower" dir="${project.basedir}" osfamily="unix" failonerror="true">
                                            <arg line="install --allow-root" />
                                        </exec>
                                        <exec executable="./node_modules/grunt-cli/bin/grunt" dir="${project.basedir}" osfamily="unix" failonerror="true">
                                            <arg line="app" />
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <!-- OFFLINE PROFILE-->
        <profile>
            <id>offline</id>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-assembly-plugin</artifactId>
                        <configuration>
                            <descriptor>assembly/package.xml</descriptor>
                            <appendAssemblyId>false</appendAssemblyId>
                        </configuration>
                        <executions>
                            <execution>
                                <id>create-archive</id>
                                <phase>package</phase>
                                <goals>
                                    <goal>single</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>generate-sources</phase>
                                <configuration>
                                    <target name="building">
                                        <!--  WINDOWS EXEC  -->
                                        <exec executable="cmd" dir="${project.basedir}" osfamily="windows" failonerror="true">
                                            <arg line="/c grunt app" />
                                        </exec>
                                        <!--  LINUX EXEC  -->
                                        <exec executable="./node_modules/grunt-cli/bin/grunt" dir="${project.basedir}" osfamily="unix" failonerror="true">
                                            <arg line="app" />
                                        </exec>
                                    </target>
                                </configuration>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>


</project>
