Un-ignore .bat files
[cabal.git] / cabal-testsuite / PackageTests / SetupHooks / SetupHooksMissingRuleDep / SetupHooks.hs
blob1f1adcf7ab1ca3f59fc248c78328910a649f54c3
1 {-# LANGUAGE DuplicateRecordFields #-}
2 {-# LANGUAGE OverloadedStrings #-}
3 {-# LANGUAGE StaticPointers #-}
5 module SetupHooks where
7 import Distribution.Simple.LocalBuildInfo (interpretSymbolicPathLBI)
8 import Distribution.Simple.SetupHooks
9 import Distribution.Utils.Path (sameDirectory, makeRelativePathEx)
11 import qualified Data.List.NonEmpty as NE ( NonEmpty(..) )
13 setupHooks :: SetupHooks
14 setupHooks =
15 noSetupHooks
16 { buildHooks =
17 noBuildHooks
18 { preBuildComponentRules = Just $ rules (static ()) missingDepRules
22 missingDepRules :: PreBuildComponentInputs -> RulesM ()
23 missingDepRules (PreBuildComponentInputs { localBuildInfo = lbi, targetInfo = tgt }) = do
24 let clbi = targetCLBI tgt
25 autogenDir = autogenComponentModulesDir lbi clbi
26 action = mkCommand (static Dict) (static (\ _ -> error "This should not run")) ()
27 registerRule_ "r" $
28 staticRule action
29 [ FileDependency $ Location sameDirectory (makeRelativePathEx "Missing.hs") ]
30 ( Location autogenDir (makeRelativePathEx "G.hs") NE.:| [] )