给定这样的目录结构:
.
├── frontend
│ ├── _build/ -- build dir, all files produced by shake, except for Frontend.elm, go here
│ ├── Build.hs -- the build script
│ ├── build.sh -- wrap Build.hs with `stack exec build -- $@`
│ ├── other files ...
│ ├── Frontend.elm -- generated by a rule in Build.hs, `protoc -I../proto --elm_out=. ../proto/frontend.proto`
│ ├── Index.elm -- hand written source file
│ └── other elms ... -- hand written source files
└── proto
└── frontend.proto -- protocol buffer message defination, hand written
目标_build/index.js
取决于所有.elm
文件,包括Frontend.elm
,但如果我盲目地这样做,Frontend.elm
则由 中的规则生成:Build.hs
want ["_build/index.js"]
"_build/index.js" %> \out -> do
elms <- filter (not . elmStuff)
<$> (liftIO $ getDirectoryFilesIO "" ["//*.elm"])
need elms
blah blah
want ["Frontend.elm"]
"Frontend.elm" %> \_out -> do
cmd ["protoc", "blah", "blah"]
build.sh clean
会给我:
Lint checking error - value has changed since being depended upon:
Key: Frontend.elm
Old: File {mod=0x608CAAF7,size=0x53D,digest=NEQ}
New: File {mod=0x608CAB5B,size=0x53D,digest=NEQ}
有没有办法告诉shake注意动态生成的Frontend.elm
,也许先构建它,这样它在构建的其余部分就不会改变,我试过了priority 100 ("Frontend.elm" %> ...)
,不起作用。