Skip to content

Commit

Permalink
Fixes #177
Browse files Browse the repository at this point in the history
* First step : making sure the plugin definition is common, yet easily modifiable
* Use modern version of maven plugin for all artifacts
* Don't forget to validate adaptation of architecture-documentation 🚨
* Find a smart way to handle project issues url
  • Loading branch information
Riduidel authored Jun 8, 2022
1 parent fb08a5d commit be30cee
Show file tree
Hide file tree
Showing 15 changed files with 532 additions and 914 deletions.
11 changes: 0 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,6 @@ jobs:
with:
distribution: adopt
java-version: 11
- name: Pimp some maven "features"
uses: s4u/maven-settings-action@v2.4.1
with:
mirrors: |
[{
"id": "rubygems-releases-http-unblocker",
"name": "rubygems-releases",
"mirrorOf": "rubygems-releases",
"url": "http://rubygems-proxy.torquebox.org/releases",
"blocked": false
}]
- name: Build with Maven
run: mvn -B install --file pom.xml -Dagile.architecture.github.token=$TOKEN_FOR_GITHUB --settings .mvn/custom-settings.xml
env:
Expand Down
1 change: 1 addition & 0 deletions aadarchi-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
<artifactId>maven-invoker-plugin</artifactId>
<version>1.10</version>
<configuration>
<debug>true</debug>
<scriptVariables>
<pluginVersion>${project.version}</pluginVersion>
</scriptVariables>
Expand Down
25 changes: 0 additions & 25 deletions aadarchi-maven-plugin/src/it/2_generate_html_docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,15 @@
<name>Agile Architecture Documentation System : System documentation generator</name>
<description>Using agile architecture documentation system to document agile archiecture documentation system</description>
<properties>
<kroki.server.url>https://kroki.io</kroki.server.url>
<version.java>11</version.java>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<asciidoctor.highlighter>highlightjs</asciidoctor.highlighter>
<asciidoc.source.docs.directory>src/docs/asciidoc</asciidoc.source.docs.directory>
<asciidoc.source.slides.directory>src/slides/asciidoc</asciidoc.source.slides.directory>
<asciidoc.target.base.directory>${project.build.directory}/asciidoc</asciidoc.target.base.directory>
<asciidoc.target.docs.directory>${asciidoc.target.base.directory}/docs</asciidoc.target.docs.directory>
<asciidoc.target.slides.directory>${asciidoc.target.base.directory}/slides</asciidoc.target.slides.directory>
<agile.architecture.main.class>org.ndx.agile.architecture.base.ArchitectureDocumentationBuilder</agile.architecture.main.class>
<agile.architecture.output.dir>${project.build.directory}/structurizr</agile.architecture.output.dir>
<agile.architecture.output.diagrams>${agile.architecture.output.dir}/diagrams</agile.architecture.output.diagrams>
<agile.architecture.output.enhancements>${agile.architecture.output.dir}/enhancements</agile.architecture.output.enhancements>

<!-- tag::issues-url[] -->
<!-- TODO set a valid value to have doc improvement enabled -->
<issues.url>https://github.com/Riduidel/agile-architecture-documentation-system/issues</issues.url>
<!-- end::issues-url[] -->

<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctor-maven-plugin -->
<version.asciidoctor.maven.plugin>2.1.0</version.asciidoctor.maven.plugin>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-pdf -->
<version.asciidoctorj.pdf>1.5.4</version.asciidoctorj.pdf>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj -->
<version.asciidoctorj>2.4.3</version.asciidoctorj>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-revealjs -->
<version.asciidoctor.revealjs>4.1.0</version.asciidoctor.revealjs>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-diagram -->
<version.asciidoctor.kroki>0.5.0</version.asciidoctor.kroki>
<!-- See latest version here https://mvnrepository.com/artifact/org.jruby/jruby -->
<version.jruby>9.2.9.0</version.jruby>
<!-- See latest version here: https://github.com/hakimel/reveal.js/releases -->
<version.revealjs>3.9.2</version.revealjs>
</properties>

<issueManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert new File(basedir, "target/docs/html/index.html").exists()
assert new File(basedir, "target/asciidoc/docs/html/index.html").exists()
26 changes: 0 additions & 26 deletions aadarchi-maven-plugin/src/it/3_generate_pdf_docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,14 @@
<name>Agile Architecture Documentation System : System documentation generator</name>
<description>Using agile architecture documentation system to document agile archiecture documentation system</description>
<properties>
<kroki.server.url>https://kroki.io</kroki.server.url>
<version.java>11</version.java>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<asciidoctor.highlighter>highlightjs</asciidoctor.highlighter>
<asciidoc.source.docs.directory>src/docs/asciidoc</asciidoc.source.docs.directory>
<asciidoc.source.slides.directory>src/slides/asciidoc</asciidoc.source.slides.directory>
<asciidoc.target.base.directory>${project.build.directory}/asciidoc</asciidoc.target.base.directory>
<asciidoc.target.docs.directory>${asciidoc.target.base.directory}/docs</asciidoc.target.docs.directory>
<asciidoc.target.slides.directory>${asciidoc.target.base.directory}/slides</asciidoc.target.slides.directory>
<agile.architecture.main.class>org.ndx.agile.architecture.base.ArchitectureDocumentationBuilder</agile.architecture.main.class>
<agile.architecture.output.dir>${project.build.directory}/structurizr</agile.architecture.output.dir>
<agile.architecture.output.diagrams>${agile.architecture.output.dir}/diagrams</agile.architecture.output.diagrams>
<agile.architecture.output.enhancements>${agile.architecture.output.dir}/enhancements</agile.architecture.output.enhancements>

<!-- tag::issues-url[] -->
<!-- TODO set a valid value to have doc improvement enabled -->
<issues.url>https://github.com/Riduidel/agile-architecture-documentation-system/issues</issues.url>
<!-- end::issues-url[] -->

<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctor-maven-plugin -->
<version.asciidoctor.maven.plugin>2.1.0</version.asciidoctor.maven.plugin>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-pdf -->
<version.asciidoctorj.pdf>1.5.4</version.asciidoctorj.pdf>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj -->
<version.asciidoctorj>2.4.3</version.asciidoctorj>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-revealjs -->
<version.asciidoctor.revealjs>4.1.0</version.asciidoctor.revealjs>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-diagram -->
<version.asciidoctor.kroki>0.5.0</version.asciidoctor.kroki>
<!-- See latest version here https://mvnrepository.com/artifact/org.jruby/jruby -->
<version.jruby>9.2.9.0</version.jruby>
<!-- See latest version here: https://github.com/hakimel/reveal.js/releases -->
<version.revealjs>3.9.2</version.revealjs>
</properties>

<issueManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert new File(basedir, "target/docs/pdf/index.pdf").exists()
assert new File(basedir, "target/asciidoc/docs/pdf/index.pdf").exists()
25 changes: 0 additions & 25 deletions aadarchi-maven-plugin/src/it/4_generate_html_slides/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,40 +10,15 @@
<name>Agile Architecture Documentation System : System documentation generator</name>
<description>Using agile architecture documentation system to document agile archiecture documentation system</description>
<properties>
<kroki.server.url>https://kroki.io</kroki.server.url>
<version.java>11</version.java>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<asciidoctor.highlighter>highlightjs</asciidoctor.highlighter>
<asciidoc.source.docs.directory>src/docs/asciidoc</asciidoc.source.docs.directory>
<asciidoc.source.slides.directory>src/slides/asciidoc</asciidoc.source.slides.directory>
<asciidoc.target.base.directory>${project.build.directory}/asciidoc</asciidoc.target.base.directory>
<asciidoc.target.docs.directory>${asciidoc.target.base.directory}/docs</asciidoc.target.docs.directory>
<asciidoc.target.slides.directory>${asciidoc.target.base.directory}/slides</asciidoc.target.slides.directory>
<agile.architecture.main.class>org.ndx.agile.architecture.base.ArchitectureDocumentationBuilder</agile.architecture.main.class>
<agile.architecture.output.dir>${project.build.directory}/structurizr</agile.architecture.output.dir>
<agile.architecture.output.diagrams>${agile.architecture.output.dir}/diagrams</agile.architecture.output.diagrams>
<agile.architecture.output.enhancements>${agile.architecture.output.dir}/enhancements</agile.architecture.output.enhancements>

<!-- tag::issues-url[] -->
<!-- TODO set a valid value to have doc improvement enabled -->
<issues.url>https://github.com/Riduidel/agile-architecture-documentation-system/issues</issues.url>
<!-- end::issues-url[] -->

