<?xml version="1.0" encoding="UTF-8"?>
<!--

    Copyright (c) 2012, 2021 Oracle and/or its affiliates. All rights reserved.

    This program and the accompanying materials are made available under the
    terms of the Eclipse Distribution License v. 1.0, which is available at
    http://www.eclipse.org/org/documents/edl-v10.php.

    SPDX-License-Identifier: BSD-3-Clause

-->

<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>com.sun.xml.ws</groupId>
        <artifactId>docs</artifactId>
        <version>2.3.5</version>
    </parent>

    <groupId>com.sun.xml.ws</groupId>
    <artifactId>release-documentation</artifactId>
    <version>2.3.5</version>

    <packaging>pom</packaging>
    <name>JAX-WS RI Release Documentation</name>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <configuration>
                    <outputDirectory>${project.build.directory}/docbook</outputDirectory>
                    <includeEmptyDirs>true</includeEmptyDirs>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <id>copy-common-resources</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/resources</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                    <execution>
                        <id>copy-docbook-resources</id>
                        <goals>
                            <goal>copy-resources</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>${project.basedir}/src/main/docbook</directory>
                                    <includes>
                                        <include>download/**</include>
                                        <include>figures/**</include>
                                        <include>icons/**</include>
                                        <include>style/**</include>
                                    </includes>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <!-- TODO: consider replacing me using resource filtering -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-antrun-plugin</artifactId>
                <executions>
                    <execution>
                        <id>process-entities</id>
                        <phase>package</phase>
                        <goals>
                            <goal>run</goal>
                        </goals>
                        <configuration>
                            <target>
                                <echo message="Preparing char entities" />
                                <mkdir dir="${src.dir}" />
                                <copy todir="${src.dir}">
                                    <fileset dir="src/main/docbook" includes="*.*" />
                                </copy>
                                <replace file="${src.dir}/docbook.ent" token="$version" value="${project.version}" />

                                <replace file="${src.dir}/docbook.ent" token="$release.spec.version" value="${jaxws-api.version}" />
                                <replace file="${src.dir}/docbook.ent" token="$release.impl.version" value="${project.version}" />

                                <mkdir dir="${src.dir}/icons/callouts" />
                                <copy todir="${src.dir}/icons/callouts">
                                    <fileset dir="src/main/docbook/icons/callouts" includes="*.*" />
                                </copy>
                            </target>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>com.agilejava.docbkx</groupId>
                <artifactId>docbkx-maven-plugin</artifactId>
                <version>2.0.11</version>
                <dependencies>
                    <dependency>
                        <groupId>net.sf.docbook</groupId>
                        <artifactId>docbook-xml</artifactId>
                        <version>5.0-all</version>
                        <type>zip</type>
                        <classifier>resources</classifier>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>net.sf.xslthl</groupId>
                        <artifactId>xslthl</artifactId>
                        <version>2.0.1</version>
                        <scope>runtime</scope>
                    </dependency>
                    <dependency>
                        <groupId>net.sf.offo</groupId>
                        <artifactId>fop-hyph</artifactId>
                        <version>1.2</version>
                        <scope>runtime</scope>
                    </dependency>
                </dependencies>
                <configuration>
                    <xincludeSupported>true</xincludeSupported>
                    <sourceDirectory>${src.dir}</sourceDirectory>
                    <targetDirectory>${project.build.directory}/docbook</targetDirectory>
                    <htmlStylesheet>style/documentation.css</htmlStylesheet>
                    <htmlCustomization>${basedir}/src/main/docbook/stylesheet/htmlCustomizations.xsl</htmlCustomization>
                    <foCustomization>${basedir}/src/main/docbook/stylesheet/foCustomizations.xsl</foCustomization>
                    <fop1Extensions>true</fop1Extensions>
                    <partAutolabel>true</partAutolabel>
                    <sectionAutolabel>true</sectionAutolabel>
                    <sectionLabelIncludesComponentLabel>true</sectionLabelIncludesComponentLabel>
                    <useExtensions>true</useExtensions>
                    <linenumberingExtension>true</linenumberingExtension>
                    <linenumberingEveryNth>1</linenumberingEveryNth>
                    <calloutsExtension>true</calloutsExtension>
                    <calloutGraphics>true</calloutGraphics>
                    <calloutGraphicsPath>icons/callouts/</calloutGraphicsPath>
                    <highlightSource>true</highlightSource>
                    <highlightDefaultLanguage>true</highlightDefaultLanguage>
                    <htmlLongdesc>false</htmlLongdesc>
                    <keepRelativeImageUris>true</keepRelativeImageUris>
                    <generateIdAttributes>true</generateIdAttributes>
                    <chapterAutolabel>0</chapterAutolabel>
                </configuration>
                <executions>
                    <execution>
                        <id>Single page HTML and PDF</id>
                        <goals>
                            <goal>generate-html</goal>
                            <goal>generate-pdf</goal>
                        </goals>
                        <configuration>
                            <includes>release-documentation.xml</includes>
                        </configuration>
                        <phase>package</phase>
                    </execution>
                    <execution>
                        <id>Multiple HTML pages</id>
                        <phase>package</phase>
                        <goals>
                            <goal>generate-html</goal>
                        </goals>
                        <configuration>
                            <includes>index.xml</includes>
                            <chunkedOutput>true</chunkedOutput>
                            <chunkSectionDepth>0</chunkSectionDepth>
                            <useIdAsFilename>false</useIdAsFilename>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptors>
                        <descriptor>src/main/assembly/docbook.xml</descriptor>
                    </descriptors>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

    <properties>
        <src.dir>${basedir}/target/gen-src</src.dir>
    </properties>

    <profiles>
        <profile>
            <id>release-docs</id>
            <properties>
                <remote.directory>${www.repository.url}/docs</remote.directory>
            </properties>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-antrun-plugin</artifactId>
                        <executions>
                            <execution>
                                <id>checkin-docbook</id>
                                <phase>install</phase>
                                <goals>
                                    <goal>run</goal>
                                </goals>
                                <configuration>
                                    <target>
                                        <property name="www.upload.dir" location="${project.build.directory}/www-stage"/>
                                        <mkdir dir="${www.upload.dir}"/>

                                        <copy todir="${www.upload.dir}">
                                            <fileset dir="${project.build.directory}/docbook">
                                                <exclude name="*.fo" />
                                            </fileset>
                                        </copy>

                                        <taskdef name="soimp" classname="com.sun.istack.soimp.Soimp" classpathref="maven.plugin.classpath" />

                                        <!-- update the latest docbook-version -->
                                        <soimp dir="${www.upload.dir}"
                                                repository="${remote.directory}"
                                                username="${userguide.scm.username}"
                                                password="${userguide.scm.password}"
                                                create="true"
                                                additionalOptions="--no-auth-cache"
                                                commitMessage="${project.artifactId}-${project.version}" />
                                    </target>
                                </configuration>
                            </execution>
                        </executions>
                    </plugin>
                </plugins>
            </build>
        </profile>
    </profiles>
</project>
