<?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>com.googlecode.cmake-maven-project</groupId>
		<artifactId>cmake</artifactId>
		<version>3.7.0-b2</version>
	</parent>
	<artifactId>cmake-maven-plugin</artifactId>
	<packaging>maven-plugin</packaging>
	<name>CMake Maven Plugin</name>
	<description>Builds native code using CMake makefile generator</description>
	<build>
		<!-- Filter the settings.xml file but not the test projects -->
		<testResources>
			<testResource>
				<directory>src/test/resources</directory>
				<includes>
					<include>settings.xml</include>
				</includes>
				<filtering>true</filtering>
			</testResource>
			<testResource>
				<directory>src/test/resources</directory>
				<excludes>
					<exclude>settings.xml</exclude>
				</excludes>
				<filtering>false</filtering>
			</testResource>
		</testResources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.6.0</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
					<encoding>${project.build.sourceEncoding}</encoding>
					<showDeprecation>true</showDeprecation>
					<compilerArgs>
						<arg>-Xlint:unchecked</arg>
					</compilerArgs>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-plugin-plugin</artifactId>
				<version>3.5</version>
				<configuration>
					<goalPrefix>cmake</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>
			<!-- Install the cmake-maven-plugin to the test repository -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-install-plugin</artifactId>
				<version>2.5.2</version>
				<executions>
					<execution>
						<id>install-plugin-for-it</id>
						<goals>
							<goal>install-file</goal>
						</goals>
						<phase>pre-integration-test</phase>
						<configuration>
							<file>${project.build.directory}/${project.build.finalName}.jar</file>
							<generatePom>true</generatePom>
							<pomFile>pom.xml</pomFile>
							<packaging>jar</packaging>
							<version>${project.version}</version>
							<localRepositoryPath>${test-repo}</localRepositoryPath>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Copy cmake-maven-plugin dependencies to the test repository -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-dependency-plugin</artifactId>
				<version>2.10</version>
				<executions>
					<execution>
						<id>copy-it-dependencies</id>
						<phase>pre-integration-test</phase>
						<goals>
							<goal>copy-dependencies</goal>
							<!-- There is a go-offline goal but it's broken
							http://jira.codehaus.org/browse/MDEP-82 -->
						</goals>
						<configuration>
							<artifactItems>
								<artifactItem>
									<groupId>${project.groupId}</groupId>
									<artifactId>${project.artifactId}</artifactId>
									<version>${project.version}</version>
									<type>${project.packaging}</type>
								</artifactItem>
							</artifactItems>
							<outputDirectory>${test-repo}</outputDirectory>
							<useRepositoryLayout>true</useRepositoryLayout>
							<addParentPoms>true</addParentPoms>
							<copyPom>true</copyPom>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<!-- Integration testing of cmake-maven-plugin's mojos -->
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>2.19.1</version>
				<configuration>
					<!-- Our tests shouldn't be run as unit tests -->
					<excludes>
						<exclude>**/*IntegrationTest.java</exclude>
					</excludes>
					<systemPropertyVariables>
						<!-- So we keep test dependencies in sync with this project -->
						<cmake.project.version>${project.version}</cmake.project.version>
						<!-- This passes the testing profile onto our test projects -->
						<cmake.classifier>${cmake.classifier}</cmake.classifier>
					</systemPropertyVariables>
					<argLine>-Dfile.encoding=${project.build.sourceEncoding}</argLine>
					<skipTests>${skipTests}</skipTests>
				</configuration>
				<executions>
					<execution>
						<id>integration-test</id>
						<goals>
							<goal>test</goal>
						</goals>
						<phase>integration-test</phase>
						<configuration>
							<includes>
								<include>**/*IntegrationSuite.java</include>
							</includes>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>
	<dependencies>
		<dependency>
			<groupId>org.twdata.maven</groupId>
			<artifactId>mojo-executor</artifactId>
			<version>2.2.0</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-core</artifactId>
			<version>3.3.9</version>
		</dependency>
		<dependency>
			<groupId>com.google.code.findbugs</groupId>
			<artifactId>annotations</artifactId>
			<version>3.0.1u2</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.plugin-tools</groupId>
			<artifactId>maven-plugin-annotations</artifactId>
			<version>3.5</version>
		</dependency>
		<!-- Below here are testing dependencies -->
		<dependency>
			<groupId>org.apache.maven.shared</groupId>
			<artifactId>maven-verifier</artifactId>
			<version>1.6</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.12</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<!-- Run tests from ${test-repo} repository instead of the local repo -->
	<properties>
		<test-repo>${project.build.directory}/test-classes/test-repo</test-repo>
	</properties>

	<profiles>
		<profile>
			<id>list-profiles</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.8</version>
						<executions>
							<execution>
								<phase>validate</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<echo>Please activate one of the following profiles:</echo>
										<echo>* windows-i386</echo>
										<echo>* windows-amd64</echo>
										<echo>* linux-i386</echo>
										<echo>* linux-amd64</echo>
										<echo>* linux-arm</echo>
										<echo>* mac-amd64</echo>
										<echo/>
										<echo>For instance: mvn -Pwindows-amd64 install</echo>
										<fail/>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>windows-i386</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>windows</family>
					<arch>x86</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>windows-i386</cmake.classifier>
			</properties>
			<dependencies>
				<dependency>
					<groupId>${project.groupId}</groupId>
					<artifactId>cmake-binaries</artifactId>
					<version>${project.version}</version>
					<classifier>${cmake.classifier}</classifier>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>windows-amd64</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>windows</family>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>windows-amd64</cmake.classifier>
			</properties>
			<dependencies>
				<dependency>
					<groupId>${project.groupId}</groupId>
					<artifactId>cmake-binaries</artifactId>
					<version>${project.version}</version>
					<classifier>${cmake.classifier}</classifier>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>linux-i386</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>linux</family>
					<arch>i386</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>linux-i386</cmake.classifier>
				<download.cmake>false</download.cmake>
			</properties>
		</profile>
		<profile>
			<id>linux-amd64</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>linux</family>
					<arch>amd64</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>linux-amd64</cmake.classifier>
			</properties>
			<dependencies>
				<dependency>
					<groupId>${project.groupId}</groupId>
					<artifactId>cmake-binaries</artifactId>
					<version>${project.version}</version>
					<classifier>${cmake.classifier}</classifier>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>linux-arm</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>linux</family>
					<arch>arm</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>linux-arm</cmake.classifier>
				<download.cmake>false</download.cmake>
			</properties>
		</profile>
		<profile>
			<id>mac-amd64</id>
			<activation>
				<property>
					<name>osDetection</name>
					<value>!false</value>
				</property>
				<os>
					<family>mac</family>
					<arch>x86_64</arch>
				</os>
			</activation>
			<properties>
				<cmake.classifier>mac-amd64</cmake.classifier>
			</properties>
			<dependencies>
				<dependency>
					<groupId>${project.groupId}</groupId>
					<artifactId>cmake-binaries</artifactId>
					<version>${project.version}</version>
					<classifier>${cmake.classifier}</classifier>
					<scope>test</scope>
				</dependency>
			</dependencies>
		</profile>
	</profiles>
</project>
