<?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/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <parent>
        <groupId>org.into-cps.maestro</groupId>
        <artifactId>root</artifactId>
        <version>2.1.9</version>
    </parent>


    <artifactId>modeldefinitionchecker</artifactId>
    <name>A VDM model checker for Model Definition</name>

    <properties>
        <overture.version>2.4.4</overture.version>
    </properties>


    <pluginRepositories>
        <pluginRepository>

            <id>overture-m2-dev</id>
            <url>
                http://overture.au.dk/artifactory/simple/overture-development/
            </url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>


        </pluginRepository>
    </pluginRepositories>

    <repositories>

        <repository>
            <id>overture-m2-dev</id>
            <url>
                http://overture.au.dk/artifactory/simple/overture-development/
            </url>
            <layout>default</layout>
            <releases>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </releases>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>daily</updatePolicy>
            </snapshots>
        </repository>
    </repositories>

    <dependencies>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter</artifactId>
        </dependency>
        <dependency>
            <groupId>org.overturetool.core.codegen</groupId>
            <artifactId>codegen-runtime</artifactId>
            <version>${overture.version}</version>
            <exclusions>
                <exclusion>
                    <groupId>junit</groupId>
                    <artifactId>junit</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.into-cps.maestro</groupId>
            <artifactId>fmi</artifactId>
            <version>2.1.9</version>
            <scope>compile</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.overturetool.core.codegen</groupId>
                <artifactId>codegen-plugin</artifactId>
                <version>${overture.version}</version>
                <executions>
                    <execution>
                        <id>java</id>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <release>vdm10</release>
                    <dialect>sl</dialect>
                    <specificationDir>src/main/resources/sv_checker
                    </specificationDir>
                    <packageName>org.intocps.fmichecker</packageName>
                    <release>vdm10</release>
                    <formatCode>false</formatCode>
                </configuration>
            </plugin>

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>3.2.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/javacode/
                                </source>
                            </sources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

            <!-- This is related to a bug in Overture. See https://github.com/overturetool/overture/issues/778-->
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <version>1.8</version>
                <executions>
                    <execution>
                        <phase>process-sources</phase>
                        <configuration>
                            <tasks>
                                <replace dir="${project.build.directory}/generated-sources/javacode/org/intocps/fmichecker" token="import org.overture.codegen.runtime.*;" value="import org.overture.codegen.runtime.*;${line.separator}import org.overture.codegen.runtime.Record;" failOnNoReplacements="true">
                                </replace>
                            </tasks>
                        </configuration>
                        <goals>
                            <goal>run</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>


        <pluginManagement>
            <plugins>
                <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself. -->


                <plugin>
                    <groupId>org.eclipse.m2e</groupId>
                    <artifactId>lifecycle-mapping</artifactId>
                    <version>1.0.0</version>
                    <configuration>
                        <lifecycleMappingMetadata>
                            <pluginExecutions>
                                <pluginExecution>
                                    <pluginExecutionFilter>
                                        <groupId>org.overturetool.core.codegen
                                        </groupId>
                                        <artifactId>codegen-plugin</artifactId>
                                        <versionRange>[2.4.4,)</versionRange>
                                        <goals>
                                            <goal>generate</goal>
                                        </goals>
                                    </pluginExecutionFilter>
                                    <action>
                                        <ignore />
                                    </action>
                                </pluginExecution>
                            </pluginExecutions>
                        </lifecycleMappingMetadata>
                    </configuration>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</project>

