<?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.eclipse.glsp</groupId>
	<artifactId>org.eclipse.glsp.parent</artifactId>
	<description>GLSP Parent pom </description>
	<version>1.0.0</version>
	<packaging>pom</packaging>

	<name>GLSP Parent</name>

	<url>https://www.eclipse.org/glsp</url>
	<licenses>
		<license>
			<name>Eclipse Public License - v 2.0</name>
			<url>http://www.eclipse.org/legal/epl-v20.html</url>
			<distribution>repo</distribution>
		</license>
	</licenses>

	<developers>
		<developer>
			<name>Eclipse GLSP Project</name>
			<email>glsp-dev@eclipse.org</email>
			<organization>Eclipse GLSP</organization>
			<organizationUrl>https://projects.eclipse.org/projects/ecd.glsp</organizationUrl>
		</developer>
	</developers>

	<scm>
		<url>https://github.com/eclipse-glsp/glsp-server</url>
		<connection>scm:git@github.com:eclipse-glsp/glsp-server.git</connection>
		<developerConnection>scm:git@github.com:eclipse-glsp/glsp-server.git</developerConnection>
		<tag>HEAD</tag>
	</scm>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<java.source>11</java.source>
		<java.target>11</java.target>
		<project.build.java.target>11</project.build.java.target>
	</properties>

	<pluginRepositories>
		<pluginRepository>
			<id>sonatype</id>
			<name>Sonatype</name>
			<url>https://oss.sonatype.org/content/groups/public</url>
		</pluginRepository>
	</pluginRepositories>

	<build>
		<sourceDirectory>src</sourceDirectory>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>3.8.0</version>
				<configuration>
					<source>${java.source}</source>
					<target>${java.target}</target>
					<generatedSourcesDirectory>src-gen</generatedSourcesDirectory>
				</configuration>
			</plugin>
		</plugins>
	</build>

	<dependencies>
		<dependency>
			<groupId>org.apache.logging.log4j</groupId>
			<artifactId>log4j-core</artifactId>
			<version>2.17.1</version>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>30.1-jre</version>
		</dependency>
	</dependencies>

	<profiles>
		<profile>
			<id>p2</id>
			<activation>
				<activeByDefault>true</activeByDefault>
			</activation>

			<properties>
				<tycho-version>2.3.0</tycho-version>
				<maven-antrun-plugin.version>1.8</maven-antrun-plugin.version>
			</properties>

			<modules>
				<module>plugins/org.eclipse.glsp.server</module>
				<module>plugins/org.eclipse.glsp.server.emf</module>
				<module>plugins/org.eclipse.glsp.server.websocket</module>
				<module>plugins/org.eclipse.glsp.layout</module>
				<module>plugins/org.eclipse.glsp.graph</module>
				<module>examples/org.eclipse.glsp.example.workflow</module>
				<module>releng</module>
			</modules>
			<build>
				<pluginManagement>
					<plugins>
						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-compiler-plugin</artifactId>
							<version>${tycho-version}</version>
						</plugin>
						<!-- enable tycho build extension -->
						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-maven-plugin</artifactId>
							<version>${tycho-version}</version>
							<extensions>true</extensions>
						</plugin>
						<plugin>
							<!-- enable source bundle generation -->
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-source-plugin</artifactId>
							<version>${tycho-version}</version>
						</plugin>
						<plugin>
							<!-- enable automated version updates -->
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>tycho-versions-plugin</artifactId>
							<version>${tycho-version}</version>
						</plugin>
						<plugin>
							<groupId>org.eclipse.tycho</groupId>
							<artifactId>target-platform-configuration</artifactId>
							<version>${tycho-version}</version>
						</plugin>
					</plugins>
				</pluginManagement>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<version>2.7</version>
						<configuration>
							<encoding>UTF-8</encoding>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-maven-plugin</artifactId>
						<extensions>true</extensions>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-compiler-plugin</artifactId>
						<configuration>
							<source>${java.source}</source>
							<target>${java.target}</target>
							<optimize>true</optimize>
							<showWarnings>false</showWarnings>
						</configuration>
					</plugin>
					<plugin>
						<!-- enable source bundle generation -->
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-source-plugin</artifactId>
						<executions>
							<execution>
								<id>plugin-source</id>
								<goals>
									<goal>plugin-source</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<!-- enable automated version updates -->
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>tycho-versions-plugin</artifactId>
					</plugin>
					<plugin>
						<groupId>org.eclipse.tycho</groupId>
						<artifactId>target-platform-configuration</artifactId>
						<configuration>
							<includePackedArtifacts>true</includePackedArtifacts>
							<targetDefinitionIncludeSource>honor</targetDefinitionIncludeSource>
							<environments>
								<environment>
									<os>win32</os>
									<ws>win32</ws>
									<arch>x86_64</arch>
								</environment>
								<environment>
									<os>linux</os>
									<ws>gtk</ws>
									<arch>x86_64</arch>
								</environment>
								<environment>
									<os>macosx</os>
									<ws>cocoa</ws>
									<arch>x86_64</arch>
								</environment>
							</environments>
							<target>
								<artifact>
									<groupId>org.eclipse.glsp</groupId>
									<artifactId>org.eclipse.glsp.parent</artifactId>
									<classifier>targetplatforms/r2022-03</classifier>
									<version>${project.version}</version>
								</artifact>
							</target>
						</configuration>
					</plugin>
				</plugins>
			</build>
		</profile>


		<profile>
			<id>m2</id>
			<activation>
				<activeByDefault>false</activeByDefault>
			</activation>

			<properties>
				<checkstyle.plugin>3.1.2</checkstyle.plugin>
				<checkstyle>8.44</checkstyle>
			</properties>

			<modules>
				<module>plugins/org.eclipse.glsp.graph</module>
				<module>plugins/org.eclipse.glsp.layout</module>
				<module>plugins/org.eclipse.glsp.server</module>
				<module>plugins/org.eclipse.glsp.server.emf</module>
				<module>plugins/org.eclipse.glsp.server.websocket</module>
				<module>examples/org.eclipse.glsp.example.workflow</module>
				<module>tests</module>
			</modules>

			<pluginRepositories>
				<pluginRepository>
					<id>sonatype</id>
					<name>Sonatype</name>
					<url>https://oss.sonatype.org/content/groups/public</url>
				</pluginRepository>
			</pluginRepositories>

			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<version>3.0.1</version>
						<configuration>
							<argLine>
								--illegal-access=permit
							</argLine>
						</configuration>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-surefire-plugin</artifactId>
						<version>2.22.1</version>
						<configuration>
							<argLine>
								--illegal-access=permit
							</argLine>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-failsafe-plugin</artifactId>
						<version>2.22.1</version>
						<configuration>
							<argLine>
								--illegal-access=permit
							</argLine>
						</configuration>
					</plugin>
					<!-- to disable use -Dcheckstyle.skip -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-checkstyle-plugin</artifactId>
						<version>${checkstyle.plugin}</version>
						<configuration>
							<configLocation>emfcloud-checkstyle-8.44.xml</configLocation>
							<consoleOutput>true</consoleOutput>
							<excludes>**/src-gen/**/*.java</excludes>
						</configuration>
						<executions>
							<execution>
								<phase>validate</phase>
								<goals>
									<goal>check</goal>
								</goals>
							</execution>
						</executions>
						<dependencies>
							<dependency>
								<groupId>org.eclipse.emfcloud</groupId>
								<artifactId>org.eclipse.emfcloud.checkstyle</artifactId>
								<version>0.1.0-SNAPSHOT</version>
							</dependency>
							<dependency>
								<groupId>com.puppycrawl.tools</groupId>
								<artifactId>checkstyle</artifactId>
								<version>${checkstyle}</version>
							</dependency>
						</dependencies>
					</plugin>
				</plugins>
			</build>
		</profile>

		<profile>
			<id>m2-release</id>
			<modules>
				<module>plugins/org.eclipse.glsp.graph</module>
				<module>plugins/org.eclipse.glsp.layout</module>
				<module>plugins/org.eclipse.glsp.server</module>
				<module>plugins/org.eclipse.glsp.server.websocket</module>
				<module>examples/org.eclipse.glsp.example.workflow</module>
			</modules>

			<distributionManagement>
				<snapshotRepository>
					<id>ossrh</id>
					<url>https://oss.sonatype.org/content/repositories/snapshots</url>
				</snapshotRepository>
			</distributionManagement>
			<build>
				<plugins>
					<!-- To release to Sonatype/Maven central -->
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>1.6.8</version>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://oss.sonatype.org/</nexusUrl>
							<autoreleaseafterclose>true</autoreleaseafterclose>
						</configuration>
					</plugin>
					<!-- To generate javadoc -->

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-javadoc-plugin</artifactId>
						<version>3.3.1</version>
						<configuration>
						
							<source>8</source>
							<detectJavaApiLink>false</detectJavaApiLink>
							<tags>
								<tag>
									<name>generated</name>
									<placement>a</placement>
								</tag>
								<tag>
									<name>model</name>
									<placement>a</placement>
								</tag>
								<tag>
									<name>ordered</name>
									<placement>a</placement>
								</tag>
							</tags>
						</configuration>
						<executions>
							<execution>
								<id>attach-javadocs</id>
								<goals>
									<goal>jar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>

					<!-- To sign the artifacts -->
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>1.6</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>

					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-deploy-plugin</artifactId>
						<version>2.8</version>
						<configuration>
							<skip>true</skip>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>versions-maven-plugin</artifactId>
						<version>2.7</version>
					</plugin>
				</plugins>

			</build>
		</profile>
	</profiles>
</project>
