<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>org.scijava</groupId>
		<artifactId>pom-scijava</artifactId>
		<version>37.0.0</version>
		<relativePath />
	</parent>

	<artifactId>scijava-ops-engine</artifactId>
	<version>1.0.0</version>

	<name>SciJava Ops Engine</name>
	<description>Java implementation of the SciJava Ops matching engine.</description>
	<url>https://github.com/scijava/scijava-ops-engine</url>
	<inceptionYear>2016</inceptionYear>
	<organization>
		<name>SciJava</name>
		<url>https://scijava.org/</url>
	</organization>
	<licenses>
		<license>
			<name>Simplified BSD License</name>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<id>ctrueden</id>
			<name>Curtis Rueden</name>
			<roles>
				<role>founder</role>
				<role>lead</role>
				<role>reviewer</role>
				<role>support</role>
				<role>maintainer</role>
			</roles>
		</developer>
		<developer>
			<id>gselzer</id>
			<name>Gabriel Selzer</name>
			<roles>
				<role>founder</role>
				<role>debugger</role>
				<role>reviewer</role>
				<role>support</role>
			</roles>
		</developer>
		<developer>
			<id>hinerm</id>
			<name>Mark Hiner</name>
			<roles>
				<role>debugger</role>
				<role>reviewer</role>
				<role>support</role>
			</roles>
		</developer>
	</developers>
	<contributors>
		<contributor>
			<name>David Kolb</name>
			<roles><role>founder</role></roles>
			<properties><id>Treiblesschorle</id></properties>
		</contributor>
		<contributor>
			<name>Marcel Wiedenmann</name>
			<roles><role>founder</role></roles>
			<properties><id>MarcelWiedenmann</id></properties>
		</contributor>
		<contributor>
			<name>Edward Evans</name>
			<properties><id>elevans</id></properties>
		</contributor>
	</contributors>

	<mailingLists>
		<mailingList>
			<name>Image.sc Forum</name>
			<archive>https://forum.image.sc/tag/scijava</archive>
		</mailingList>
	</mailingLists>

	<scm>
		<connection>scm:git:https://github.com/scijava/scijava</connection>
		<developerConnection>scm:git:git@github.com:scijava/scijava</developerConnection>
		<tag>scijava-aggregator-1.0.0</tag>
		<url>https://github.com/scijava/scijava</url>
	</scm>
	<issueManagement>
		<system>GitHub Issues</system>
		<url>https://github.com/scijava/scijava/issues</url>
	</issueManagement>
	<ciManagement>
		<system>GitHub Actions</system>
		<url>https://github.com/scijava/scijava/actions</url>
	</ciManagement>

	<properties>
		<main-class>org.scijava.ops.engine.Main</main-class>
		<package-name>org.scijava.ops.engine</package-name>

		<license.licenseName>bsd_2</license.licenseName>
		<license.copyrightOwners>SciJava developers.</license.copyrightOwners>

		<!--
		NB: Older versions of OpenJDK 11 have a bug in the javadoc tool,
		which causes errors like:

		[ERROR] javadoc: error - The code being documented uses packages
		in the unnamed module, but the packages defined in
		https://github.com/scijava/scijava/apidocs/ are in named modules.

		The most recent version of OpenJDK 11 known to have this problem
		is 11.0.8; the oldest version known to have fixed it is 11.0.17.
		Therefore, we set the minimum build JDK version to 11.0.17 here.
		-->
		<scijava.jvm.build.version>[11.0.17,)</scijava.jvm.build.version>
		<scijava.jvm.version>11</scijava.jvm.version>

		<scijava.ops.parse>true</scijava.ops.parse>

		<!--
			HACK: Allow individual tests to run successfully in IntelliJ. Avoids exception:
			java.lang.reflect.InaccessibleObjectException: Unable to make public
			static void org.scijava.ops.engine.AbstractTestEnvironment.setUp()
			accessible: module org.scijava.ops.engine does not "exports
			org.scijava.ops.engine" to unnamed module @402e37bc
		-->
		<scijava.surefire.args>--add-exports org.scijava.ops.engine/org.scijava.ops.engine=ALL-UNNAMED</scijava.surefire.args>

		<!-- TEMP: Until pom-scijava 38.0.0 is released. -->
		<scijava-maven-plugin.version>3.0.0</scijava-maven-plugin.version>
	</properties>

	<dependencies>
		<!-- SciJava dependencies -->
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>parsington</artifactId>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-collections</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-common3</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-meta</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-ops-api</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-ops-spi</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-discovery</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId> org.scijava</groupId>
			<artifactId>scijava-function</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-priority</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-progress</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-struct</artifactId>
			<version>${project.version}</version>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-types</artifactId>
			<version>${project.version}</version>
		</dependency>

		<!-- Third-party dependencies -->
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
		</dependency>
		<dependency>
			<groupId>org.javassist</groupId>
			<artifactId>javassist</artifactId>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
		</dependency>
		<dependency>
			<groupId>org.yaml</groupId>
			<artifactId>snakeyaml</artifactId>
		</dependency>

		<!-- Test scope dependencies -->
		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter-api</artifactId>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.scijava</groupId>
			<artifactId>scijava-testutil</artifactId>
			<version>${project.version}</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<annotationProcessorPaths>
						<path>
							<groupId>org.scijava</groupId>
							<artifactId>scijava-ops-indexer</artifactId>
							<version>${project.version}</version>
						</path>
					</annotationProcessorPaths>
					<fork>true</fork>
					<compilerArgs>
						<arg>-Ascijava.ops.parse="${scijava.ops.parse}"</arg>
						<arg>-Ascijava.ops.opVersion="${project.version}"</arg>
					</compilerArgs>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<links>
						<link>https://javadoc.scijava.org/Java11/</link>
						<link>https://javadoc.scijava.org/SCIFIO/</link>
						<link>https://javadoc.scijava.org/SciJava/</link>
						<link>https://javadoc.scijava.org/Guava/</link>
						<link>https://javadoc.scijava.org/Javassist/</link>
					</links>
					<tagletArtifacts>
						<tagletArtifact>
							<groupId>org.scijava</groupId>
							<artifactId>scijava-taglets</artifactId>
							<version>${project.version}</version>
						</tagletArtifact>
					</tagletArtifacts>
					<tags>
						<tag>
							<name>implNote</name>
							<placement>a</placement>
							<head>Implementation Note:</head>
						</tag>
					</tags>
				</configuration>
			</plugin>
			<plugin>
				<artifactId>maven-enforcer-plugin</artifactId>
				<executions>
					<execution>
						<id>enforce-package-rules</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<phase>test</phase>
						<configuration>
							<rules>
								<NoPackageCyclesRule implementation="org.scijava.maven.plugin.enforcer.NoPackageCyclesRule" />
								<NoSubpackageDependenceRule implementation="org.scijava.maven.plugin.enforcer.NoSubpackageDependenceRule" />
							</rules>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<groupId>com.alexecollins.maven.plugin</groupId>
				<artifactId>script-maven-plugin</artifactId>
				<version>1.0.0</version>
				<executions>
					<execution>
						<id>union-metadata-indices</id>
						<phase>process-test-classes</phase>
						<goals>
							<goal>execute</goal>
						</goals>
						<configuration>
							<language>ruby</language>
							<script>
								# Append the source plugin annotations to the test plugin annotations
								require 'set'

								# Handle windows paths
								basedir = '${project.basedir}'.gsub /\\+/, '\\\\'

								# Reads plugin metadata into a set of strings, one per plugin declaration.
								def read_plugins(path)
								delim = 'UNIQUE-SEQUENCE-THAT-NO-PLUGIN-WILL-EVER-USE'
								return File.exist?(path) ? File.read(path).sub('}{', '}' + delim + '{').split(delim).to_set : Set.new()
								end

								# Read in main and test scope plugin annotations.
								['ops.yaml'].each do |pluginsPath|
								mainPluginsPath = "#{basedir}/target/classes/#{pluginsPath}"
								testPluginsPath = "#{basedir}/target/test-classes/#{pluginsPath}"
								mainPlugins = read_plugins(mainPluginsPath)
								testPlugins = read_plugins(testPluginsPath)

								# Write out unioned plugin annotations to test scope plugin annotations.
								# Without this, the test scope code does not know of the main scope plugins.
								allPlugins = mainPlugins.union(testPlugins)
								unless allPlugins.empty?()
								require 'fileutils'
								FileUtils.mkdir_p File.dirname(testPluginsPath)
								File.write(testPluginsPath, allPlugins.to_a.join(''))
								end
								end
							</script>
						</configuration>
					</execution>
				</executions>
				<dependencies>
					<dependency>
						<groupId>org.jruby</groupId>
						<artifactId>jruby-complete</artifactId>
						<version>9.2.11.1</version>
						<scope>runtime</scope>
					</dependency>
				</dependencies>
			</plugin>
		</plugins>
	</build>
	<profiles>
		<profile>
			<id>only-eclipse-scijava</id>
			<activation>
				<property>
					<name>m2e.version</name>
				</property>
			</activation>
			<build>
				<pluginManagement>
					<plugins>
						<!--
						Configure the Eclipse m2e plugin to support needed plugins.
						-->
						<plugin>
							<groupId>org.eclipse.m2e</groupId>
							<artifactId>lifecycle-mapping</artifactId>
							<!--
							NB: Eclipse cannot handle an overridden version property here!
							The version needs to stay hardcoded at 1.0.0.
							-->
							<version>1.0.0</version>
							<configuration>
								<lifecycleMappingMetadata>
									<pluginExecutions combine.children="append">
										<!--
										NB: Make Eclipse union the metadata indices on every build; see:
										https://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html
										-->
										<pluginExecution>
											<pluginExecutionFilter>
												<groupId>com.alexecollins.maven.plugin</groupId>
												<artifactId>script-maven-plugin</artifactId>
												<versionRange>${script-maven-plugin.version}</versionRange>
												<goals>
													<goal>execute</goal>
												</goals>
											</pluginExecutionFilter>
											<action>
												<execute>
													<runOnConfiguration>true</runOnConfiguration>
													<!--
													NB: You might think we could run the annotations
													union script once only, at configuration time.
													Unfortunately, when configuration happens in Eclipse,
													the plugin annotations have not yet been generated.
													So let's redo the union on every incremental build.
													That'll show 'em!
													-->
													<runOnIncremental>true</runOnIncremental>
												</execute>
											</action>
										</pluginExecution>
									</pluginExecutions>
								</lifecycleMappingMetadata>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>
	</profiles>
</project>