<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctor-maven-plugin -->
<version.asciidoctor.maven.plugin>2.1.0</version.asciidoctor.maven.plugin>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-pdf -->
<version.asciidoctorj.pdf>1.5.4</version.asciidoctorj.pdf>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj -->
<version.asciidoctorj>2.4.3</version.asciidoctorj>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-revealjs -->
<version.asciidoctor.revealjs>5.0.0.rc1</version.asciidoctor.revealjs>
<!-- See latest version here: https://mvnrepository.com/artifact/org.asciidoctor/asciidoctorj-diagram -->
<version.asciidoctor.kroki>0.5.0</version.asciidoctor.kroki>
<!-- See latest version here https://mvnrepository.com/artifact/org.jruby/jruby -->
<version.jruby>9.2.9.0</version.jruby>
<!-- See latest version here: https://github.com/hakimel/reveal.js/releases -->
<version.revealjs>4.3.1</version.revealjs>
</properties>

<issueManagement>
Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1 @@
assert new File(basedir, "target/asciidoc/slides/test.html").exists()
assert new File(basedir, "target/asciidoc/slides/html/test.html").exists()
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,37 @@

import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.plugins.annotations.ResolutionScope;
import org.ndx.agile.architecture.base.ArchitectureDocumentationBuilder;
import org.ndx.agile.architecture.base.ArchitectureModelProvider;
import org.ndx.agile.architecture.documentation.system.maven.cdi.helper.wrappers.AbstractCDIStarterMojo;
import org.ndx.agile.architecture.documentation.system.maven.cdi.helper.wrappers.MojoProduces;

