<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/maven-v4_0_0.xsd">
	<modelVersion>4.0.0</modelVersion>
	<groupId>dev.otbe</groupId>
	<artifactId>gitlab-ci</artifactId>
	<packaging>pom</packaging>
	<version>0.2.0</version>

	<name>Gitlab CI DSL</name>

	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

		<maven.compiler.source>1.8</maven.compiler.source>
		<maven.compiler.target>1.8</maven.compiler.target>

		<junit.version>5.10.0</junit.version>
		<kotlin.version>1.9.10</kotlin.version>
		<serialization.version>1.6.0</serialization.version>
		<jackson.version>2.15.2</jackson.version>
		<maven-javadoc-plugin.version>3.5.0</maven-javadoc-plugin.version>
		<nexus-staging-maven-plugin.version>1.6.13</nexus-staging-maven-plugin.version>
		<maven-gpg-plugin.version>3.1.0</maven-gpg-plugin.version>
		<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
	</properties>

	<description>A simple kotlin based DSL to generate Gitlab CI pipelines.</description>
	<url>https://gitlab.com/otbe.dev/gitlab-ci-dsl</url>
	<licenses>
		<license>
			<name>The Apache Software License, Version 2.0</name>
			<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
		</license>
	</licenses>
	<scm>
		<connection>scm:git:git@gitlab.com:otbe.dev/gitlab-ci-dsl.git</connection>
		<developerConnection>scm:git:git@gitlab.com:otbe.dev/gitlab-ci-dsl.git</developerConnection>
		<url>https://gitlab.com/otbe.dev/gitlab-ci-dsl.gitt</url>
		<tag>HEAD</tag>
	</scm>
	<developers>
		<developer>
			<name>Benjamin Otto</name>
			<organization>otbe.dev</organization>
			<organizationUrl>https://gitlab.com/otbe.dev</organizationUrl>
		</developer>
	</developers>

	<modules>
		<module>core</module>
		<module>dsl</module>
		<module>constructs</module>
		<module>maven-plugin</module>
	</modules>

	<dependencies>
		<dependency>
			<groupId>org.jetbrains.kotlin</groupId>
			<artifactId>kotlin-stdlib-jdk8</artifactId>
			<version>${kotlin.version}</version>
		</dependency>

		<dependency>
			<groupId>org.junit.jupiter</groupId>
			<artifactId>junit-jupiter</artifactId>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>io.github.origin-energy</groupId>
			<artifactId>java-snapshot-testing-junit5</artifactId>
			<version>4.0.6</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>2.0.9</version>
			<scope>test</scope>
		</dependency>

		<dependency>
			<groupId>io.strikt</groupId>
			<artifactId>strikt-core</artifactId>
			<version>0.34.1</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-surefire-plugin</artifactId>
				<version>3.1.2</version>
			</plugin>

			<plugin>
				<groupId>org.jetbrains.kotlin</groupId>
				<artifactId>kotlin-maven-plugin</artifactId>
				<version>${kotlin.version}</version>
				<executions>
					<execution>
						<id>compile</id>
						<phase>process-sources</phase>
						<goals>
							<goal>compile</goal>
						</goals>
					</execution>
					<execution>
						<id>test-compile</id>
						<phase>test-compile</phase>
						<goals>
							<goal>test-compile</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<jvmTarget>1.8</jvmTarget>

				</configuration>

			</plugin>

			<plugin>
				<groupId>com.diffplug.spotless</groupId>
				<artifactId>spotless-maven-plugin</artifactId>
				<version>2.40.0</version>
				<executions>
					<execution>
						<phase>initialize</phase>
						<goals>
							<goal>apply</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<formats>
						<format>
							<includes>
								<include>**/*.xml</include>
							</includes>
							<excludes>
								<exclude>.m2/**</exclude>
								<exclude>.idea/**</exclude>
							</excludes>

							<eclipseWtp>
								<type>XML</type>
								<version>4.7.3a</version>
							</eclipseWtp>
						</format>
					</formats>

					<kotlin>
						<includes>
							<include>**/*.kt</include>
							<include>**/*.kts</include>
						</includes>

						<ktlint>
							<version>0.48.2</version>
						</ktlint>
					</kotlin>
				</configuration>
			</plugin>

			<plugin>
				<groupId>com.amashchenko.maven.plugin</groupId>
				<artifactId>gitflow-maven-plugin</artifactId>
				<version>1.20.0</version>
				<configuration>
					<gitFlowConfig>
						<productionBranch>main</productionBranch>
						<developmentBranch>main</developmentBranch>
					</gitFlowConfig>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-release-plugin</artifactId>
				<version>3.0.1</version>
				<configuration>
					<arguments>-Dossrh=true</arguments>
					<preparationGoals>clean validate</preparationGoals>
				</configuration>
			</plugin>

			<plugin>
				<groupId>org.jacoco</groupId>
				<artifactId>jacoco-maven-plugin</artifactId>
				<version>${jacoco-maven-plugin.version}</version>
				<executions>
					<execution>
						<id>prepare-agent</id>
						<goals>
							<goal>prepare-agent</goal>
						</goals>
					</execution>
				</executions>
				<configuration>
					<excludes>
						<exclude>**/*$$serializer.*</exclude>
						<exclude>**/*HelpMojo.*</exclude>
					</excludes>
				</configuration>
			</plugin>

			<plugin>
				<groupId>dev.otbe</groupId>
				<artifactId>gitlab-ci-maven-plugin</artifactId>
				<version>0.1.1</version>
				<inherited>false</inherited>
				<executions>
					<execution>
						<goals>
							<goal>build</goal>
						</goals>
						<configuration>
							<inputFile>${project.basedir}/gitlab.main.kts</inputFile>
							<outputFile>${project.basedir}/.gitlab-ci.yml</outputFile>
						</configuration>
					</execution>
				</executions>
			</plugin>
		</plugins>
	</build>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.junit</groupId>
				<artifactId>junit-bom</artifactId>
				<version>${junit.version}</version>
				<type>pom</type>
				<scope>import</scope>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<profiles>
		<profile>
			<id>not-ossrh</id>
			<activation>
				<property>
					<name>!ossrh</name>
				</property>
			</activation>
			<modules>
				<module>coverage</module>
			</modules>
		</profile>
		<profile>
			<id>oss.release-sign-artifacts</id>
			<activation>
				<property>
					<name>ossrh</name>
				</property>
			</activation>
			<distributionManagement>
				<snapshotRepository>
					<id>ossrh</id>
					<url>https://oss.sonatype.org/content/repositories/snapshots</url>
				</snapshotRepository>
				<repository>
					<id>ossrh</id>
					<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
				</repository>
			</distributionManagement>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-gpg-plugin</artifactId>
						<version>${maven-gpg-plugin.version}</version>
						<executions>
							<execution>
								<id>sign-artifacts</id>
								<phase>verify</phase>
								<goals>
									<goal>sign</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.sonatype.plugins</groupId>
						<artifactId>nexus-staging-maven-plugin</artifactId>
						<version>${nexus-staging-maven-plugin.version}</version>
						<extensions>true</extensions>
						<configuration>
							<serverId>ossrh</serverId>
							<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
							<autoReleaseAfterClose>true</autoReleaseAfterClose>
							<stagingProgressTimeoutMinutes>20</stagingProgressTimeoutMinutes>
							<detail>true</detail>
							<keepStagingRepositoryOnFailure>true</keepStagingRepositoryOnFailure>
							<keepStagingRepositoryOnCloseRuleFailure>true</keepStagingRepositoryOnCloseRuleFailure>
							<showReleased>true</showReleased>
						</configuration>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-source-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-sources</id>
								<goals>
									<goal>jar-no-fork</goal>
								</goals>
								<phase>package</phase>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.jetbrains.dokka</groupId>
						<artifactId>dokka-maven-plugin</artifactId>
						<version>1.9.0</version>
						<executions>
							<execution>
								<phase>package</phase>
								<goals>
									<goal>javadocJar</goal>
								</goals>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
