<?xml version="1.0" encoding="UTF-8"?>
<project
	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
	xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>fr.irit.smac.lib.may</groupId>
		<artifactId>parent</artifactId>
		<version>3.4.0</version>
		<relativePath>../parent/pom.xml</relativePath>
	</parent>

	<artifactId>parent-speadl</artifactId>
	<packaging>pom</packaging>

	<name>${project.groupId}:${project.artifactId}</name>
	<description>Parent pom for the official MAY library that generates code with SpeADL</description>

	<properties>
		<xtext-version>2.7.2</xtext-version>
		<may-version>3.4.0</may-version>
	</properties>

	<build>
		<plugins>
			<plugin>
				<groupId>org.codehaus.mojo</groupId>
				<artifactId>build-helper-maven-plugin</artifactId>
				<executions>
					<execution>
						<id>add-source</id>
						<goals>
							<goal>add-source</goal>
						</goals>
						<configuration>
							<sources>
								<source>${project.basedir}/src/main/speadl-gen</source>
							</sources>
						</configuration>
					</execution>
					<execution>
						<!-- Needed so that speadl files are included in the jar -->
						<id>add-resource</id>
						<goals>
							<goal>add-resource</goal>
						</goals>
						<configuration>
							<resources>
								<resource>
									<directory>${project.build.sourceDirectory}</directory>
									<includes>
										<include>**/*.speadl</include>
									</includes>
								</resource>
							</resources>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-clean-plugin</artifactId>
				<executions>
					<execution>
						<!-- hack in order for the file not to be removed on clean but only 
							prior to code generation from xtext-maven-plugin -->
						<phase>generate-sources</phase>
						<goals>
							<goal>clean</goal>
						</goals>
						<configuration>
							<excludeDefaultDirectories>true</excludeDefaultDirectories>
							<filesets>
								<fileset>
									<directory>${project.basedir}/src/main/speadl-gen</directory>
								</fileset>
							</filesets>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>org.eclipse.xtext</groupId>
				<artifactId>xtext-maven-plugin</artifactId>
				<executions>
					<execution>
						<goals>
							<goal>generate</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<languages>
						<language>
							<setup>fr.irit.smac.may.speadl.SpeADLStandaloneSetup</setup>
							<outputConfigurations>
								<outputConfiguration>
									<outputDirectory>${project.basedir}/src/main/speadl-gen</outputDirectory>
								</outputConfiguration>
							</outputConfigurations>
						</language>
					</languages>
				</configuration>
				<dependencies>
					<dependency>
						<groupId>fr.irit.smac.may</groupId>
						<artifactId>fr.irit.smac.may.speadl</artifactId>
						<version>${may-version}</version>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-clean-plugin</artifactId>
					<version>2.6</version>
				</plugin>
				<plugin>
					<groupId>org.eclipse.xtext</groupId>
					<artifactId>xtext-maven-plugin</artifactId>
					<version>${xtext-version}</version>
				</plugin>
				<!--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.apache.maven.plugins
										</groupId>
										<artifactId>
											maven-clean-plugin
										</artifactId>
										<versionRange>
											[2.5,)
										</versionRange>
										<goals>
											<goal>clean</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
								<pluginExecution>
									<pluginExecutionFilter>
										<groupId>
											org.eclipse.xtext
										</groupId>
										<artifactId>
											xtext-maven-plugin
										</artifactId>
										<versionRange>
											[${xtext-version},)
										</versionRange>
										<goals>
											<goal>generate</goal>
										</goals>
									</pluginExecutionFilter>
									<action>
										<ignore></ignore>
									</action>
								</pluginExecution>
							</pluginExecutions>
						</lifecycleMappingMetadata>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>
</project>
