<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>org.yarnandtail</groupId>
		<artifactId>andhow-parent</artifactId>
		<version>1.5.0</version>
	</parent>

	<artifactId>andhow-annotation-processor</artifactId>
	<packaging>jar</packaging>
	<name>AndHow Annotation Processor</name>
	<description>
		Compile-time annotation processor that records all AndHow Properties and
		registers them as service providers to be picked up at runtime.
	</description>

	<dependencies>

		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>andhow-core</artifactId>
			<version>${project.version}</version>
			<scope>provided</scope>
		</dependency>

		<dependency>
			<groupId>${project.groupId}</groupId>
			<artifactId>andhow-annotation-processor-test-harness</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>

		<!-- All dependencies are test dependencies only -->
		<dependency>
			<groupId>com.google.testing.compile</groupId>
			<artifactId>compile-testing</artifactId>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>DisableAnnotationProcOnJDK8</id>
			<activation>
				<jdk>[1.8,1.9)</jdk>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<configuration>
							<source>1.8</source>
							<target>1.8</target>
							<compilerArgs>
								<!--
								proc:none turns off annotation processors so AndHowCompileProcessor
								does not attempt to process itself.
								-->
								<arg>-proc:none</arg>
							</compilerArgs>
							<fork>true</fork>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>SomeJDK8s</id>
			<activation>
				<activeByDefault>false</activeByDefault>
				<file>
					<exists>${java.home}/../lib/tools.jar</exists>
				</file>
				<jdk>[1.8,1.9)</jdk>
			</activation>
			<dependencies>
				<dependency>
					<groupId>com.sun</groupId>
					<artifactId>tools</artifactId>
					<version>1.8</version>
					<scope>system</scope>
					<systemPath>${java.home}/../lib/tools.jar</systemPath>
				</dependency>
			</dependencies>
		</profile>
		<profile>
			<id>java9AndBeyond</id>
			<!--
			Its not possible to build a JRE 1.8 compatible jar file using JDK9+ bc of the need to
			use the '-add-modules' feature of JDK9. When '-add-modules' is used, javac refuses to
			compile to a version earlier than 1.9.  Thus, until 1.8 support is dumped by AndHow,
			distributed releases and snapshots need to be done w/ JDK 1.8.
			-->
			<activation>
				<jdk>[1.9,)</jdk>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<configuration>
							<compilerArgs>
								<!--
								Include the compile libs (tools.jar) for the annotation
								processor to compile against.
								 -->
								<arg>--add-modules=jdk.compiler</arg>
								<!--
								proc:none turns off annotation processors so AndHowCompileProcessor
								does not attempt to process itself.
								-->
								<arg>-proc:none</arg>
							</compilerArgs>
							<!-- without forking compilation happens in the
							same process, so no arguments are applied -->
							<fork>true</fork>
							<source>${java.vm.specification.version}</source>
							<target>${java.vm.specification.version}</target>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>

</project>
