Skip to content

Commit

Permalink
Feature: graphviz no longer required (#592)
Browse files Browse the repository at this point in the history
* Remove graphviz requirement from readme.

Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>

* Remove all references to graphviz from codebase.

Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>

* Bump minor version due to important feature.

Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>

---------

Signed-off-by: Sjoerd Talsma <sjoerdtalsma@users.noreply.github.com>
  • Loading branch information
sjoerdtalsma committed Jul 1, 2024
1 parent 4c56ff0 commit 44a1e7d
Show file tree
Hide file tree
Showing 7 changed files with 20 additions and 25 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ jobs:
env:
GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }}
GPG_OWNERTRUST: ${{ secrets.GPG_OWNERTRUST }}
- name: Setup Graphviz
run: sudo apt-get install graphviz
- name: Set up JDK 17
id: setup-java-17
uses: actions/setup-java@v3
Expand Down
7 changes: 4 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<!-- Artifact identification -->
<groupId>nl.talsmasoftware</groupId>
<artifactId>umldoclet</artifactId>
<version>2.1.3-SNAPSHOT</version>
<version>2.2.0-SNAPSHOT</version>
<packaging>jar</packaging>

<!-- Project information -->
Expand Down Expand Up @@ -248,8 +248,9 @@
<version>${project.version}</version>
</docletArtifact>
<additionalOptions>
<additionalOption>-createPumlFiles</additionalOption>
<additionalOption>-failOnCyclicPackageDependencies true</additionalOption>
<additionalOption>--create-puml-files</additionalOption>
<additionalOption>--fail-on-cyclic-package-dependencies true</additionalOption>
<!--<additionalOption>&#45;&#45;uml-custom-directive "skinparam handwritten true"</additionalOption>-->
</additionalOptions>
</configuration>
</execution>
Expand Down
3 changes: 0 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ To use the UML Doclet, the following is required.
For versions of javadoc from earlier JDKs, please use the [latest `1.x` UML Doclet version][v1.x].
If you compile your java 8 or older javadocs with a more recent JDK (Javadoc version 9 or higher),
you need to use the 2.x version.
- An installed version of [graphviz](http://plantuml.com/graphviz-dot),
at least until [pure java visualization](https://github.com/talsma-ict/umldoclet/issues/51) works.
Graphviz needs to be compiled with [libexpat][libexpat] support.
- The UML Doclet, the [usage page][usage] shows how.
An apache-licensed version of [PlantUML][plantuml] is already included in the umldoclet jar.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 Talsma ICT
* Copyright 2016-2024 Talsma ICT
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -154,8 +154,8 @@ public interface Configuration {
* Custom directives to include in rendered PlantUML diagram sources.
* <p>
* Custom directives are rendered as-is at the top of each PlantUML diagram.
* For example, to use jdot for rendering,
* use the {@code "!pragma graphviz_dot jdot"} custom directive.
* For example, to render handwritten diagrams,
* use the {@code "skinparam handwritten true"} custom directive.
*
* @return Any custom PlantUML directives.
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2022 Talsma ICT
* Copyright 2016-2024 Talsma ICT
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -41,7 +41,7 @@ public static void prepareJavadocWithPumlFiles() {
"-d", outputDir.getPath(),
"-doclet", UMLDoclet.class.getName(),
"-quiet", "--create-puml-files",
"--uml-custom-directive", "!pragma graphviz_dot jdot",
"--uml-custom-directive", "skinparam handwritten true",
"src/test/java/" + classAsPath + ".java"
);
classUml = TestUtil.read(new File(outputDir, classAsPath + ".puml"));
Expand All @@ -50,18 +50,18 @@ public static void prepareJavadocWithPumlFiles() {
}

@Test
public void testPragmaInClassDiagram() {
assertThat(classUml, containsString("!pragma graphviz_dot jdot"));
public void testCustomDirectiveInClassDiagram() {
assertThat(classUml, containsString("skinparam handwritten true"));
}

@Test
public void testPragmaInPackageDiagram() {
assertThat(packageUml, containsString("!pragma graphviz_dot jdot"));
public void testCustomDirectiveInPackageDiagram() {
assertThat(packageUml, containsString("skinparam handwritten true"));
}

@Test
public void testPragmaInPackageDependenciesDiagram() {
assertThat(packageDependenciesUml, containsString("!pragma graphviz_dot jdot"));
public void testCustomDirectiveInPackageDependenciesDiagram() {
assertThat(packageDependenciesUml, containsString("skinparam handwritten true"));
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
import static nl.talsmasoftware.umldoclet.configuration.ImageConfig.Format.PNG;
import static nl.talsmasoftware.umldoclet.configuration.ImageConfig.Format.SVG;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.hasItem;
import static org.hamcrest.Matchers.hasToString;
Expand Down Expand Up @@ -112,7 +111,7 @@ public void testDiagramToStringMultipleFormats() {
@Test
public void testCustomDirective() {
// prepare
when(config.customPlantumlDirectives()).thenReturn(singletonList("!pragma graphviz_dot jdot"));
when(config.customPlantumlDirectives()).thenReturn(singletonList("skinparam handwritten true"));
StringWriter output = new StringWriter();
Diagram testDiagram = new TestDiagram(config, new File("target/test-classes/custom-directive.puml"));
IndentingPrintWriter writer = IndentingPrintWriter.wrap(output, Indentation.NONE);
Expand All @@ -122,7 +121,7 @@ public void testCustomDirective() {
testDiagram.writeTo(writer);

// verify
assertThat(asList(output.toString().split("\\n")), hasItem("!pragma graphviz_dot jdot"));
assertThat(asList(output.toString().split("\\n")), hasItem("skinparam handwritten true"));
verify(config).customPlantumlDirectives();
}

Expand Down
6 changes: 3 additions & 3 deletions usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ The rest of this section lists various options that are specific to the UML docl
#### -plantumlServerUrl &lt;url&gt;

Base URL for the PlantUML server.
Bypass the built-in internal PlantUML version that requires graphviz to be installed,
but use a running plantuml-server instead to generate UML diagrams.
Bypass the built-in internal PlantUML version and
use a remote plantuml-server instead to generate UML diagrams.

You can run a plantuml-server using docker:
You can locally run a plantuml-server using docker:

```shell
docker run -d -p 8080:8080 plantuml/plantuml-server:latest
Expand Down

0 comments on commit 44a1e7d

Please sign in to comment.