[commit: ghc] wip/nfs-locking: Move Package to the library (14aec31)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:56:32 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/14aec31f12e398f7cab12e23c95c8eda1d8c9f4a/ghc

>---------------------------------------------------------------

commit 14aec31f12e398f7cab12e23c95c8eda1d8c9f4a
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Aug 18 00:56:33 2017 +0100

    Move Package to the library
    
    See #347


>---------------------------------------------------------------

14aec31f12e398f7cab12e23c95c8eda1d8c9f4a
 hadrian.cabal                        |  2 +-
 src/Base.hs                          |  4 ++--
 src/{ => Hadrian/Haskell}/Package.hs | 23 ++++++++++++++---------
 3 files changed, 17 insertions(+), 12 deletions(-)

diff --git a/hadrian.cabal b/hadrian.cabal
index 7c45af6..93e4707 100644
--- a/hadrian.cabal
+++ b/hadrian.cabal
@@ -28,6 +28,7 @@ executable hadrian
                        , GHC
                        , Hadrian.Expression
                        , Hadrian.Haskell.Cabal
+                       , Hadrian.Haskell.Package
                        , Hadrian.Oracles.ArgsHash
                        , Hadrian.Oracles.DirectoryContents
                        , Hadrian.Oracles.FileCache
@@ -39,7 +40,6 @@ executable hadrian
                        , Oracles.Setting
                        , Oracles.ModuleFiles
                        , Oracles.PackageData
-                       , Package
                        , Rules
                        , Rules.Clean
                        , Rules.Compile
diff --git a/src/Base.hs b/src/Base.hs
index 8c81706..310d7c4 100644
--- a/src/Base.hs
+++ b/src/Base.hs
@@ -15,7 +15,7 @@ module Base (
 
     -- * Basic data types
     module Builder,
-    module Package,
+    module Hadrian.Haskell.Package,
     module Stage,
     module Way,
 
@@ -37,9 +37,9 @@ import Development.Shake.Classes
 import Development.Shake.FilePath
 import Development.Shake.Util
 import Hadrian.Utilities
+import Hadrian.Haskell.Package
 
 import Builder
-import Package
 import Stage
 import Way
 
diff --git a/src/Package.hs b/src/Hadrian/Haskell/Package.hs
similarity index 79%
rename from src/Package.hs
rename to src/Hadrian/Haskell/Package.hs
index 93e8ee0..d7dd3df 100644
--- a/src/Package.hs
+++ b/src/Hadrian/Haskell/Package.hs
@@ -1,4 +1,4 @@
-module Package (
+module Hadrian.Haskell.Package (
     Package (..), PackageName (..), PackageType (..),
     -- * Queries
     pkgNameString, pkgCabalFile,
@@ -12,20 +12,25 @@ import Development.Shake.FilePath
 import GHC.Generics
 import Hadrian.Utilities
 
--- | The name of a Cabal package.
+-- | The name of a Haskell package.
 newtype PackageName = PackageName { fromPackageName :: String }
     deriving (Binary, Eq, Generic, Hashable, IsString, NFData, Ord, Typeable)
 
 -- TODO: Make PackageType more precise, #12.
--- | We regard packages as either being libraries or programs. This is bit of a
--- convenient lie as Cabal packages can be both, but it works for now.
+-- | We regard packages as either being libraries or programs. This is a bit of
+-- a convenient lie as Haskell packages can be both, but it works for now.
 data PackageType = Library | Program deriving Generic
 
-data Package = Package
-    { pkgName :: PackageName -- ^ Examples: "ghc", "Cabal".
-    , pkgPath :: FilePath    -- ^ pkgPath is the path to the source code relative
-                             -- to the root, e.g. "compiler", "libraries/Cabal/Cabal".
-    , pkgType :: PackageType -- ^ A library or a program.
+-- | A Haskell package.
+data Package = Package {
+    -- | The name of a Haskell package. Examples: @Cabal@, @ghc-bin at .
+    pkgName :: PackageName,
+    -- | The path to the package source code relative to the root of the build
+    -- system. For example, @libraries/Cabal/Cabal@ and @ghc@ are paths to the
+    -- @Cabal@ and @ghc-bin@ packages in GHC.
+    pkgPath :: FilePath,
+    -- | A library (e.g. @Cabal@) or a program (e.g. @ghc-bin@).
+    pkgType :: PackageType
     } deriving Generic
 
 -- TODO: Get rid of non-derived Show instances.



More information about the ghc-commits mailing list