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

    <parent>
        <groupId>org.ballerinalang</groupId>
        <artifactId>ballerina-parent</artifactId>
        <version>0.970.0-beta18</version>
        <relativePath>../pom.xml</relativePath>
    </parent>

    <modelVersion>4.0.0</modelVersion>
    <artifactId>benchmarks</artifactId>
    <name>Ballerina - Microbenchmarks</name>

    <dependencies>
        <dependency>
            <groupId>org.ballerinalang</groupId>
            <artifactId>ballerina</artifactId>
            <type>zip</type>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-dependency-plugin</artifactId>
                <version>${maven.dependency.plugin.version}</version>
                <executions>
                    <execution>
                        <id>unpack-dependencies</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>unpack-dependencies</goal>
                        </goals>
                        <configuration>
                            <skip>${skipBenchmarks}</skip>
                            <includeArtifactIds>ballerina</includeArtifactIds>
                            <outputDirectory>target</outputDirectory>
                            <overWriteReleases>true</overWriteReleases>
                            <overWriteSnapshots>true</overWriteSnapshots>
                            <overWriteIfNewer>true</overWriteIfNewer>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>${maven.antrun.plugin.version}</version>
                <executions>
                    <execution>
                        <id>prepare</id>
                        <phase>initialize</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <skip>${skipBenchmarks}</skip>
                            <target>
                                <mkdir dir="${project.basedir}/.ballerina" />
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>${maven.exec.plugin.version}</version>
                <executions>
                    <execution>
                        <id>execute-script</id>
                        <phase>integration-test</phase>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <configuration>
                            <skip>${skipBenchmarks}</skip>
                            <executable>${project.basedir}/executor</executable>
                            <arguments>
                                <argument>${project.basedir}/target/ballerina-${project.version}</argument>
                                <argument>${warmup.iterations}</argument>
                                <argument>${benchmark.iterations}</argument>
                                <argument>benchmark-ballerina_${project.version}</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>
