<?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.springframework.cloud</groupId>
		<artifactId>spring-cloud-task-parent</artifactId>
		<version>2.2.2.RELEASE</version>
	</parent>
	<artifactId>spring-cloud-task-docs</artifactId>
	<name>Spring Cloud Task Docs</name>
	<description>Spring Cloud Task Docs</description>
	<properties>
		<main.basedir>${basedir}/..</main.basedir>
		<asciidoctor.maven.plugin.version>1.6.0</asciidoctor.maven.plugin.version>
		<asciidoctorj.pdf.version>1.5.0-alpha.16</asciidoctorj.pdf.version>
	</properties>
	<dependencies>
		<dependency>
			<groupId>io.spring.docresources</groupId>
			<artifactId>spring-doc-resources</artifactId>
			<version>0.1.1.RELEASE</version>
			<type>zip</type>
			<optional>true</optional>
		</dependency>
	</dependencies>
	<profiles>
		<profile>
			<id>full</id>
			<build>
				<plugins>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-dependency-plugin</artifactId>
						<executions>
							<execution>
							<id>unpack-doc-resources</id>
							<goals>
								<goal>unpack-dependencies</goal>
							</goals>
							<phase>generate-resources</phase>
							<configuration>
								<includeGroupIds>io.spring.docresources</includeGroupIds>
								<includeArtifactIds>spring-doc-resources</includeArtifactIds>
								<includeTypes>zip</includeTypes>
								<excludeTransitive>true</excludeTransitive>
								<outputDirectory>${project.build.directory}/refdocs/</outputDirectory>
							</configuration>
						</execution>
					</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-resources-plugin</artifactId>
						<executions>
							<execution>
								<id>copy-asciidoc-resources</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>copy-resources</goal>
								</goals>
								<configuration>
									<outputDirectory>${project.build.directory}/refdocs/</outputDirectory>
									<resources>
										<resource>
											<directory>src/main/asciidoc</directory>
											<filtering>false</filtering>
										</resource>
									</resources>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctor-maven-plugin</artifactId>
						<version>${asciidoctor.maven.plugin.version}</version>
						<dependencies>
							<dependency>
								<groupId>org.asciidoctor</groupId>
								<artifactId>asciidoctorj-pdf</artifactId>
								<version>${asciidoctorj.pdf.version}</version>
							</dependency>
						</dependencies>
						<configuration>
							<sourceDirectory>${project.build.directory}/refdocs/</sourceDirectory>
							<sourceDocumentName>index.adoc</sourceDocumentName>
						</configuration>
						<executions>
							<execution>
								<id>generate-html</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<backend>html5</backend>
									<sourceHighlighter>highlight.js</sourceHighlighter>
									<attributes>
										<toc>left</toc>
										<toc-levels>4</toc-levels>
										<sectanchors>true</sectanchors>
										<sectnums />
										<docinfo>shared</docinfo>
										<stylesdir>css/</stylesdir>
										<stylesheet>spring.css</stylesheet>
										<linkcss>true</linkcss>
										<icons>font</icons>
										<highlightjsdir>js/highlight</highlightjsdir>
										<highlightjs-theme>atom-one-dark-reasonable</highlightjs-theme>
									</attributes>
								</configuration>
							</execution>
							<execution>
								<id>generate-pdf</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<backend>pdf</backend>
									<sourceHighlighter>coderay</sourceHighlighter>
									<attributes>
										<icons>font</icons>
										<pagenums />
										<sectnums />
										<toc />
									</attributes>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<dependencies>
							<dependency>
								<groupId>ant-contrib</groupId>
								<artifactId>ant-contrib</artifactId>
								<version>1.0b3</version>
								<exclusions>
									<exclusion>
										<groupId>ant</groupId>
										<artifactId>ant</artifactId>
									</exclusion>
								</exclusions>
							</dependency>
							<dependency>
								<groupId>org.apache.ant</groupId>
								<artifactId>ant-nodeps</artifactId>
								<version>1.8.1</version>
							</dependency>
							<dependency>
								<groupId>org.tigris.antelope</groupId>
								<artifactId>antelopetasks</artifactId>
								<version>3.2.10</version>
							</dependency>
						</dependencies>
						<executions>
							<execution>
								<id>package-and-attach-docs-zip</id>
								<phase>package</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<target>
										<zip destfile="${project.build.directory}/${project.artifactId}-${project.version}.zip">
											<zipfileset dir="${project.build.directory}/generated-docs" prefix="reference" />
											<zipfileset dir="../target/site/apidocs" prefix="apidocs" />
										</zip>
									</target>
								</configuration>
							</execution>
							<execution>
								<id>setup-maven-properties</id>
								<phase>validate</phase>
								<goals>
									<goal>run</goal>
								</goals>
								<configuration>
									<exportAntProperties>true</exportAntProperties>
									<target>
										<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
										<taskdef name="stringutil" classname="ise.antelope.tasks.StringUtilTask" />
										<var name="version-type" value="${project.version}" />
										<propertyregex property="version-type" override="true" input="${version-type}" regexp=".*\.(.*)" replace="\1" />
										<propertyregex property="version-type" override="true" input="${version-type}" regexp="(M)\d+" replace="MILESTONE" />
										<propertyregex property="version-type" override="true" input="${version-type}" regexp="(RC)\d+" replace="MILESTONE" />
										<propertyregex property="version-type" override="true" input="${version-type}" regexp="BUILD-(.*)" replace="SNAPSHOT" />
										<stringutil string="${version-type}" property="spring-boot-repo">
											<lowercase />
										</stringutil>
										<var name="github-tag" value="v${project.version}" />
										<propertyregex property="github-tag" override="true" input="${github-tag}" regexp=".*SNAPSHOT" replace="master" />
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<executions>
							<execution>
								<id>attach-zip</id>
								<goals>
									<goal>attach-artifact</goal>
								</goals>
								<configuration>
									<artifacts>
										<artifact>
											<file>
												${project.build.directory}/${project.artifactId}-${project.version}.zip
											</file>
											<type>zip;zip.type=docs;zip.deployed=false
											</type>
										</artifact>
									</artifacts>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
	</profiles>
</project>
