Skip to content

Instantly share code, notes, and snippets.

@satyagraha
Created April 22, 2014 23:31
Show Gist options
  • Save satyagraha/11197929 to your computer and use it in GitHub Desktop.
Save satyagraha/11197929 to your computer and use it in GitHub Desktop.
Gradle-Graphml 1
task showConfigurationsGml << {
new File("graph/configurations.graphml").withWriter { out ->
builder = new groovy.xml.StreamingMarkupBuilder()
builder.encoding = 'UTF-8'
xml = builder.bind {
mkp.xmlDeclaration()
mkp.declareNamespace('': 'http://graphml.graphdrawing.org/xmlns')
mkp.declareNamespace('y': 'http://www.yworks.com/xml/graphml')
graphml(edgedefault: 'directed') {
key('for': 'node', id: 'd1', 'yfiles.type': 'nodegraphics')
configurations.all { con ->
node(id: con.name) {
// <data key="d1">
// <y:ShapeNode>
// <y:Shape type="rectangle"/> <!-- node shape -->
// <y:Geometry height="30.0" width="30.0" x="0.0" y="0.0"/> <!-- position and size -->
// <y:Fill color="#FFCC00" transparent="false"/> <!-- fill color -->
// <y:BorderStyle color="#000000" type="line" width="1.0"/> <!-- border -->
// <y:NodeLabel>Label Text</y:NodeLabel> <!-- label text -->
// </y:ShapeNode>
// </data>
data(key: "d1") {
y.ShapeNode { y.NodeLabel con.name }
}
}
con.extendsFrom.each { ext ->
edge(source: con.name, target: ext.name)
}
}
}
}
out.println(groovy.xml.XmlUtil.serialize(xml))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment