You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I think it would be better to generate UML files under a subfolder of the build/ directory rather than under src/main/java, considering these are generated artifacts and not source files.
I've added this code to my Gradle build script and it seems to be working:
/**
* Moves UML files generated by :plantuml to subdirectories of the build/ folder.
*/
project.tasks.plantuml.doLast {
def sourceBase = file(plantuml.sourcePath).absolutePath + File.separator
def buildBase = file("$buildDir/docs/uml").absolutePath + File.separator
def umlFileExtension = "$plantuml.fileFormat".toLowerCase()
/*
* Iterate for each file operated on by :plantuml.
*/
plantuml.sources.each { File sourceFile ->
def sourceFileBase = sourceFile.name.split("\\.")[0]
def fileDir = sourceFile.getParentFile()
/*
* Iterate for each file in the parent directory and move discovered UML files
* under build/.
*/
fileDir.eachFile (groovy.io.FileType.FILES) { File possibleUmlFile ->
if (possibleUmlFile.name.startsWith(sourceFileBase) && possibleUmlFile.name.endsWith(umlFileExtension)) {
def newUmlPath = file(buildBase + (possibleUmlFile.absolutePath - sourceBase))
newUmlPath.getParentFile().mkdirs()
possibleUmlFile.renameTo(newUmlPath)
}
}
}
}
The text was updated successfully, but these errors were encountered:
But your implementation assumes that every source file is under sourceBase, by default src/main/java. Furthermore, it also assumes that all files under sourceBase ending in png were generated by plantuml. I'd rather had something more in the gradle spirit (supporting source sets, in contrast to one specific dir)*.
By the way, how does it cope with javadoc generation? Are these pngs included in the generated javadoc?
* I have spent a few hours trying to implement this myself, but it's proving to require better gradle skills than those that I have at the moment.
I think it would be better to generate UML files under a subfolder of the
build/
directory rather than undersrc/main/java
, considering these are generated artifacts and not source files.I've added this code to my Gradle build script and it seems to be working:
The text was updated successfully, but these errors were encountered: