Skip to content

Commit 232cb3c

Browse files
committed
GH-476 - Move off legacy Structurizr PlantUML generation.
1 parent c06a2c9 commit 232cb3c

File tree

2 files changed

+22
-24
lines changed

2 files changed

+22
-24
lines changed

spring-modulith-docs/pom.xml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,6 @@
2929
<version>1.29.0</version>
3030
</dependency>
3131

32-
<dependency>
33-
<groupId>com.structurizr</groupId>
34-
<artifactId>structurizr-plantuml</artifactId>
35-
<version>1.6.3</version>
36-
</dependency>
37-
3832
<dependency>
3933
<groupId>com.structurizr</groupId>
4034
<artifactId>structurizr-export</artifactId>

spring-modulith-docs/src/main/java/org/springframework/modulith/docs/Documenter.java

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.io.File;
2121
import java.io.FileWriter;
2222
import java.io.IOException;
23-
import java.io.StringWriter;
2423
import java.io.Writer;
2524
import java.lang.annotation.Annotation;
2625
import java.nio.file.Files;
@@ -50,10 +49,9 @@
5049
import org.springframework.util.MultiValueMap;
5150

5251
import com.structurizr.Workspace;
53-
import com.structurizr.export.Diagram;
52+
import com.structurizr.export.IndentingWriter;
5453
import com.structurizr.export.plantuml.C4PlantUMLExporter;
55-
import com.structurizr.io.plantuml.BasicPlantUMLWriter;
56-
import com.structurizr.io.plantuml.PlantUMLWriter;
54+
import com.structurizr.export.plantuml.StructurizrPlantUMLExporter;
5755
import com.structurizr.model.Component;
5856
import com.structurizr.model.Container;
5957
import com.structurizr.model.Element;
@@ -487,26 +485,18 @@ private String render(ComponentView view, DiagramOptions options) {
487485

488486
case C4:
489487

490-
C4PlantUMLExporter exporter = new C4PlantUMLExporter();
491-
Diagram diagram = exporter.export(view);
488+
var c4PlantUmlExporter = new C4PlantUMLExporter();
489+
var diagram = c4PlantUmlExporter.export(view);
490+
492491
return diagram.getDefinition();
493492

494493
case UML:
495494
default:
496495

497-
Writer writer = new StringWriter();
498-
PlantUMLWriter umlWriter = new BasicPlantUMLWriter() {
499-
500-
@Override
501-
protected void writeContainerForContainer(ComponentView view, Writer writer,
502-
BiConsumer<ComponentView, Writer> packageContentWriter) throws IOException {
503-
packageContentWriter.accept(view, writer);
504-
}
505-
};
506-
umlWriter.addSkinParam("componentStyle", "uml1");
507-
umlWriter.write(view, writer);
496+
var plantUmlExporter = new CustomizedPlantUmlExporter();
497+
plantUmlExporter.addSkinParam("componentStyle", "uml1");
508498

509-
return writer.toString();
499+
return plantUmlExporter.export(view).getDefinition();
510500
}
511501
}
512502

@@ -1173,4 +1163,18 @@ boolean hasOnlyFallbackGroup() {
11731163
}
11741164
}
11751165
}
1166+
1167+
private static class CustomizedPlantUmlExporter extends StructurizrPlantUMLExporter {
1168+
1169+
@Override
1170+
protected boolean includeTitle(ModelView view) {
1171+
return false;
1172+
};
1173+
1174+
@Override
1175+
protected void startContainerBoundary(ModelView view, Container container, IndentingWriter writer) {}
1176+
1177+
@Override
1178+
protected void endContainerBoundary(ModelView view, IndentingWriter writer) {};
1179+
};
11761180
}

0 commit comments

Comments
 (0)