<?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.vaadin</groupId>
        <artifactId>vaadin-charts-flow-parent</artifactId>
        <version>25.4.web-components-13062-SNAPSHOT</version>
    </parent>
    <artifactId>vaadin-charts-flow-svg-generator</artifactId>
    <packaging>jar</packaging>
    <name>Vaadin Charts SVG Generator API</name>
    <properties>
        <surefire.argLine>-javaagent:${org.mockito:mockito-core:jar}</surefire.argLine>
        <!-- The npm tests below are a test run like any other, so -DskipTests
             leaves them out, while skipSvgChartsBuild leaves out the whole npm
             install/build/test chain. Defaults to skipSvgChartsBuild, so a
             build that skips the chain skips the tests with it. -->
        <skipSvgChartsTests>${skipSvgChartsBuild}</skipSvgChartsTests>
    </properties>
    <dependencies>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-build-tools</artifactId>
            <classifier>shaded</classifier>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-server</artifactId>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>flow-test-generic</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.vaadin</groupId>
            <artifactId>vaadin-charts-flow</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>npm-install</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>install</argument>
                            </arguments>
                            <skip>${skipSvgChartsBuild}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>generator-build</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>validate</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>run</argument>
                                <argument>build</argument>
                            </arguments>
                            <skip>${skipSvgChartsBuild}</skip>
                        </configuration>
                    </execution>
                    <execution>
                        <id>run-tests</id>
                        <goals>
                            <goal>exec</goal>
                        </goals>
                        <phase>test</phase>
                        <configuration>
                            <executable>npm</executable>
                            <arguments>
                                <argument>test</argument>
                            </arguments>
                            <skip>${skipSvgChartsTests}</skip>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>skip-svg-charts-tests</id>
            <activation>
                <property>
                    <name>skipTests</name>
                    <value>true</value>
                </property>
            </activation>
            <properties>
                <skipSvgChartsTests>true</skipSvgChartsTests>
            </properties>
        </profile>
        <profile>
            <id>attach-docs</id>
            <activation>
                <property>
                    <name>with-docs</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-source-plugin</artifactId>
                    </plugin>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
