aboutsummaryrefslogtreecommitdiff
path: root/mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala
diff options
context:
space:
mode:
Diffstat (limited to 'mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala')
-rw-r--r--mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala16
1 files changed, 8 insertions, 8 deletions
diff --git a/mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala b/mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala
index 613538c..e1b044b 100644
--- a/mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala
+++ b/mavlink-plugin/src/main/scala/com/github/jodersky/mavlink/sbt/SbtMavlink.scala
@@ -38,20 +38,20 @@ object SbtMavlink extends AutoPlugin {
val dialectDefinition = XML.loadFile(dialectDefinitionFile)
val dialect = (new Parser(reporter)).parseDialect(dialectDefinition)
- val pathToSource = (new Generator(dialect)).generate()
+ val targets = (new Generator(dialect)).targets
val outDirectory = mavlinkTarget.value
- streams.value.log.info("Generating mavlink files...")
+ val files = for (tgt <- targets) yield {
+ val file = outDirectory / tgt.path
- val files = for ((path, source) <- pathToSource) yield {
- val file = outDirectory / path
- streams.value.log.info("Generating " + file)
- IO.write(file, source)
+ if (dialectDefinitionFile.lastModified > file.lastModified) {
+ streams.value.log.info("Generating mavlink binding " + file)
+ IO.write(file, tgt.generate())
+ }
file.getAbsoluteFile
}
-
- streams.value.log.info("Done generating mavlink files")
+
files
}