<?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.cryptolib</groupId>
        <artifactId>cryptolib</artifactId>
        <version>2.1.5-4</version>
    </parent>
    <artifactId>cryptolib-js-pbkdf</artifactId>
    <name>CryptoLib JS PBKDF</name>
    <description>Scytl's JavaScript password-based key derivation module</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>

    <dependencies>
        <dependency>
            <groupId>com.scytl.cryptolib</groupId>
            <artifactId>cryptolib-js-buildtools</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.scytl.cryptolib</groupId>
            <artifactId>cryptolib-js-codec</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>com.scytl.cryptolib</groupId>
            <artifactId>cryptolib-js-policy</artifactId>
            <version>${project.version}</version>
        </dependency>
    </dependencies>

    <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>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>compile</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm-publish</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>install</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>${npm-publish-type}</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>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <executions>
                    <execution>
                        <id>copy-buildtools</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/target/dependency</outputDirectory>
                            <resources>
                                <resource>
                                    <directory>${basedir}/../cryptolib-js-buildtools/src/main/js</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </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>npm</executable>
                                    <arguments>
                                        <argument>test</argument>
                                    </arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
