<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2018, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
  ~
  ~ WSO2 Inc. licenses this file to you under the Apache License,
  ~ Version 2.0 (the "License"); you may not use this file except
  ~ in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~   http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing,
  ~ software distributed under the License is distributed on an
  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  ~ KIND, either express or implied.  See the License for the
  ~ specific language governing permissions and limitations
  ~ under the License.
  -->

<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>

    <artifactId>wso2sp-solutions.twitter-analytics.tweet-count-analysis</artifactId>
    <packaging>pom</packaging>

    <name>WSO2 Stream Processor - Solution - Widgets - TweetCountAnalysis</name>
    <url>http://wso2.org</url>

    <parent>
        <groupId>org.wso2.carbon.analytics</groupId>
        <artifactId>twitter-analytics-widgets</artifactId>
        <version>2.0.395</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <id>npm install (initialize)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>initialize</phase>
                        <configuration>
                            <executable>${npm.executable}</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <!-- 'npm run clean' which is run in clean lifecycle needs 'rimraf' node module.
                     Make sure it is installed  -->
                    <execution>
                        <id>npm install rimraf (clean)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>pre-clean</phase>
                        <configuration>
                            <executable>${npm.executable}</executable>
                            <arguments>
                                <argument>install</argument>
                                <argument>rimraf</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm run clean (clean)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>clean</phase>
                        <configuration>
                            <executable>${npm.executable}</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>clean</argument>
                            </arguments>
                        </configuration>
                    </execution>
                    <execution>
                        <id>npm run dev (compile)</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>generate-resources</phase>
                        <configuration>
                            <executable>${npm.executable}</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>build</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <descriptors>
                        <descriptor>${project.basedir}/../assembly.xml</descriptor>
                    </descriptors>
                    <appendAssemblyId>false</appendAssemblyId>
                </configuration>
            </plugin>
        </plugins>
    </build>
    <profiles>
        <profile>
            <id>platform-windows</id>
            <activation>
                <os>
                    <family>windows</family>
                </os>
            </activation>
            <properties>
                <npm.executable>npm.cmd</npm.executable>
            </properties>
        </profile>
        <profile>
            <id>platform-unix</id>
            <activation>
                <os>
                    <family>unix</family>
                </os>
            </activation>
            <properties>
                <npm.executable>npm</npm.executable>
            </properties>
        </profile>
        <profile>
            <id>platform-default</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <properties>
                <npm.executable>npm</npm.executable>
            </properties>
        </profile>
    </profiles>

    <repositories>
        <repository>
            <id>jitpack.io</id>
            <url>https://jitpack.io</url>
        </repository>
        <repository>
            <id>sonatype.releases</id>
            <url>https://oss.sonatype.org/content/repositories/releases/</url>
        </repository>
    </repositories>
</project>
