<?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>
	<artifactId>spring-cloud-dataflow-samples</artifactId>
	<groupId>org.springframework.cloud</groupId>
	<version>1.0.0.BUILD-SNAPSHOT</version>

	<description>Spring Cloud Data Flow Samples</description>
	<properties>
		<main.basedir>${basedir}/..</main.basedir>
		<spring-cloud-dataflow.version>2.0.0.RELEASE</spring-cloud-dataflow.version>
	</properties>

			<build>
				<plugins>

					<plugin>
						<groupId>org.asciidoctor</groupId>
						<artifactId>asciidoctor-maven-plugin</artifactId>
						<version>1.5.3</version>
						<dependencies>
							<dependency>
								<groupId>org.asciidoctor</groupId>
								<artifactId>asciidoctorj-pdf</artifactId>
								<version>1.5.0-alpha.11</version>
							</dependency>
						</dependencies>
						<configuration>
							<sourceDocumentName>index.adoc</sourceDocumentName>
							<doctype>book</doctype>
							<attributes>
								<allow-uri-read>true</allow-uri-read>
								<attribute-missing>warn</attribute-missing>
								<project-version>${project.version}</project-version>
								<project-artifactId>${project.artifactId}</project-artifactId>
								<version-type-lowercase>${version-type-lowercase}</version-type-lowercase>
								<dataflow-project-version>${spring-cloud-dataflow.version}</dataflow-project-version>
								<dataflow-version-type-lowercase>${dataflow-version-type-lowercase}</dataflow-version-type-lowercase>
								<dataflow-branch-or-tag>${dataflow-branch-or-tag}</dataflow-branch-or-tag>
								<dataflow-asciidoc>https://raw.githubusercontent.com/spring-cloud/spring-cloud-dataflow/${dataflow-branch-or-tag}/spring-cloud-dataflow-docs/src/main/asciidoc</dataflow-asciidoc>

								<!-- The following two are deps of this project and set automatically.-->
								<!-- Others are loose dependencies, and current-SNAPSHOT typically make sense-->
								<scdf-core-version>${org.springframework.cloud:spring-cloud-dataflow-core:jar.version}</scdf-core-version>
								<sct-core-version>${org.springframework.cloud:spring-cloud-task-core:jar.version}</sct-core-version>
								<scdt-core-version>current-SNAPSHOT</scdt-core-version>
								<scst-core-version>current-SNAPSHOT</scst-core-version>
								<scst-starters-core-version>current-SNAPSHOT</scst-starters-core-version>
								<sct-starters-core-version>current-SNAPSHOT</sct-starters-core-version>

							</attributes>
						</configuration>
						<executions>
							<execution>
								<id>generate-docbook</id>
								<phase>generate-resources</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<backend>docbook5</backend>
									<attributes>
										<docinfo>true</docinfo>
									</attributes>
								</configuration>
							</execution>
							<execution>
								<id>generate-html5</id>
								<phase>prepare-package</phase>
								<goals>
									<goal>process-asciidoc</goal>
								</goals>
								<configuration>
									<backend>html5</backend>
									<attributes>
										<toc2 />
									</attributes>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>com.agilejava.docbkx</groupId>
						<artifactId>docbkx-maven-plugin</artifactId>
						<version>2.0.15</version>
						<configuration>
							<sourceDirectory>${basedir}/target/generated-docs</sourceDirectory>
							<imgSrcPath />
							<graphicsize.extension>0</graphicsize.extension>
							<includes>index.xml</includes>
							<xincludeSupported>true</xincludeSupported>
							<chunkedOutput>false</chunkedOutput>
							<foCustomization>${basedir}/src/main/docbook/xsl/pdf.xsl</foCustomization>
							<useExtensions>1</useExtensions>
							<admonGraphics>1</admonGraphics>

							<highlightSource>1</highlightSource>
							<highlightXslthlConfig>${basedir}/src/main/docbook/xsl/xslthl-config.xml</highlightXslthlConfig>
							<preProcess>
								<copy todir="${basedir}/target/generated-docs/images">
									<fileset dir="${basedir}/src/main/docbook/images" />
								</copy>
							</preProcess>
						</configuration>
						<dependencies>
							<dependency>
								<groupId>net.sf.xslthl</groupId>
								<artifactId>xslthl</artifactId>
								<version>2.1.0</version>
							</dependency>
							<dependency>
								<groupId>net.sf.docbook</groupId>
								<artifactId>docbook-xml</artifactId>
								<version>5.0-all</version>
								<classifier>resources</classifier>
								<type>zip</type>
								<scope>runtime</scope>
							</dependency>
						</dependencies>
						<executions>
							<execution>
								<id>html</id>
								<goals>
									<goal>generate-html</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<htmlCustomization>${basedir}/src/main/docbook/xsl/html-multipage.xsl</htmlCustomization>
									<targetDirectory>${basedir}/target/docbook/html</targetDirectory>
									<chunkedOutput>true</chunkedOutput>
									<postProcess>
										<copy todir="${basedir}/target/contents/reference/html">
											<fileset dir="${basedir}/target/docbook/html">
												<include name="**/*.html" />
											</fileset>
										</copy>
										<copy todir="${basedir}/target/contents/reference/html/images">
											<fileset dir="${basedir}/target/generated-docs/images">
												<exclude name="PLACE_IMAGES_HERE" />
											</fileset>
										</copy>
										<copy todir="${basedir}/target/contents/reference/html/css">
											<fileset dir="${basedir}/src/main/docbook/css" />
										</copy>
									</postProcess>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>net.radai</groupId>
						<artifactId>grep-maven-plugin</artifactId>
						<version>1.0</version>
						<executions>
							<execution>
								<goals>
									<goal>grep</goal>
								</goals>
								<phase>test</phase>
								<configuration>
									<greps>
										<grep>
											<file>target/generated-docs/index.html</file>
											<grepPattern>Unresolved directive in .*\.adoc - include::</grepPattern>
											<failIfFound>true</failIfFound>
										</grep>
									</greps>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.apache.maven.plugins</groupId>
						<artifactId>maven-antrun-plugin</artifactId>
						<version>1.8</version>
						<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">

											<fileset dir="${project.build.directory}/contents" />
											<zipfileset dir="${project.build.directory}/generated-docs" prefix="reference/htmlsingle">
												<include name="index.html" />
												<include name="images/**" />
											</zipfileset>
										</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="version-type-lowercase">
											<lowercase />
										</stringutil>
									</target>
								</configuration>
							</execution>
						</executions>
					</plugin>
					<plugin>
						<groupId>org.codehaus.mojo</groupId>
						<artifactId>build-helper-maven-plugin</artifactId>
						<version>1.9.1</version>
						<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>
</project>
