From b625705eb7e9f56e7b005cc4d5b3f50ffa7bd548 Mon Sep 17 00:00:00 2001
From: Maxim Thomas <maxim.thomas@gmail.com>
Date: Fri, 28 Jun 2024 07:54:30 +0000
Subject: [PATCH] compress webhelp, xhtml and html docs after build (#348)

---
 opendj-doc-generated-ref/src/main/ant/zip.xml |   21 +++++++++++++++++++++
 opendj-doc-generated-ref/pom.xml              |   34 ++++++++++++++++++++++++++++++++++
 pom.xml                                       |    1 +
 3 files changed, 56 insertions(+), 0 deletions(-)

diff --git a/opendj-doc-generated-ref/pom.xml b/opendj-doc-generated-ref/pom.xml
index e82530c..bd95d4e 100644
--- a/opendj-doc-generated-ref/pom.xml
+++ b/opendj-doc-generated-ref/pom.xml
@@ -611,6 +611,40 @@
                             </formats>
                         </configuration>
                     </plugin>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-antrun-plugin</artifactId>
+                        <executions>
+                            <execution>
+                                <id>zip-docs</id>
+                                <phase>package</phase>
+                                <configuration>
+                                    <target>
+                                        <property name="compress_formats" value="webhelp,xhtml,html"/>
+                                        <ant antfile="${basedir}/src/main/ant/zip.xml">
+                                            <target name="docs"/>
+                                        </ant>>
+                                    </target>
+                                </configuration>
+                                <goals>
+                                    <goal>run</goal>
+                                </goals>
+                            </execution>
+                        </executions>
+                        <dependencies>
+                            <dependency>
+                                <groupId>ant-contrib</groupId>
+                                <artifactId>ant-contrib</artifactId>
+                                <version>${ant.contrib.version}</version>
+                                <exclusions>
+                                    <exclusion>
+                                        <groupId>ant</groupId>
+                                        <artifactId>ant</artifactId>
+                                    </exclusion>
+                                </exclusions>
+                            </dependency>
+                        </dependencies>
+                    </plugin>
 
                     <!-- Generate Artifacts -->
                     <plugin>
diff --git a/opendj-doc-generated-ref/src/main/ant/zip.xml b/opendj-doc-generated-ref/src/main/ant/zip.xml
new file mode 100644
index 0000000..e9b9af4
--- /dev/null
+++ b/opendj-doc-generated-ref/src/main/ant/zip.xml
@@ -0,0 +1,21 @@
+<project name="zip">
+    <target name="docs">
+        <taskdef resource="net/sf/antcontrib/antcontrib.properties"/>
+        <foreach param="docname" target="formats" inheritall="true">
+            <path>
+                <dirset dir="${basedir}/src/main/docbkx/" casesensitive="yes">
+                    <include name="*/"/>
+                    <exclude name="*/*/**"/>
+                </dirset>
+            </path>
+            <mapper type="flatten"/>
+        </foreach>
+    </target>
+    <target name="formats">
+        <foreach param="format" list="${compress_formats}" target="dozip" inheritall="true"/>
+    </target>
+    <target name="dozip" >
+        <echo message="compressing ${format} ${docname} from ${project_build_dir}/docbkx/${format}/${docname} to ${project_build_dir}/docbkx/${format}/${docname}.zip"/>
+        <zip basedir="${project.build.directory}/docbkx/${format}/${docname}" destfile="${project.build.directory}/docbkx/${format}/${docname}.zip"/>
+    </target>
+</project>
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 24f11e2..59c5fe8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -55,6 +55,7 @@
         <!--  ForgeRock build tools and Checkstyle versions (to avoid many checkstyle errors with ForgeRock Parent 2.0.10) -->
         <checkstylePluginVersion>2.9.1</checkstylePluginVersion>
         <checkstyleVersion>5.5</checkstyleVersion>
+        <ant.contrib.version>1.0b3</ant.contrib.version>
         <argLine>-Xmx512m</argLine>
     </properties>
 

--
Gitblit v1.10.0