/**
* Generates the various model diagrams and elements by processing the architecture description
* made either in a workspace.dsl file or through an {@link ArchitectureModelProvider} implementing class.
*
* In fact, this mojo "simply" starts a CDI container in which the
* {@link ArchitectureDocumentationBuilder} class is invoked with all available
* elements of classpath loaded.
*
* Notice that there are many more options than the parameter given below.
*
* @author nicolas-delsaux
*
*/
@Mojo(name = "generate-model",
defaultPhase = LifecyclePhase.PREPARE_PACKAGE,
requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class GenerateDiagramsMojo extends AbstractCDIStarterMojo {

/**
* Output directory for the generated diagrams
*/
@MojoProduces
@Parameter(name="agile-architecture-output-diagrams", defaultValue = "${project.build.directory}/structurizr/diagrams", property="agile.architecture.output.diagrams")
public String agileArchitectureOutputDiagrams;

@Override
protected Class<? extends Runnable> getCDIEnabledRunnableClass() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,96 +1,62 @@
package org.ndx.agile.architecture.documentation.system.maven.plugin;

import org.apache.maven.execution.MavenSession;
import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.BuildPluginManager;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
import org.apache.maven.plugins.annotations.Component;
import static org.twdata.maven.mojoexecutor.MojoExecutor.element;
import static org.twdata.maven.mojoexecutor.MojoExecutor.name;

import java.io.File;
import java.util.List;

import org.apache.maven.model.Dependency;
import org.apache.maven.plugins.annotations.LifecyclePhase;
import org.apache.maven.plugins.annotations.Mojo;
import org.apache.maven.plugins.annotations.Parameter;
import org.apache.maven.project.MavenProject;

import static org.twdata.maven.mojoexecutor.MojoExecutor.*;

import org.ndx.agile.architecture.documentation.system.maven.plugin.asciidoctor.AbstractAsciidoctorCallingMojo;
import org.twdata.maven.mojoexecutor.MojoExecutor;
import org.twdata.maven.mojoexecutor.MojoExecutor.Element;

/**
* Generates html version of the documents stored in source folder.
*
* This mojo is a specific invocation of asciidoctor-maven-plugin with a "correct" set
* of parameters for our use case
*
* @author nicolas-delsaux
*
*/
@Mojo(name = "generate-html-docs", defaultPhase = LifecyclePhase.PREPARE_PACKAGE)
public class GenerateHtmlDocs extends AbstractMojo {
@Component
private MavenProject mavenProject;

@Component
private MavenSession mavenSession;

@Component
private BuildPluginManager pluginManager;

@Parameter(name = "asciidoctor-maven-plugin-version", defaultValue = "2.1.0")
private String asciidoctorMavenPluginVersion;

@Parameter(name = "asciidoctorj-pdf-version", defaultValue = "1.5.4")
private String asciidoctorjPdfVersion;

@Parameter(name = "jruby-version", defaultValue = "9.2.9.0")
private String jrubyVersion;

@Parameter(name = "asciidoctorj-version", defaultValue = "2.4.3")
private String asciidoctorjVersion;

@Parameter(name = "kroki-server-url", defaultValue = "${kroki.server.url}")
private String krokiServerUrl;

public class GenerateHtmlDocs extends AbstractAsciidoctorCallingMojo {
/**
* Input folder where asciidoc files are stored.
*/
@Parameter(name="html-docs-source-dir", defaultValue="${project.basedir}/src/docs/asciidoc", property = "asciidoc.source.docs.directory")
private File htmlDocsSourceDir;
/**
* Output folder where html docs are produced
*/
@Parameter(name="html-docs-output-dir", defaultValue="${project.build.directory}/asciidoc/docs/html", property = "asciidoc.target.html.docs.directory")
private File htmlDocsOutputDir;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
executeMojo(
plugin(
groupId("org.asciidoctor"),
artifactId("asciidoctor-maven-plugin"),
version(asciidoctorMavenPluginVersion),
dependencies(
dependency("org.asciidoctor", "asciidoctorj-pdf", asciidoctorjPdfVersion),
dependency("org.jruby", "jruby-complete", jrubyVersion),
dependency("org.asciidoctor", "asciidoctorj", asciidoctorjVersion)
)
),
goal("process-asciidoc"),
configuration(
// TODO conditionalize that invocation : add all gems dependencies here
element(name("requires"),
element(name("require"), "asciidoctor-kroki")),
element(name("gemPath"), "${project.build.directory}/gems"),
element(name("attributes"),
element(name("allow-uri-read")), // allow to include distant content in the created document
element(name("kroki-server-url"), krokiServerUrl),
protected List<Dependency> dependencies() {
return MojoExecutor.dependencies(
dependencyJRuby(),
dependencyAsciidoctor()
);
}

element(name("structurizrdir"), "${agile.architecture.output.diagrams}"),
element(name("imagesdir"), "./images"),
element(name("toc"), "left"), // put the table of content on the left side of the window
element(name("icons"), "font"), // allow to use icons from "fonticones"
element(name("sectanchors"), "true"), // sections behave like anchors/links to move around the document
element(name("idseparator"), "-"), // put a separator between identifiers pieces
element(name("hideBugReport"), "${asciidoc.documents.hide.bug.report}"), // add link to allow users to report some bugs
@Override
protected String getSourceDirectory() {
return htmlDocsSourceDir.getAbsolutePath();
}

element(name("sectnums"), "true"), // display section number in the summary
element(name("revnumber"), "${project.version}"), // add project version in the footer
element(name("revdate"), "${maven.build.timestamp}"), // add the date in the footer
@Override
protected String getOutputDirectory() {
return htmlDocsOutputDir.getAbsolutePath();
}

element(name("project-group-id"), "${project.groupId}"), // catch the groupId defined in the pom.xml file
element(name("project-artifact-id"), "${project.artifactId}"), // catch the artifactId defined in the pom.xml file
element(name("project-name"), "${project.name}"), // catch the project name defined in the pom.xml file
element(name("project-version"), "${project.version}"), // catch the project version defined in the pom.xml file
element(name("project-build-timestamp"), "${maven.build.timestamp}"), // catch the timestamp defined when maven build
element(name("project-pom-path"), "../../../pom.xml"), // catch pom.xml file path
element(name("project-issues-on-github"), "${issues.url}"), // catch the issue url defined in the pom.xml file
element(name("organization"), "${project.organization.name}"), // catch the organization name defined in the pom.xml file
element(name("enhancements-dir"), "${agile.architecture.output.enhancements}") // catch the path to the enhancements directory defined in the pom.xml file
),
element(name("outputDirectory"), "${project.build.directory}/docs/html") // define the path where the html files will get created
),
executionEnvironment(
mavenProject,
mavenSession,
pluginManager
)
);
@Override
protected Element configurationBackend() {
return element(name("backend"), "html5");
}

}
Loading

0 comments on commit be30cee

Please sign in to comment.