From c992db275494b05627248cd741adac5d7c199603 Mon Sep 17 00:00:00 2001 From: Yuuta Liang Date: Tue, 28 Nov 2023 21:00:25 -0800 Subject: Add UML generator Signed-off-by: Yuuta Liang --- build.gradle | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'build.gradle') diff --git a/build.gradle b/build.gradle index 60876c8..1d42616 100644 --- a/build.gradle +++ b/build.gradle @@ -75,3 +75,34 @@ tasks.withType(Checkstyle) { configFile file('checkstyle.xml') } } + +tasks.register('uml') { + doFirst { + renderUML("all") + renderUML("type") + renderUML("assoc") + } + + dependsOn project(':umlgen').build +} + +ext.renderUML = { scope -> + def output = new ByteArrayOutputStream() + javaexec { + classpath = project(':umlgen').sourceSets.main.runtimeClasspath + mainClass = 'moe.yuuta.umlgen.Main' + standardOutput = output + args "${sourceSets.main.java.srcDirs[1]}", scope + } + def dot = output.toByteArray() + out.close() + def input = new ByteArrayInputStream(dot) + output = new FileOutputStream("${rootDir}/arts/uml.${scope}.pdf") + exec { + commandLine 'dot', '-Tpdf' + standardInput = input + standardOutput = output + } + input.close() + output.close() +} \ No newline at end of file -- cgit v1.2.3