-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a gradle task to generate the UML images (#258)
* Add a gradle task to generate the UML images And generate existing UMLs * Update buildSrc/src/main/java/com/microsoft/hydralab/compile/UMLImageGenerator.java * Update agent/doc/UML/test_runner_design.puml * Comments resolved
- Loading branch information
Showing
16 changed files
with
75 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
@startuml new_design | ||
@startuml | ||
'https://plantuml.com/class-diagram | ||
|
||
class AgentManagementService { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
repositories { | ||
mavenLocal() | ||
mavenCentral() | ||
} | ||
|
||
dependencies { | ||
implementation gradleApi() | ||
implementation 'net.sourceforge.plantuml:plantuml:1.2021.9' | ||
testImplementation group: 'junit', name: 'junit', version: '4.12' | ||
} |
33 changes: 33 additions & 0 deletions
33
buildSrc/src/main/java/com/microsoft/hydralab/compile/UMLImageGenerator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
package com.microsoft.hydralab.compile; | ||
|
||
import net.sourceforge.plantuml.FileFormat; | ||
import net.sourceforge.plantuml.FileFormatOption; | ||
import net.sourceforge.plantuml.GeneratedImage; | ||
import net.sourceforge.plantuml.SourceFileReader; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
public class UMLImageGenerator { | ||
public void generateUMLImageFromFile(File source) throws IOException { | ||
generateUMLImageFromFile(source, source.getAbsoluteFile().getParentFile(), false); | ||
} | ||
|
||
public void generateUMLImageFromFile(File source, File outputDir) throws IOException { | ||
generateUMLImageFromFile(source, outputDir, false); | ||
} | ||
|
||
public void generateUMLImageFromFile(File source, File outputDir, boolean svg) throws IOException { | ||
if (!source.exists()) throw new RuntimeException(source.getAbsolutePath() + " file doesn't exist"); | ||
|
||
SourceFileReader reader = svg ? | ||
new SourceFileReader(source, outputDir, new FileFormatOption(FileFormat.SVG)) : | ||
new SourceFileReader(source, outputDir); | ||
|
||
List<GeneratedImage> list = reader.getGeneratedImages(); | ||
System.out.printf("Successfully generated %d UML images.\n", list.size()); | ||
} | ||
} |
9 changes: 9 additions & 0 deletions
9
buildSrc/src/test/java/com/microsoft/hydralab/compile/TestUMLGeneration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.microsoft.hydralab.compile; | ||
|
||
import org.junit.Test; | ||
|
||
public class TestUMLGeneration { | ||
@Test | ||
public void emptyTest() { | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.