Why doesn't `shake` executable work with Shakefiles?

58 views
Skip to first unread message

Luke Hoersten

unread,
Mar 23, 2015, 2:03:24 PM3/23/15
to shake-bui...@googlegroups.com
Is there a reason running "$ shake" in my project directory with a "Shakefile" doesn't work? Looks like the `shake` executable uses this main: https://github.com/ndmitchell/shake/blob/master/src/Run.hs

I think it'd be nice to be able to use shake out of the box without having to make a `shake` bash script wrap `runhaskell Shakefile $0` for every project.

Luke

Neil Mitchell

unread,
Mar 23, 2015, 3:37:03 PM3/23/15
to Luke Hoersten, shake-bui...@googlegroups.com
Hi Luke,

I guess the biggest reason is the lack of an obvious semantics. I guess it should look for Shakefile.hs or Shakefile.lhs? And then should it run runhaskell or ghc --make? If it runs --make where should it put the objects? Should it use ghc-make library to make the build go faster? What about libraries to pass etc?

One thought is that we could always runhaskell unless there was a .shake/shake binary in which case it could run that. Then we can put the rebuild logic in the Shake library if we want. 

I always do something very custom so have no idea what "normal" looks like. If we figure it out, I'm happy to support it as standard. 

Thanks, Neil 

Luke Hoersten

unread,
Mar 23, 2015, 3:51:07 PM3/23/15
to Neil Mitchell, shake-bui...@googlegroups.com
I was thinking it would look for ["Shakefile", "Shakefile.hs", "Shakefile.lhs"] and then just "runhaskell". I think anything beyond that is more advanced and considered an optimization. The idea here would be to reduce the barrier of entry for newcomers who are used to make.

I like your idea about looking for the .shake/shake binary as well which is even more encompassing.

So for even my more advanced builds I still just use the bash script with "runhaskell Shakefile $0". The compilation of my shake file is such a small small piece of the total build duration.

What do you think?
Luke

Neil Mitchell

unread,
Mar 23, 2015, 4:11:06 PM3/23/15
to Luke Hoersten, shake-bui...@googlegroups.com
Seems reasonable. I'm not sure I like the idea of an unadorned
Shakefile though, since if Shake every gets it own simplified syntax
(possible but not certain, maybe not even likely) then it starts to
become ambiguous. How about, Shake does (in order of preference)
.shake/shake[.exe], runhaskell Shakefile.hs, runhaskell Shakefile.lhs?

One of my build scripts takes > 5 mins to compile, so there something
like runhaskell isn't feasible - but I agree making simple scripts
simple is a good plan.

Thanks, Neil

Luke Hoersten

unread,
Mar 23, 2015, 4:13:21 PM3/23/15
to Neil Mitchell, shake-bui...@googlegroups.com
Sounds good. I only went with the extension less name because I thought I saw it recommended somewhere. I agree the extension is better. Thanks for taking the suggestion! I'm excited to delete my bash scripts.

Neil Mitchell

unread,
Mar 23, 2015, 4:27:59 PM3/23/15
to Luke Hoersten, shake-bui...@googlegroups.com
I raised a ticket to track the implementation:
https://github.com/ndmitchell/shake/issues/219

Neil Mitchell

unread,
Mar 26, 2015, 9:16:23 AM3/26/15
to Luke Hoersten, shake-bui...@googlegroups.com
As of the 0.15 release, Shake now does work with Shakefile.hs and Shakefile.lhs.

Thanks, Neil

Luke Hoersten

unread,
Mar 26, 2015, 9:40:08 AM3/26/15
to Neil Mitchell, shake-bui...@googlegroups.com
I can confirm it's working well. Thank you for adding this!
Reply all
Reply to author
Forward
0 new messages