Skip to content

Commit

Permalink
#24, ensure you create the output directories for the multiple file rule
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell committed Jun 29, 2013
1 parent 0b0cb88 commit 9514eea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.txt
@@ -1,5 +1,6 @@
Changelog for Shake

#24, create the output directories for the multiple file rule
Improvements to match Ninja behaviour
0.10.6
Include command/cmd in the default module
Expand Down
7 changes: 7 additions & 0 deletions Development/Shake/Files.hs
Expand Up @@ -6,7 +6,9 @@ module Development.Shake.Files(

import Control.Monad
import Control.Monad.IO.Class
import Data.List
import Data.Maybe
import System.Directory

import Development.Shake.Core
import Development.Shake.Types
Expand All @@ -15,6 +17,9 @@ import Development.Shake.File
import Development.Shake.FilePattern
import Development.Shake.FileTime

import System.FilePath(takeDirectory) -- important that this is the system local filepath, or wrong slashes go wrong


infix 1 ?>>, *>>


Expand Down Expand Up @@ -56,6 +61,7 @@ ps *>> act
return ()
rule $ \(FilesQ xs_) -> let xs = map unpack xs_ in
if not $ length xs == length ps && and (zipWith (?==) ps xs) then Nothing else Just $ do
liftIO $ mapM_ (createDirectoryIfMissing True) $ nub $ map takeDirectory xs
act xs
liftIO $ getFileTimes "*>>" xs_

Expand Down Expand Up @@ -92,6 +98,7 @@ ps *>> act
rule $ \(FilesQ xs_) -> let xs@(x:_) = map unpack xs_ in
case checkedTest x of
Just ys | ys == xs -> Just $ do
liftIO $ mapM_ (createDirectoryIfMissing True) $ nub $ map takeDirectory xs
act xs
liftIO $ getFileTimes "?>>" xs_
Just ys -> error $ "Error, ?>> is incompatible with " ++ show xs ++ " vs " ++ show ys
Expand Down

0 comments on commit 9514eea

Please sign in to comment.