-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated for ghc 8.4.2; released source code as a library
- Loading branch information
Showing
17 changed files
with
572 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,3 +10,4 @@ cabal-dev | |
cabal.sandbox.config | ||
cabal.config | ||
TAGS | ||
*.DS_Store |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,8 @@ | ||
{-# LANGUAGE CPP #-} | ||
#if !defined(MIN_VERSION_Cabal) | ||
# define MIN_VERSION_Cabal(a,b,c) 0 | ||
#endif | ||
|
||
{- | ||
Copyright (C) 2009 Ivan Lazar Miljenovic <[email protected]> | ||
|
@@ -27,14 +32,18 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
Used to parse and obtain information from the provided Cabal file. | ||
-} | ||
module CabalInfo(parseCabal) where | ||
module SourceGraph.CabalInfo(parseCabal) where | ||
|
||
import Distribution.Compiler (CompilerInfo) | ||
import Distribution.ModuleName (toFilePath) | ||
import Distribution.Package | ||
import Distribution.PackageDescription hiding (author) | ||
import Distribution.PackageDescription.Configuration | ||
#if MIN_VERSION_Cabal(2,0,0) | ||
import Distribution.PackageDescription.Parsec | ||
#else | ||
import Distribution.PackageDescription.Parse | ||
#endif | ||
import Distribution.Simple.Compiler (compilerInfo) | ||
import Distribution.Simple.GHC (configure) | ||
import Distribution.Simple.Program (defaultProgramConfiguration) | ||
|
@@ -49,6 +58,19 @@ import System.FilePath (dropExtension) | |
|
||
-- ----------------------------------------------------------------------------- | ||
|
||
emptyFlagAssignment :: FlagAssignment | ||
#if MIN_VERSION_Cabal(2,0,0) | ||
emptyFlagAssignment = mkFlagAssignment [] | ||
#else | ||
emptyFlagAssignment = [] | ||
#endif | ||
|
||
#if MIN_VERSION_Cabal(2,0,0) | ||
readDescription = readGenericPackageDescription | ||
#else | ||
readDescription = readPackageDescription | ||
#endif | ||
|
||
ghcID :: IO CompilerInfo | ||
ghcID = liftM (compilerInfo . getCompiler) | ||
$ configure silent Nothing Nothing defaultProgramConfiguration | ||
|
@@ -61,10 +83,10 @@ parseCabal fp = do cID <- ghcID | |
where | ||
-- Need to specify the Exception type | ||
getDesc :: FilePath -> IO (Either SomeException GenericPackageDescription) | ||
getDesc = try . readPackageDescription silent | ||
getDesc = try . readDescription silent | ||
parseDesc cID = fmap parse . compactEithers . fmap (unGeneric cID) | ||
unGeneric cID = fmap fst | ||
. finalizePackageDescription [] -- flags, use later | ||
. finalizePackageDescription emptyFlagAssignment -- flags, use later | ||
(const True) -- ignore | ||
-- deps | ||
buildPlatform | ||
|
@@ -73,7 +95,7 @@ parseCabal fp = do cID <- ghcID | |
parse pd = (nm, exps) | ||
where | ||
nm = pName . pkgName $ package pd | ||
pName (PackageName nm') = nm' | ||
pName nm' = unPackageName nm' | ||
exes = filter (buildable . buildInfo) $ executables pd | ||
lib = library pd | ||
moduleNames = map toFilePath | ||
|
Oops, something went wrong.