<?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>
	<parent>
		<groupId>org.palladiosimulator</groupId>
		<artifactId>eclipse-parent</artifactId>
		<version>0.10.0</version>
	</parent>
	<groupId>org.palladiosimulator</groupId>
	<artifactId>eclipse-parent-updatesite</artifactId>
	<name>${project.artifactId}</name>
	<description>A common parent POM for all Eclipse Update Site builds of Palladio.</description>
	<url>https://palladio-simulator.com</url>
	<packaging>pom</packaging>

	<profiles>

		<profile>
			<id>updatesite-build</id>
			<activation>
				<file>
					<missing>.maven_disable_updatesite-build</missing>
				</file>
			</activation>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>target-platform-configuration</artifactId>
							<configuration>
								<target>
									<!-- Using ${maven.multiModuleProjectDirectory} ensures that the target platform is resolved only once
									for the entire multi-module project, rather than for each submodule individually. This centralized
									resolution significantly speeds up the build process.
									
									Note: ${maven.multiModuleProjectDirectory} will be deprecated in Maven 4 and should be replaced with
									${project.rootDirectory} when upgrading. For more information, see:
									https://maven.apache.org/guides/mini/guide-migration-to-mvn4.html#Replace_removed_directory_properties
									
									Additionally, in Maven 4, it is highly recommended to explicitly define the project's root directory.
									For more information, see:
									https://maven.apache.org/guides/mini/guide-migration-to-mvn4.html#Define_project.27s_root_directory -->
									<file>${maven.multiModuleProjectDirectory}/${targetPlatform.relativePath}</file>
								</target>
							</configuration>
						</plugin>
					</plugins>
				</pluginManagement>
			</build>
		</profile>

		<profile>
			<id>palladio-build-customizations</id>
			<activation>
				<file>
					<missing>.maven_disable_palladio-build-customizations</missing>
				</file>
			</activation>
			<properties>
				<checkstyle.version>9.3</checkstyle.version>
			</properties>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.apache.maven.plugins</groupId>
							<artifactId>maven-checkstyle-plugin</artifactId>
							<version>3.1.2</version>
							<dependencies>
								<dependency>
									<groupId>com.puppycrawl.tools</groupId>
									<artifactId>checkstyle</artifactId>
									<version>${checkstyle.version}</version>
								</dependency>
							</dependencies>
							<executions>
								<execution>
									<id>palladio-checkstyle</id>
									<phase>package</phase>
									<goals>
										<goal>check</goal>
									</goals>
									<configuration>
										<configLocation>https://raw.githubusercontent.com/PalladioSimulator/Palladio-Build-CodingConventions/master/misc/org.palladiosimulator.codeconventions/palladio-checkstyle-rules-${checkstyle.version}.xml</configLocation>
										<failOnViolation>false</failOnViolation>
									</configuration>
								</execution>
							</executions>
						</plugin>
					</plugins>
				</pluginManagement>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>tycho-javadoc-for-updatesite</id>
			<activation>
				<file>
					<exists>category.xml</exists>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.eclipse.tycho.extras</groupId>
						<artifactId>tycho-document-bundle-plugin</artifactId>
						<version>${tycho.version}</version>
						<executions>
							<execution>
								<id>eclipse-javadoc</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>javadoc</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/repository/javadoc</outputDirectory>
									<skipTocGen>true</skipTocGen>
									<javadocOptions>
										<additionalArguments>
											<additionalArgument>${javadoc.args}</additionalArgument>
											<additionalArgument>${javadoc.additional.args}</additionalArgument>
										</additionalArguments>
									</javadocOptions>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>tycho-javadoc-for-bundle</id>
			<activation>
				<file>
					<exists>META-INF/MANIFEST.MF</exists>
				</file>
				<property>
					<name>generateJavaDocPerBundle</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.eclipse.tycho.extras</groupId>
						<artifactId>tycho-document-bundle-plugin</artifactId>
						<version>${tycho.version}</version>
						<executions>
							<execution>
								<id>artifact-javadoc</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>javadoc</goal>
								</goals>
								<configuration>
									<skipTocGen>true</skipTocGen>
									<outputDirectory>${project.build.directory}/javadoc</outputDirectory>
									<javadocOptions>
										<additionalArguments>
											<additionalArgument>${javadoc.args}</additionalArgument>
											<additionalArgument>${javadoc.additional.args}</additionalArgument>
										</additionalArguments>
									</javadocOptions>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-jar-plugin</artifactId>
						<version>3.4.2</version>
						<executions>
							<execution>
								<id>artifact-javadoc-package</id>
								<goals>
									<goal>jar</goal>
								</goals>
								<configuration>
									<archive>
										<addMavenDescriptor>false</addMavenDescriptor>
									</archive>
									<classesDirectory>${project.build.directory}/javadoc</classesDirectory>
									<classifier>javadoc</classifier>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>execute-generate-workflow</id>
			<activation>
				<file>
					<exists>workflow/generate.mwe2</exists>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>3.5.1</version>
						<executions>
							<execution>
								<id>ExecuteMWE2LauncherForGenerate</id>
								<phase>generate-sources</phase>
								<goals>
									<goal>java</goal>
								</goals>
								<configuration>
									<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
									<arguments>
										<argument>/${project.basedir}/workflow/generate.mwe2</argument>
										<argument>-p</argument>
										<argument>workspaceRoot=/${maven.multiModuleProjectDirectory}</argument>
									</arguments>
									<classpathScope>compile</classpathScope>
									<includePluginDependencies>true</includePluginDependencies>
									<cleanupDaemonThreads>false</cleanupDaemonThreads> <!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>execute-clean-workflow</id>
			<activation>
				<file>
					<exists>workflow/clean.mwe2</exists>
				</file>
			</activation>
			<build>
				<plugins>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>exec-maven-plugin</artifactId>
						<version>3.5.1</version>
						<executions>
							<execution>
								<id>ExecuteMWE2LauncherForClean</id>
								<phase>clean</phase>
								<goals>
									<goal>java</goal>
								</goals>
								<configuration>
									<mainClass>org.eclipse.emf.mwe2.launch.runtime.Mwe2Launcher</mainClass>
									<arguments>
										<argument>/${project.basedir}/workflow/clean.mwe2</argument>
										<argument>-p</argument>
										<argument>workspaceRoot=/${maven.multiModuleProjectDirectory}</argument>
									</arguments>
									<classpathScope>compile</classpathScope>
									<includePluginDependencies>true</includePluginDependencies>
									<cleanupDaemonThreads>false</cleanupDaemonThreads> <!-- see https://bugs.eclipse.org/bugs/show_bug.cgi?id=475098#c3 -->
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>enable-dagger</id>
			<activation>
				<file>
					<exists>.enable_dagger_annotation_processing</exists>
				</file>
			</activation>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-compiler-plugin</artifactId>
						<version>3.14.0</version>
						<executions>
							<execution>
								<id>process-dagger-annotations</id>
								<goals>
									<goal>compile</goal>
								</goals>
								<phase>generate-sources</phase>
								<configuration>
									<annotationProcessorPaths>
										<annotationProcessorPath>
											<groupId>com.google.dagger</groupId>
											<artifactId>dagger-compiler</artifactId>
											<version>2.31</version>
										</annotationProcessorPath>
									</annotationProcessorPaths>
									<proc>only</proc>
									<generatedSourcesDirectory>${project.basedir}/src-gen/</generatedSourcesDirectory>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-clean-plugin</artifactId>
						<version>3.5.0</version>
						<executions>
							<execution>
								<id>clean-src-gen</id>
								<phase>clean</phase>
								<goals>
									<goal>clean</goal>
								</goals>
								<configuration>
									<excludeDefaultDirectories>true</excludeDefaultDirectories>
									<filesets>
										<fileset>
											<directory>${project.basedir}</directory>
											<includes>
												<include>src-gen/**</include>
											</includes>
											<excludes>
												<exclude>*/.gitkeep</exclude>
											</excludes>
										</fileset>
									</filesets>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>

	</profiles>

</project>
