Archived
1
0

Adds conditional compilations, depending on when the source was last modified

This commit is contained in:
Jip J. Dekker 2016-03-20 23:39:55 +01:00
parent a808d57296
commit ad824be859

View File

@ -19,6 +19,7 @@ import (
"path/filepath"
log "github.com/Sirupsen/logrus"
"github.com/jjdekker/ponder/helpers"
"github.com/jjdekker/ponder/settings"
)
@ -35,14 +36,18 @@ func CompileDir(path string, opts *settings.Settings) {
PrepareLilypond(opts)
for _, score := range scores {
// TODO: compile only if there are changes
msg, err := Lilypond(score.Path)
if err != nil {
log.WithFields(log.Fields{
"message": msg,
"error": err,
"score": score,
}).Warning("score failed to compile")
output := outputPath(score.Path, opts)
if !helpers.Exists(output) ||
score.LastModified.After(helpers.LastModified(output)) {
msg, err := Lilypond(score.Path)
if err != nil {
log.WithFields(log.Fields{
"message": msg,
"error": err,
"score": score,
}).Warning("score failed to compile")
}
}
}
}