Skip to content

Commit

Permalink
The manual can now be generated via mvn: mvn clean install -Pmanual. …
Browse files Browse the repository at this point in the history
…Kudos to Jose Bolina
  • Loading branch information
belaban committed Apr 17, 2024
1 parent b527db9 commit 8805971
Show file tree
Hide file tree
Showing 6 changed files with 99 additions and 7 deletions.
6 changes: 3 additions & 3 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
<property name="keystore.dir" value="${root.dir}/keystore"/>
<property name="javadoc.packages" value="org.jgroups.*"/>
<property name="timestamp" value=".timestamp"/>
<property name="protocols.adoc" value="${manual.dir}/protocols.adoc"/>
<property name="installation.adoc" value="${manual.dir}/installation.adoc"/>
<property name="protocols.adoc" value="${manual.dir}/protocols-template.adoc"/>
<property name="installation.adoc" value="${manual.dir}/installation-template.adoc"/>
<property name="maven.executable" value="mvn"/>
<property name="asciidoc.executable" value="asciidoctor"/>
<!-- Also available: colony.css, github.css etc -->
Expand Down Expand Up @@ -411,7 +411,7 @@
</delete>
<delete>
<fileset dir="${manual.dir}" defaultexcludes="no">
<include name="*.adoc.tmp"/>
<include name="*-generated.adoc"/>
<include name="*.css"/>
</fileset>
</delete>
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions doc/manual/manual.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ Bela Ban, San Jose, Aug 2002, Kreuzlingen Switzerland 2019

include::./overview.adoc[Overview]

include::./installation.adoc.tmp[Installation]
include::./installation-generated.adoc[Installation]

include::./api.adoc[API]

include::./blocks.adoc[Building blocks]

include::./advanced.adoc[Advanced topics]

include::./protocols.adoc.tmp[Protocol list]
include::./protocols-generated.adoc[Protocol list]

File renamed without changes.
92 changes: 92 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -453,6 +453,19 @@
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.5.0</version>
</plugin>

<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>
<version>2.2.5</version>
<dependencies>
<dependency>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctorj-diagram</artifactId>
<version>2.2.14</version>
</dependency>
</dependencies>
</plugin>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
Expand Down Expand Up @@ -481,4 +494,83 @@
</plugins>
</pluginManagement>
</build>

<profiles>
<profile>
<!-- Profile to generate the manual. -->
<id>manual</id>
<properties>
<skipTests>true</skipTests>
</properties>
<build>
<plugins>
<!-- Generate the tables with the protocol properties. -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<executions>
<execution>
<id>generate-protocol-properties</id>
<phase>prepare-package</phase>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<arguments>
<argument>-classpath</argument>
<classpath/>
<argument>org.jgroups.util.PropertiesToAsciidoc</argument>
<argument>${basedir}/doc/manual/protocols-template.adoc</argument>
<argument>${basedir}/doc/manual/installation-template.adoc</argument>
</arguments>
</configuration>
</plugin>

<!-- Generates the manual files. -->
<!-- The generated output is in target/doc/manual/manual.html -->
<plugin>
<groupId>org.asciidoctor</groupId>
<artifactId>asciidoctor-maven-plugin</artifactId>

<configuration>
<sourceDirectory>${basedir}/doc/manual</sourceDirectory>
<requires>
<require>asciidoctor-diagram</require>
</requires>
</configuration>

<executions>
<execution>
<id>generate-manual</id>
<phase>prepare-package</phase>
<goals>
<goal>process-asciidoc</goal>
</goals>

<configuration>
<outputDirectory>${project.build.directory}/doc/manual</outputDirectory>
<attributes>
<revdate>${maven.build.timestamp}</revdate>
<organization>${project.organization.name}</organization>
<source-highlighter>rouge</source-highlighter>
<rouge-style>github</rouge-style>
<icons>font</icons>
<toclevels>3</toclevels>
<sectnums>true</sectnums>
<sectnumlevels>3</sectnumlevels>
<sectanchors>true</sectanchors>
</attributes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>


</project>
4 changes: 2 additions & 2 deletions src/org/jgroups/util/PropertiesToAsciidoc.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public static void main(String[] args) {
}
String prot_file = args[0];
String inst_file = args[1];
String temp_file = prot_file + ".tmp";
String temp_file2 = inst_file + ".tmp";
String temp_file = prot_file.replace("template", "generated");
String temp_file2 = inst_file.replace("template", "generated");

try {
// first copy protocols.adoc file into protocols.adoc.xml
Expand Down

0 comments on commit 8805971

Please sign in to comment.