File tree Expand file tree Collapse file tree 2 files changed +8
-10
lines changed
Cabal/src/Distribution/Simple Expand file tree Collapse file tree 2 files changed +8
-10
lines changed Original file line number Diff line number Diff line change @@ -74,17 +74,21 @@ withDynFLib flib =
74
74
ForeignLibTypeUnknown ->
75
75
cabalBug " unknown foreign lib type"
76
76
77
+ -- | Is the extension of the file in the list of extensions?
78
+ extensionIn :: [String ] -> FilePath -> Bool
79
+ extensionIn exts fp = takeExtension fp `elem` exts
80
+
77
81
-- | Is this file a C++ source file, i.e. ends with .cpp, .cxx, or .c++?
78
82
isCxx :: FilePath -> Bool
79
- isCxx fp = takeExtension fp `elem` [" .cpp" , " .cxx" , " .c++" ]
83
+ isCxx = extensionIn [" .cpp" , " .cxx" , " .c++" ]
80
84
81
85
-- | Is this a C source file, i.e. ends with .c?
82
86
isC :: FilePath -> Bool
83
- isC fp = takeExtension fp `elem` [" .c" ]
87
+ isC = extensionIn [" .c" ]
84
88
85
89
-- | FilePath has a Haskell extension: .hs or .lhs
86
90
isHaskell :: FilePath -> Bool
87
- isHaskell fp = takeExtension fp `elem` [" .hs" , " .lhs" ]
91
+ isHaskell = extensionIn [" .hs" , " .lhs" ]
88
92
89
93
-- | Returns True if the modification date of the given source file is newer than
90
94
-- the object file we last compiled for it, or if no object file exists yet.
Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ import Distribution.Simple.BuildPaths
62
62
import Distribution.Simple.Compiler
63
63
import Distribution.Simple.Errors
64
64
import Distribution.Simple.Flag
65
+ import Distribution.Simple.GHC.Build.Utils (isCxx , isHaskell )
65
66
import Distribution.Simple.GHC.EnvironmentParser
66
67
import Distribution.Simple.GHC.ImplInfo
67
68
import qualified Distribution.Simple.GHC.Internal as Internal
@@ -1242,13 +1243,6 @@ gbuildSources verbosity mbWorkDir pkgId specVer tmpDir bm =
1242
1243
, inputSourceModules = foreignLibModules flib
1243
1244
}
1244
1245
1245
- isCxx :: FilePath -> Bool
1246
- isCxx fp = takeExtension fp `elem` [" .cpp" , " .cxx" , " .c++" ]
1247
-
1248
- -- | FilePath has a Haskell extension: .hs or .lhs
1249
- isHaskell :: FilePath -> Bool
1250
- isHaskell fp = takeExtension fp `elem` [" .hs" , " .lhs" ]
1251
-
1252
1246
-- | Generic build function. See comment for 'GBuildMode'.
1253
1247
gbuild
1254
1248
:: Verbosity
You can’t perform that action at this time.
0 commit comments