<?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/xsd/maven-4.0.0.xsd">

	<modelVersion>4.0.0</modelVersion>
	<groupId>org.palladiosimulator</groupId>
	<artifactId>eclipse-parent</artifactId>
	<version>0.10.0</version>
	<name>${project.artifactId}</name>
	<description>A common parent POM for all Eclipse builds of Palladio.</description>
	<url>https://palladio-simulator.com</url>
	<packaging>pom</packaging>

	<licenses>
		<license>
			<name>The Apache License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Nicolas Boltz</name>
			<email>boltz@kit.edu</email>
			<organization>Karlsruhe Institute of Technology (KIT), Germany</organization>
			<organizationUrl>http://kit.edu</organizationUrl>
		</developer>
		<developer>
			<name>Ralf Sieger</name>
			<email>sieger@fzi.de</email>
			<organization>FZI Research Center for Information Technology, Germany</organization>
			<organizationUrl>http://www.fzi.de</organizationUrl>
		</developer>
	</developers>

	<scm>
		<connection>scm:git:git://github.com/palladiosimulator/palladio-build-mavenparent.git</connection>
		<developerConnection>scm:git:ssh://github.com/palladiosimulator/palladio-build-mavenparent.git</developerConnection>
		<url>http://github.com/palladiosimulator/palladio-build-mavenparent/tree/master</url>
	</scm>

	<properties>
		<tycho.version>2.7.5</tycho.version>
		<javadoc.args>
			-tag "generated:a:Generated class or method."
			-tag "model:a:EMF model class or method."
			-tag "ordered:a:Ordered collection."
			-tag 'noimplement:a:Restriction:'
			-tag 'noextend:a:Restriction:'
			-tag 'noreference:a:Restriction:'
			-tag 'noinstantiate:a:Restriction:'
			-tag 'nooverride:a:Restriction:'
			-tag 'category:a:Category:'
			-link ${java.api.doc}
			-link https://help.eclipse.org/2022-12/topic/org.eclipse.platform.doc.isv/reference/api
			-link https://download.eclipse.org/modeling/emf/emf/javadoc/2.11/
			-link https://download.eclipse.org/modeling/emft/mwe/javadoc/2.9/
		</javadoc.args>
		<!-- The property is meant to be overridden but still has to contain valid content, so we just repeat valid content. -->
		<javadoc.additional.args>
			-link ${java.api.doc}
		</javadoc.additional.args>
	</properties>
	
	<build>
		<plugins>
			<plugin>
				<groupId>org.sonatype.central</groupId>
				<artifactId>central-publishing-maven-plugin</artifactId>
				<version>0.7.0</version>
				<extensions>true</extensions>
				<configuration>
					<publishingServerId>central</publishingServerId>
					<centralBaseUrl>https://central.sonatype.com</centralBaseUrl>
					<autoPublish>true</autoPublish>
					<waitUntil>published</waitUntil>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<profiles>

		<!-- Build configuration of parent POM itself -->
		<profile>
			<id>local-build-deployable</id>
			<!-- activate this profile explicitly by adding -Plocal-build-deployable to the maven command -->
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>3.2.7</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
								<configuration>
									<gpgArguments>
										<arg>--pinentry-mode</arg>
										<arg>loopback</arg>
									</gpgArguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<!-- Profiles to be inherited -->
		
		<profile>
			<id>default-plugin-usage</id>
			<activation>
				<file>
					<missing>.maven_disable_default-plugin-usage</missing>
				</file>
			</activation>
			<build>
				<plugins>
					<!-- Build (tycho target platform) -->
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>target-platform-configuration</artifactId>
					</plugin>

					<!-- Build (general) -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
					</plugin>

					<!-- Build (tycho) -->
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-source-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-p2-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-maven-plugin</artifactId>
						<extensions>true</extensions>
					</plugin>

					<!-- Cleanup -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-clean-plugin</artifactId>
					</plugin>

					<!-- Tests -->
					<plugin>
						<groupId>org.jacoco</groupId>
						<artifactId>jacoco-maven-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-surefire-plugin</artifactId>
					</plugin>

				</plugins>
			</build>
		</profile>

		<profile>
			<id>compile-xtend</id>
			<activation>
				<file>
					<missing>.maven_disable_compile-xtend</missing>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.eclipse.xtend</groupId>
						<artifactId>xtend-maven-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>default-plugin-configurations</id>
			<activation>
				<file>
					<missing>.maven_disable_default-plugin-configurations</missing>
				</file>
			</activation>
			<properties>
				<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
				<project.reporting.outputEncoding>${project.build.sourceEncoding}</project.reporting.outputEncoding>
				<java.version>17</java.version>
				<java.api.doc>https://docs.oracle.com/en/java/javase/17/docs/api/</java.api.doc>
				<maven.compiler.target>${java.version}</maven.compiler.target>
				<maven.compiler.source>${java.version}</maven.compiler.source>
			</properties>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>target-platform-configuration</artifactId>
							<version>${tycho.version}</version>
							<configuration>
								<environments>
									<environment>
										<os>linux</os>
										<ws>gtk</ws>
										<arch>x86_64</arch>
									</environment>
									<environment>
										<os>linux</os>
										<ws>gtk</ws>
										<arch>aarch64</arch>
									</environment>
									<environment>
										<os>win32</os>
										<ws>win32</ws>
										<arch>x86_64</arch>
									</environment>
									<environment>
										<os>macosx</os>
										<ws>cocoa</ws>
										<arch>x86_64</arch>
									</environment>
									<environment>
										<os>macosx</os>
										<ws>cocoa</ws>
										<arch>aarch64</arch>
									</environment>
								</environments>
							</configuration>
						</plugin>

						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-compiler-plugin</artifactId>
							<version>3.14.0</version>
						</plugin>

						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-source-plugin</artifactId>
							<version>${tycho.version}</version>
							<executions>
								<execution>
									<id>plugin-source</id>
									<goals>
										<goal>plugin-source</goal>
									</goals>
								</execution>
								<execution>
									<id>feature-source</id>
									<goals>
										<goal>feature-source</goal>
									</goals>
								</execution>
							</executions>
						</plugin>

						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-p2-plugin</artifactId>
							<version>${tycho.version}</version>
							<executions>
								<execution>
									<id>attached-p2-metadata</id>
									<phase>package</phase>
									<goals>
										<goal>p2-metadata</goal>
									</goals>
								</execution>
							</executions>
						</plugin>

						<plugin>
							<groupId>org.eclipse.xtend</groupId>
							<artifactId>xtend-maven-plugin</artifactId>
							<version>2.39.0</version>
							<executions>
								<execution>
									<goals>
										<goal>compile</goal>
									</goals>
									<configuration>
										<outputDirectory>xtend-gen</outputDirectory>
										<javaSourceVersion>17</javaSourceVersion>
									</configuration>
								</execution>
							</executions>
						</plugin>

						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-clean-plugin</artifactId>
							<version>3.5.0</version>
							<configuration>
								<excludeDefaultDirectories>true</excludeDefaultDirectories>
								<filesets>
									<fileset>
										<directory>${project.basedir}</directory>
										<includes>
											<include>target/**</include>
											<include>xtend-gen/**</include>
											<include>emfparsley-gen/**</include>
										</includes>
										<excludes>
											<exclude>*/.gitkeep</exclude>
										</excludes>
									</fileset>
								</filesets>
							</configuration>
						</plugin>

						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-maven-plugin</artifactId>
							<version>${tycho.version}</version>
							<extensions>true</extensions>
						</plugin>

						<plugin>
							<groupId>org.jacoco</groupId>
							<artifactId>jacoco-maven-plugin</artifactId>
							<version>0.8.13</version>
							<executions>
								<execution>
									<id>jacoco-prepare</id>
									<phase>generate-test-sources</phase>
									<goals>
										<goal>prepare-agent</goal>
									</goals>
								</execution>
							</executions>
						</plugin>

						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-surefire-plugin</artifactId>
							<version>${tycho.version}</version>
							<configuration>
								<includes>
									<include>**/*Test.java</include>
									<include>**/*Tests.java</include>
								</includes>
								<failIfNoTests>false</failIfNoTests>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

	</profiles>

</project>
