<?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>
        <artifactId>allure-core</artifactId>
        <groupId>ru.yandex.qatools.allure</groupId>
        <version>1.4.0.RC3</version>
    </parent>

    <artifactId>allure-report-face</artifactId>
    <packaging>war</packaging>

    <name>Allure Report Face</name>

    <properties>
        <sonar.language>js</sonar.language>
        <sonar.sources>src/main/webapp/js</sonar.sources>
        <sonar.tests>src/test/webapp/unit</sonar.tests>
        <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
        <sonar.javascript.jstestdriver.reportsPath>
            ${project.build.directory}/surefire-reports/
        </sonar.javascript.jstestdriver.reportsPath>

        <sonar.exclusions>vendor/**</sonar.exclusions>
        <sonar.tests.exclusions>vendor/**</sonar.tests.exclusions>
    </properties>

    <build>
        <sourceDirectory>src/main/webapp</sourceDirectory>
        <testSourceDirectory>src/test/webapp</testSourceDirectory>

        <plugins>
            <plugin>
                <groupId>org.lesscss</groupId>
                <artifactId>lesscss-maven-plugin</artifactId>
                <version>1.3.3</version>
                <configuration>
                    <sourceDirectory>${project.basedir}/src/main/less</sourceDirectory>
                    <outputDirectory>${project.basedir}/src/main/webapp/css</outputDirectory>
                    <compress>true</compress>
                    <includes>
                        <include>app.less</include>
                    </includes>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-war-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <webResources>
                        <resource>
                            <directory>src/main/webapp</directory>
                            <includes>
                                <include>index.html</include>
                            </includes>
                            <filtering>true</filtering>
                        </resource>
                    </webResources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.searls</groupId>
                <artifactId>jasmine-maven-plugin</artifactId>
                <version>1.3.1.2</version>
                <extensions>true</extensions>
                <executions>
                    <execution>
                        <id>unit-test-running</id>
                        <goals>
                            <goal>test</goal>
                        </goals>
                        <phase>test</phase>
                    </execution>
                </executions>
                <configuration>
                    <jsSrcDir>src/main/webapp/js</jsSrcDir>
                    <jsTestSrcDir>src/test/webapp/unit</jsTestSrcDir>
                    <jasmineTargetDir>${project.build.directory}/surefire-reports</jasmineTargetDir>
                    <webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
                    <preloadSources>
                        <source>src/main/webapp/vendor/jquery/jquery-2.0.3.min.js</source>
                        <source>src/main/webapp/vendor/d3/d3.v3.min.js</source>
                        <source>src/main/webapp/vendor/angular/angular.js</source>
                        <source>src/main/webapp/vendor/angular/angular-route.min.js</source>
                        <source>src/main/webapp/vendor/angular/angular-animate.min.js</source>
                        <source>src/test/webapp/vendor/angular/angular-mocks.js</source>
                        <source>src/test/webapp/vendor/qatools-jasmine.js</source>
                    </preloadSources>
                </configuration>
            </plugin>
            <plugin>
                <groupId>com.github.timurstrekalov</groupId>
                <artifactId>saga-maven-plugin</artifactId>
                <version>1.5.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>coverage</goal>
                        </goals>
                        <phase>none</phase>
                    </execution>
                </executions>
                <configuration>
                    <outputStrategy>TOTAL</outputStrategy>
                    <reportFormats>COBERTURA</reportFormats>
                    <baseDir>http://0.0.0.0:${jasmine.serverPort}</baseDir>
                    <outputDir>${project.build.directory}/site/cobertura</outputDir>
                    <webDriverClassName>org.openqa.selenium.phantomjs.PhantomJSDriver</webDriverClassName>
                    <noInstrumentPatterns>
                        <pattern>.*/spec/.*</pattern>
                        <pattern>.*/vendor/.*</pattern>
                    </noInstrumentPatterns>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>dev</id>
            <properties>
                <allure.results.directory>${project.build.directory}/allure-results</allure.results.directory>
                <allure.report.directory>${project.build.directory}/allure-report</allure.report.directory>
            </properties>

            <dependencies>
                <dependency>
                    <groupId>ru.yandex.qatools.allure</groupId>
                    <artifactId>allure-report-data</artifactId>
                </dependency>
            </dependencies>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-resources-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>copy-allure-model-test-resources</id>
                                <phase>compile</phase>
                                <goals>
                                    <goal>copy-resources</goal>
                                </goals>
                                <configuration>
                                    <outputDirectory>${allure.results.directory}</outputDirectory>
                                    <resources>
                                        <resource>
                                            <directory>
                                                ${project.basedir}/../allure-model/src/test/resources/allure-results
                                            </directory>
                                            <filtering>false</filtering>
                                        </resource>
                                    </resources>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <groupId>org.codehaus.mojo</groupId>
                        <artifactId>exec-maven-plugin</artifactId>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>java</goal>
                                </goals>
                            </execution>
                        </executions>
                        <configuration>
                            <mainClass>ru.yandex.qatools.allure.data.DummyReportGenerator</mainClass>
                            <arguments>
                                <argument>${allure.results.directory}</argument>
                                <argument>${allure.report.directory}</argument>
                            </arguments>
                        </configuration>
                    </plugin>
                    <plugin>
                        <groupId>org.eclipse.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <configuration>
                            <scanIntervalSeconds>3</scanIntervalSeconds>
                            <contextHandlers>
                                <contextHandler implementation="org.eclipse.jetty.server.handler.ContextHandler">
                                    <contextPath>/data</contextPath>
                                    <resourceBase>target/allure-report/data/</resourceBase>
                                    <handler implementation="org.eclipse.jetty.server.handler.ResourceHandler" />
                                </contextHandler>
                            </contextHandlers>
                        </configuration>
                        <executions>
                            <execution>
                                <phase>compile</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

</project>
