sbt / sbt-dependency-graph

sbt plugin to create a dependency graph for your project
Apache License 2.0
1.24k stars 113 forks source link

Support for flat-file output (like CSV) #69

Open joescii opened 9 years ago

joescii commented 9 years ago

Firstly, thanks for providing this excellent plugin for the community! My team uses it regularly to comply with our legal department's policy to keep a record of all OSS libraries used in production. It would be much more conducive to our use case if we could output this into a flat comma-delimited format. I plan to write this myself soon, but I would like to contribute to this project if you feel it fits appropriately.

The biggest problem we have is the ability to perform a diff on the output over time. The dependency-tree's order gets a little shuffled when dependencies change. What I would rather is a csv file that is either sorted, or could easily be sorted to provide a consistent order. Furthermore, the document we record our dependencies itself is a spreadsheet, so a CSV file is rather appropriate.

What do you think? Something valuable for sbt-dependency-graph? Or is this readily achievable in one of the other formats?

Thanks for your time, Joe

hochgi commented 9 years ago

@joescii if I understand you correctly, you don't need this (excelent) plugin. e.g. use fullClasspath. a hacky solution to what you want can be:

sbt "show fullClasspath" | sed s/List\(Attributed\(/\\n/g | sed s/\)\)//g | sed s/\),\ Attributed\(/\\n/g | sed '/\[[.]*/d' | sort

(I'm not that good with sed, perhaps someone better can write it more concise)

a better way would be to write a custom task to do that.

joescii commented 9 years ago

@hochgi I didn't know about that key. I'll write my own tiny plugin for doing that. Thanks for the tip!

hochgi commented 9 years ago

np. also, if you realy want just the 3rd party dependencies, you can use dependencyClasspath instead of fullClasspath

jrudolph commented 9 years ago

I find this feature useful, however, I won't have time to work on this right now. The advantage of implementing it here would be that you also have access to all the data in the pom, so you could include license or homepage data in the output.

hochgi commented 9 years ago

@jrudolph take a look at @ashwanthkumar fork. I think he already did that: https://github.com/ashwanthkumar/sbt-dependency-graph

joescii commented 9 years ago

Thanks @jrudolph. No need to worry about spending your time. This is something our team needs to do in the next week or so. I'm just looking for a good home for our work.

@hochgi I took a quick glance at @ashwanthkumar's fork, and it looks promising. Thanks!