<?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.github.fburato</groupId>
        <artifactId>functional-utils</artifactId>
        <version>1.0.0</version>
    </parent>

    <properties>
        <main.baseDir>${project.parent.basedir}</main.baseDir>
    </properties>

    <artifactId>functional-utils-functions</artifactId>
    <name>Functions</name>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>generateCode</id>
                        <phase>test</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <mainClass>com.github.fburato.functionalutils.codegen.Generator</mainClass>
                    <arguments>
                        <argument>${project.build.directory}/generated-sources</argument>
                        <argument>55</argument>
                    </arguments>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.0.0</version>
                <executions>
                    <execution>
                        <id>add-source</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>add-source</goal>
                        </goals>
                        <configuration>
                            <sources>
                                <source>${project.build.directory}/generated-sources</source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <executions>
                    <execution>
                        <id>default-compile</id>
                        <phase>compile</phase>
                    </execution>
                    <execution>
                        <id>build-generated-code</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>compile</goal>
                        </goals>
                        <configuration>
                            <generatedSourcesDirectory>${project.build.directory}/generated-sources</generatedSourcesDirectory>
                            <useIncrementalCompilation>false</useIncrementalCompilation>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>net.revelc.code.formatter</groupId>
                <artifactId>formatter-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <id>normal-reformat</id>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <configuration>
                            <configFile>${main.baseDir}/formatter.xml</configFile>
                            <directories>
                                <directory>${project.build.testSourceDirectory}</directory>
                                <directory>${project.build.sourceDirectory}</directory>
                            </directories>
                        </configuration>
                    </execution>
                    <execution>
                        <id>reformat-auto-generated</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>format</goal>
                        </goals>
                        <configuration>
                            <configFile>${main.baseDir}/formatter.xml</configFile>
                            <directories>
                                <directory>${project.build.directory}/generated-sources</directory>
                            </directories>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.1</version>
                <executions>
                    <execution>
                        <id>default-jar</id>
                        <phase>package</phase>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                        <configuration>
                            <excludes>
                                <exclude>**/codegen</exclude>
                                <exclude>**/codegen/**/*</exclude>
                            </excludes>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


</project>