<?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>org.butterfaces</groupId>
        <artifactId>butterfaces</artifactId>
        <version>3.4.0</version>
    </parent>

    <artifactId>components</artifactId>
    <packaging>jar</packaging>
    <name>ButterFaces components</name>

    <properties>
        <frontend-maven-plugin.version>1.9.1</frontend-maven-plugin.version>
        <frontend-maven-plugin.nodeVersion>v14.2.0</frontend-maven-plugin.nodeVersion>
        <frontend-maven-plugin.npmVersion>6.14.4</frontend-maven-plugin.npmVersion>

        <maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
    </properties>

    <profiles>
        <profile>
            <id>gulp-only-build</id>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>${frontend-maven-plugin.version}</version>
                        <configuration>
                            <workingDirectory>nodejs</workingDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>gulp build</id>
                                <goals>
                                    <goal>gulp</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>default</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
        <profile>
            <id>nodejs-all</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>com.github.eirslett</groupId>
                        <artifactId>frontend-maven-plugin</artifactId>
                        <version>${frontend-maven-plugin.version}</version>
                        <configuration>
                            <workingDirectory>nodejs</workingDirectory>
                        </configuration>
                        <executions>
                            <execution>
                                <id>install node and npm</id>
                                <goals>
                                    <goal>install-node-and-npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <nodeVersion>${frontend-maven-plugin.nodeVersion}</nodeVersion>
                                    <npmVersion>${frontend-maven-plugin.npmVersion}</npmVersion>
                                </configuration>
                            </execution>
                            <execution>
                                <id>npm install</id>
                                <goals>
                                    <goal>npm</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>install</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>gulp clean</id>
                                <goals>
                                    <goal>gulp</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>cleanDestinations</arguments>
                                </configuration>
                            </execution>
                            <execution>
                                <id>gulp build</id>
                                <goals>
                                    <goal>gulp</goal>
                                </goals>
                                <phase>generate-resources</phase>
                                <configuration>
                                    <arguments>default</arguments>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                    <plugin>
                        <artifactId>maven-clean-plugin</artifactId>
                        <version>2.6.1</version>
                        <configuration>
                            <filesets>
                                <fileset>
                                    <directory>nodejs</directory>
                                    <followSymlinks>false</followSymlinks>
                                    <excludes>
                                        <exclude>src/**/*</exclude>
                                        <exclude>gulpfile.js</exclude>
                                        <exclude>package.json</exclude>
                                        <exclude>tslint.json</exclude>
                                    </excludes>
                                </fileset>
                            </filesets>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<version>${maven-jar-plugin.version}</version>
				<configuration>
					<archive>
						<manifestEntries>
							<Implementation-Title>${project.name}</Implementation-Title>
							<Implementation-Version>${project.version}</Implementation-Version>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>
	</build>

    <dependencies>
        <dependency>
            <groupId>jakarta.el</groupId>
            <artifactId>jakarta.el-api</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.faces</groupId>
            <artifactId>jakarta.faces-api</artifactId>
            <version>${jakarta.faces-api.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.mockito</groupId>
            <artifactId>mockito-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.assertj</groupId>
            <artifactId>assertj-core</artifactId>
        </dependency>
        <!-- required because otherwise tests will broke: missing classes -->
        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>jakarta.faces</artifactId>
            <version>2.3.14</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>jakarta.servlet</groupId>
            <artifactId>jakarta.servlet-api</artifactId>
            <version>4.0.3</version>
            <scope>test</scope>
        </dependency>
    </dependencies>
</project>
