<?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">
    <parent>
        <artifactId>sdk-parent</artifactId>
        <groupId>org.ehrbase.openehr.sdk</groupId>
        <version>2.31.1</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>generator-maven-plugin</artifactId>
    <packaging>maven-plugin</packaging>
    <name>${project.groupId}:${project.artifactId}</name>

    <properties>
        <maven.plugin.skipErrorNoDescriptorsFound>true</maven.plugin.skipErrorNoDescriptorsFound>
        <license-header.dir>../</license-header.dir>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.ehrbase.openehr.sdk</groupId>
            <artifactId>generator</artifactId>
            <version>${project.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.maven.plugin-tools</groupId>
            <artifactId>maven-plugin-annotations</artifactId>
            <version>3.15.2</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-plugin-api</artifactId>
            <version>3.9.12</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-core</artifactId>
            <version>3.9.12</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <artifactId>maven-plugin-plugin</artifactId>
                <version>3.15.2</version>
                <configuration>
                    <goalPrefix>generator</goalPrefix>
                </configuration>
                <executions>
                    <execution>
                        <id>default-descriptor</id>
                        <goals>
                            <goal>descriptor</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                    <execution>
                        <id>help-descriptor</id>
                        <goals>
                            <goal>helpmojo</goal>
                        </goals>
                        <phase>process-classes</phase>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <profiles>
        <profile>
            <id>integration</id>
            <activation>
                <activeByDefault>true</activeByDefault>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <artifactId>maven-invoker-plugin</artifactId>
                        <version>3.9.1</version>
                        <configuration>
                            <cloneProjectsTo>${project.build.directory}/it</cloneProjectsTo>
                            <debug>false</debug>
                            <settingsFile>src/it/settings.xml</settingsFile>
                            <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
                            <postBuildHookScript>verify</postBuildHookScript>
                            <addTestClassPath>true</addTestClassPath>
                            <skipInvocation>true</skipInvocation>
                            <streamLogs>true</streamLogs>
                            <showErrors>true</showErrors>
                        </configuration>
                        <executions>
                            <execution>
                                <id>integration-test</id>
                                <goals>
                                    <goal>install</goal>
                                    <goal>integration-test</goal>
                                    <goal>verify</goal>
                                </goals>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
