<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <parent>
        <artifactId>cryptolib</artifactId>
        <groupId>com.scytl.cryptolib</groupId>
        <version>2.1.5-4</version>
    </parent>

    <artifactId>cryptolib-js</artifactId>
    <packaging>pom</packaging>

    <name>Cryptolib JS</name>
    <description>Cryptolib JavaScript Library</description>
    <properties>
        <sonar.sources>lib</sonar.sources>
        <sonar.tests>spec</sonar.tests>
        <sonar.javascript.lcov.reportPath>target/reports/coverage/lcov.info</sonar.javascript.lcov.reportPath>
        <sonar.genericcoverage.unitTestReportPaths>target/reports/junit</sonar.genericcoverage.unitTestReportPaths>
    </properties>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>initialize</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>compile</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>compile</phase>
                        <configuration>
                            <executable>node</executable>
                            <arguments>
                                <argument>${basedir}/node_modules/grunt-cli/bin/grunt</argument>
                                <argument>compile</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>package</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <executable>node</executable>
                            <arguments>
                                <argument>${basedir}/node_modules/grunt-cli/bin/grunt</argument>
                                <argument>package</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>deploy</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>deploy</phase>
                        <configuration>
                            <executable>node</executable>
                            <arguments>
                                <argument>${basedir}/node_modules/grunt-cli/bin/grunt</argument>
                                <argument>deploy</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-release-plugin</artifactId>
                <configuration>
                    <preparationGoals>clean verify</preparationGoals>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <!-- This exists just to disable the run-tests profile -->
            <id>do-not-run-tests-1</id>
            <activation>
                <property>
                    <name>skipTests</name>
                </property>
            </activation>
        </profile>
        <profile>
            <!-- This exists just to disable the run-tests profile -->
            <id>do-not-run-tests-2</id>
            <activation>
                <property>
                    <name>maven.test.skip</name>
                    <value>true</value>
                </property>
            </activation>
        </profile>
        <profile>
            <id>run-tests</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>test</id>
                                <goals>
                                    <goal>exec</goal>
                                </goals>
                                <phase>test</phase>
                                <configuration>
                                    <executable>node</executable>
                                    <arguments>
                                        <argument>
                                            ${basedir}/node_modules/grunt-cli/bin/grunt
                                        </argument>
                                        <argument>test</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
