Add automation for README.md generation at top level

Fixes #35
This commit is contained in:
Dave Syer
2024-10-22 09:25:41 +01:00
parent 3025853b31
commit 951dd83e51
4 changed files with 80 additions and 18 deletions

View File

@@ -101,6 +101,7 @@
<maven-source-plugin.version>3.3.0</maven-source-plugin.version>
<jacoco-maven-plugin.version>0.8.10</jacoco-maven-plugin.version>
<maven-deploy-plugin.version>3.1.1</maven-deploy-plugin.version>
<maven-resources-plugin.version>3.0.2</maven-resources-plugin.version>
<asciidoctor-maven-plugin.version>2.2.3</asciidoctor-maven-plugin.version>
<maven-assembly-plugin.version>3.7.0</maven-assembly-plugin.version>
<maven-dependency-plugin.version>3.5.0</maven-dependency-plugin.version>

3
spring-grpc-docs/Gemfile Normal file
View File

@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'asciidoctor-reducer'

View File

@@ -2,14 +2,7 @@
## README
The top level README is generated from sources in this module.
```
$ cd spring-grpc-docs
$ asciidoctor-reducer src/main/antora/modules/ROOT/pages/README.adoc | downdoc - > ../README.md
```
where [`asciidoctor-reducer`](https://github.com/asciidoctor/asciidoctor-reducer) is a gem (so probably in `~/.gem/ruby/<version>/bin/asciidoctor-reducer`) and [`downdoc`](https://github.com/opendevise/downdoc) is an `npm` module, so `./node_modules/.bin/downdoc`.
The top level README is generated from sources in this module on `mvn package` using [`asciidoctor-reducer`](https://github.com/asciidoctor/asciidoctor-reducer) and [`downdoc`](https://github.com/opendevise/downdoc).
## Configuration Properties
The Spring gRPC configuration properties are automatically documented as follows:

View File

@@ -13,9 +13,11 @@
<description>Spring gRPC documentation</description>
<properties>
<exec-maven-plugin.version>3.4.1</exec-maven-plugin.version>
<maven-exec-plugin.version>3.4.1</maven-exec-plugin.version>
<maven-gem-plugin.version>3.0.3</maven-gem-plugin.version>
<configprops.path>${project.basedir}/src/main/antora/modules/ROOT/partials/_configprops.adoc</configprops.path>
<configprops.inclusionPattern>spring.grpc.*</configprops.inclusionPattern>
<jruby.version>9.4.6.0</jruby.version>
</properties>
<!-- Dependencies used to build the config props doc generator -->
<dependencies>
@@ -29,8 +31,21 @@
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>rubygems</groupId>
<artifactId>asciidoctor-reducer</artifactId>
<version>1.0.6</version>
<type>gem</type>
</dependency>
</dependencies>
<build>
<extensions>
<extension>
<groupId>org.jruby.maven</groupId>
<artifactId>mavengem-wagon</artifactId>
<version>2.0.2</version>
</extension>
</extensions>
<plugins>
<plugin>
<groupId>io.spring.maven.antora</groupId>
@@ -55,6 +70,7 @@
<version>${io.spring.maven.antora-version}</version>
<executions>
<execution>
<?m2e ignore?>
<goals>
<goal>antora-component-version</goal>
</goals>
@@ -84,7 +100,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${exec-maven-plugin.version}</version>
<version>${maven-exec-plugin.version}</version>
<executions>
<execution>
<id>generate-configprops</id>
@@ -92,19 +108,68 @@
<goals>
<goal>java</goal>
</goals>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<mainClass>
org.springframework.grpc.internal.ConfigurationPropertiesAsciidocGenerator</mainClass>
<arguments>
<argument>${configprops.path}</argument>
<argument>${configprops.inclusionPattern}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>generate-readme</id>
<phase>package</phase>
<goals>
<goal>exec</goal>
</goals>
<configuration>
<executable>${basedir}/node_modules/.bin/downdoc</executable>
<arguments>
<argument>${project.build.directory}/README.adoc</argument>
<argument>-o</argument>
<argument>${project.parent.basedir}/README.md</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jruby.maven</groupId>
<artifactId>gem-maven-plugin</artifactId>
<version>${maven-gem-plugin.version}</version>
<configuration>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<mainClass>org.springframework.grpc.internal.ConfigurationPropertiesAsciidocGenerator</mainClass>
<arguments>
<argument>${configprops.path}</argument>
<argument>${configprops.inclusionPattern}</argument>
</arguments>
<jrubyVersion>${jruby.version}</jrubyVersion>
<gemHome>${project.build.directory}/gems</gemHome>
<gemPath>${project.build.directory}/gems</gemPath>
</configuration>
<executions>
<execution>
<?m2e ignore?>
<id>install-gems</id>
<goals>
<goal>initialize</goal>
<goal>exec</goal>
</goals>
<phase>compile</phase>
<configuration>
<execArgs>${project.build.directory}/gems/bin/asciidoctor-reducer -o
${project.build.directory}/README.adoc
${basedir}/src/main/antora/modules/ROOT/pages/README.adoc</execArgs>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<repositories>
<repository>
<id>mavengems</id>
<url>mavengem:https://rubygems.org</url>
</repository>
</repositories>
</project>