源文件更改时摇不重建
Shake not rebuilding when source file changes
我正在使用 Shake 构建 lilypond 文件,然后将其放入网页中。我试图在 first example in the manual:
之后为我的 Build.hs
建模
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
dest = "www/static"
main :: IO ()
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
want ["www/index.html"]
phony "clean" $ do
putNormal "Cleaning files"
removeFilesAfter dest ["//*"]
"www/index.html" %> \out -> do
fs <- getDirectoryFiles "src/lilypond" ["*.ly"]
let pdfs = ["www/static" </> (takeBaseName sourceFile) -<.> "pdf" | sourceFile <- fs]
need pdfs
cmd_ "cp" "src/www/index.html" "www/index.html"
dest <> "//*.pdf" %> \outp -> do
let c = "src/lilypond" </> (dropDirectory1 . dropDirectory1 $ outp -<.> "ly")
let o = dropExtension outp
cmd_ "lilypond" "-o" [o] [c]
预期的行为是 "to build the index.html file, all PDFs should be generated to www/static
from respective src/lilypond/*.ly
files"。这适用于干净的构建,但编辑源 .ly
文件不会触发重建,我不明白为什么。 (更新:编辑 src/www/index.html
也不会触发重建)
我尝试过的事情:
- 通过
shake-build www/static/muppets.pdf
这样的命令构建单个 PDF。相同的行为。
- 正在生成
--profile
。这里没有什么让我跳出来的。
- 详细输出。不确定在这里寻找什么,所以怀疑 PDF 规则可能实际上并不依赖于
.ly
文件?在输出中看到 depends = []
,预计非空。
- PDF 规则中的显式
need [c]
。
我觉得我错过了一个基本概念:/
您在 cmd_ "lilypond" ...
之前错过了对 need [c]
的呼叫。这将导致它添加必要的依赖项 - 作为一般经验法则,在调用 cmd
之前,您对它将使用的所有东西调用 need
。
我正在使用 Shake 构建 lilypond 文件,然后将其放入网页中。我试图在 first example in the manual:
之后为我的Build.hs
建模
import Development.Shake
import Development.Shake.Command
import Development.Shake.FilePath
import Development.Shake.Util
dest = "www/static"
main :: IO ()
main = shakeArgs shakeOptions{shakeFiles="_build"} $ do
want ["www/index.html"]
phony "clean" $ do
putNormal "Cleaning files"
removeFilesAfter dest ["//*"]
"www/index.html" %> \out -> do
fs <- getDirectoryFiles "src/lilypond" ["*.ly"]
let pdfs = ["www/static" </> (takeBaseName sourceFile) -<.> "pdf" | sourceFile <- fs]
need pdfs
cmd_ "cp" "src/www/index.html" "www/index.html"
dest <> "//*.pdf" %> \outp -> do
let c = "src/lilypond" </> (dropDirectory1 . dropDirectory1 $ outp -<.> "ly")
let o = dropExtension outp
cmd_ "lilypond" "-o" [o] [c]
预期的行为是 "to build the index.html file, all PDFs should be generated to www/static
from respective src/lilypond/*.ly
files"。这适用于干净的构建,但编辑源 .ly
文件不会触发重建,我不明白为什么。 (更新:编辑 src/www/index.html
也不会触发重建)
我尝试过的事情:
- 通过
shake-build www/static/muppets.pdf
这样的命令构建单个 PDF。相同的行为。 - 正在生成
--profile
。这里没有什么让我跳出来的。 - 详细输出。不确定在这里寻找什么,所以怀疑 PDF 规则可能实际上并不依赖于
.ly
文件?在输出中看到depends = []
,预计非空。 - PDF 规则中的显式
need [c]
。
我觉得我错过了一个基本概念:/
您在 cmd_ "lilypond" ...
之前错过了对 need [c]
的呼叫。这将导致它添加必要的依赖项 - 作为一般经验法则,在调用 cmd
之前,您对它将使用的所有东西调用 need
。