Skip to content

Commit

Permalink
Merge pull request #4 from alpmestan/angerman/feature/reloc
Browse files Browse the repository at this point in the history
Types.X modules become X.Type
  • Loading branch information
angerman authored Feb 15, 2018
2 parents 674a286 + 025197c commit 40709cc
Show file tree
Hide file tree
Showing 45 changed files with 127 additions and 147 deletions.
16 changes: 8 additions & 8 deletions hadrian.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,11 @@ executable hadrian
, CommandLine
, Context
, Context.Paths
, Context.Type
, Environment
, Expression
, Expression.Type
, Flavour
, GHC
, GHC.Packages
, Hadrian.Builder
Expand All @@ -37,12 +40,15 @@ executable hadrian
, Hadrian.Builder.Types
, Hadrian.Expression
, Hadrian.Haskell.Cabal
, Hadrian.Haskell.Cabal.Configured
, Hadrian.Haskell.Cabal.Parse
, Hadrian.Haskell.Cabal.Type
, Hadrian.Oracles.ArgsHash
, Hadrian.Oracles.DirectoryContents
, Hadrian.Oracles.Path
, Hadrian.Oracles.TextFile
, Hadrian.Package
, Hadrian.Package.Type
, Hadrian.Target
, Hadrian.Utilities
, Oracles.Flag
Expand Down Expand Up @@ -95,18 +101,12 @@ executable hadrian
, Settings.Packages.Rts
, Settings.Warnings
, Stage
, Types.Context
, Types.Package
, Types.Stage
, Types.Cabal
, Types.ConfiguredCabal
, Types.Expression
, Types.Flavour
, Types.Way
, Stage.Type
, Target
, UserSettings
, Utilities
, Way
, Way.Type
if flag(llvmng)
other-modules: Settings.Flavours.QuickWithNG
, Settings.Flavours.QuickCrossNG
Expand Down
9 changes: 4 additions & 5 deletions src/Context.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ module Context (
pkgGhciLibraryFile, pkgConfFile, objectPath, pkgId
) where

import Hadrian.Expression
import Hadrian.Haskell.Cabal

import Types.Context
import Context.Paths

import Base
import Context.Paths
import Context.Type
import Hadrian.Expression
import Hadrian.Haskell.Cabal
import Oracles.Setting

-- | Most targets are built only one way, hence the notion of 'vanillaContext'.
Expand Down
3 changes: 1 addition & 2 deletions src/Context/Paths.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
module Context.Paths where

import Base

import Context.Type
import Hadrian.Expression
import Types.Context

-- | The directory to the current stage
stageDir :: Context -> FilePath
Expand Down
9 changes: 4 additions & 5 deletions src/Types/Context.hs → src/Context/Type.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
module Types.Context where
module Context.Type where

import Types.Stage
import Types.Package
import Way
import Hadrian.Package.Type
import Stage.Type
import Way.Type

import GHC.Generics
import Development.Shake.Classes
Expand All @@ -18,4 +18,3 @@ data Context = Context
instance Binary Context
instance Hashable Context
instance NFData Context

10 changes: 4 additions & 6 deletions src/Expression.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,13 @@ module Expression (
module Context,
) where

import Hadrian.Expression hiding (Expr, Predicate, Args)
import Types.ConfiguredCabal (ConfiguredCabal)
import Hadrian.Oracles.TextFile (readConfiguredCabalFile)

import Types.Expression

import Base
import {-# SOURCE #-} Builder
import Context hiding (stage, package, way)
import Expression.Type
import Hadrian.Expression hiding (Expr, Predicate, Args)
import Hadrian.Haskell.Cabal.Configured (ConfiguredCabal)
import Hadrian.Oracles.TextFile (readConfiguredCabalFile)

-- | Get values from a configured cabal stage.
getConfiguredCabalData :: (ConfiguredCabal -> a) -> Expr a
Expand Down
7 changes: 3 additions & 4 deletions src/Types/Expression.hs → src/Expression/Type.hs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Types.Expression where
module Expression.Type where

import Types.Context
import Types.Way
import Context.Type
import Way.Type

import {-# SOURCE #-} Builder
import qualified Hadrian.Expression as H
Expand All @@ -15,4 +15,3 @@ type Expr a = H.Expr Context Builder a
type Predicate = H.Predicate Context Builder
type Args = H.Args Context Builder
type Ways = Expr [Way]

8 changes: 4 additions & 4 deletions src/Types/Flavour.hs → src/Flavour.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Types.Flavour (Flavour (..)) where
module Flavour (Flavour (..)) where

import Types.Expression
import Types.Stage
import Types.Package
import Development.Shake
import Expression.Type
import Hadrian.Package.Type
import Stage.Type

-- Please update doc/{flavours.md, user-settings.md} when changing this file.
-- | 'Flavour' is a collection of build settings that fully define a GHC build.
Expand Down
4 changes: 2 additions & 2 deletions src/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ module GHC (

import Base
import Context
import Flavour (integerLibrary)
import GHC.Packages
import Oracles.Flag
import Oracles.Setting
import Types.Flavour (integerLibrary)
import Settings (flavour)
import GHC.Packages

-- | Packages that are built by default. You can change this in "UserSettings".
defaultPackages :: Stage -> Action [Package]
Expand Down
2 changes: 0 additions & 2 deletions src/GHC/Packages.hs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
{-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module GHC.Packages where

import Types.Package

import Hadrian.Package
import Hadrian.Utilities

Expand Down
6 changes: 3 additions & 3 deletions src/Hadrian/Haskell/Cabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ module Hadrian.Haskell.Cabal (
pkgVersion, pkgIdentifier, pkgDependencies, pkgSynopsis
) where

import Types.Context
import Types.Cabal as C
import Types.ConfiguredCabal as CC
import Development.Shake

import Context.Type
import Hadrian.Haskell.Cabal.Type as C
import Hadrian.Haskell.Cabal.Configured as CC
import Hadrian.Package
import Hadrian.Oracles.TextFile

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Types.ConfiguredCabal where
module Hadrian.Haskell.Cabal.Configured where

import Development.Shake.Classes
import Types.Package
import Hadrian.Package.Type
import GHC.Generics

data ConfiguredCabal = ConfiguredCabal
Expand Down
27 changes: 10 additions & 17 deletions src/Hadrian/Haskell/Cabal/Parse.hs
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,10 @@ module Hadrian.Haskell.Cabal.Parse ( ConfiguredCabal (..)

) where

import Types.Context
import {-# SOURCE #-} Builder hiding (Builder)
-- import Hadrian.Builder as H
import Data.List.Extra
import Data.Maybe (maybeToList, fromMaybe )
import Development.Shake hiding (doesFileExist)
import qualified Distribution.ModuleName as ModuleName
import qualified Distribution.Package as C
import qualified Distribution.PackageDescription as C
import qualified Distribution.PackageDescription.Parsec as C
Expand All @@ -48,26 +47,20 @@ import qualified Distribution.Types.LocalBuildInfo as C
import Distribution.Text (display)
import Distribution.Simple (defaultMainWithHooksNoReadArgs, compilerFlavor, CompilerFlavor( GHC ))
import Distribution.Simple.Compiler (compilerInfo)
import Hadrian.Package
import Hadrian.Utilities
import qualified Distribution.ModuleName as ModuleName
import Data.Maybe (maybeToList, fromMaybe )

import Base
import Builder hiding (Builder)
import Context
import Flavour (args)
import GHC.Packages (rts)
import Hadrian.Expression
import Hadrian.Haskell.Cabal.Type ( Cabal( Cabal ) )
import Hadrian.Haskell.Cabal.Configured
import Hadrian.Oracles.TextFile
import Hadrian.Target
import Types.Cabal ( Cabal( Cabal ) )
import Types.ConfiguredCabal
import Types.Flavour (args)

import Settings
import Oracles.Setting

import Context

import Hadrian.Oracles.TextFile

import Base

-- TODO: Use fine-grain tracking instead of tracking the whole Cabal file.
-- | Haskell package metadata extracted from a Cabal file.

Expand Down
6 changes: 3 additions & 3 deletions src/Hadrian/Haskell/Cabal/Parse.hs-boot
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Hadrian.Haskell.Cabal.Parse where

import Types.Context
import Types.Cabal (Cabal)
import Types.ConfiguredCabal (ConfiguredCabal)
import Context.Type
import Development.Shake
import Hadrian.Haskell.Cabal.Type (Cabal)
import Hadrian.Haskell.Cabal.Configured (ConfiguredCabal)

parseCabal :: Context -> Action Cabal
parseConfiguredCabal :: Context -> Action ConfiguredCabal
6 changes: 3 additions & 3 deletions src/Types/Cabal.hs → src/Hadrian/Haskell/Cabal/Type.hs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
module Types.Cabal where
module Hadrian.Haskell.Cabal.Type where

import Development.Shake.Classes
import Types.Package
import GHC.Generics
import Distribution.PackageDescription (GenericPackageDescription, PackageDescription)
import GHC.Generics
import Hadrian.Package.Type

data Cabal = Cabal
{ name :: PackageName
Expand Down
8 changes: 4 additions & 4 deletions src/Hadrian/Oracles/TextFile.hs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ module Hadrian.Oracles.TextFile (
readCabalFile, readConfiguredCabalFile, textFileOracle
) where

import Stage
import Types.Context
import Types.Cabal
import Types.ConfiguredCabal
import Context.Type
import Hadrian.Haskell.Cabal.Type
import Hadrian.Haskell.Cabal.Configured
import Hadrian.Package
import Stage

import Control.Monad
import qualified Data.HashMap.Strict as Map
Expand Down
3 changes: 1 addition & 2 deletions src/Hadrian/Package.hs
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,9 @@ module Hadrian.Package (
import Data.Maybe
import Development.Shake.FilePath
import GHC.Stack
import Hadrian.Package.Type
import Hadrian.Utilities

import Types.Package

-- | Construct a C library package.
cLibrary :: PackageName -> FilePath -> Package
cLibrary = Package C Library
Expand Down
2 changes: 1 addition & 1 deletion src/Types/Package.hs → src/Hadrian/Package/Type.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Types.Package where
module Hadrian.Package.Type where

import GHC.Generics
import Development.Shake.Classes
Expand Down
4 changes: 2 additions & 2 deletions src/Oracles/ModuleFiles.hs
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import qualified Data.HashMap.Strict as Map
import Base
import Builder
import Context
import GHC
import Expression
import Types.ConfiguredCabal as ConfCabal
import GHC
import Hadrian.Haskell.Cabal.Configured as ConfCabal

newtype ModuleFiles = ModuleFiles (Stage, Package)
deriving (Binary, Eq, Hashable, NFData, Show, Typeable)
Expand Down
5 changes: 3 additions & 2 deletions src/Rules/Documentation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,16 @@ module Rules.Documentation (
haddockDependencies
) where

import qualified Hadrian.Haskell.Cabal.Configured as ConfCabal

import Base
import Context
import Expression (getConfiguredCabalData, interpretInContext)
import Flavour
import GHC
import Oracles.ModuleFiles
import Settings
import Target
import qualified Types.ConfiguredCabal as ConfCabal
import Types.Flavour
import Utilities

-- | Build all documentation
Expand Down
6 changes: 3 additions & 3 deletions src/Rules/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ module Rules.Generate (

import Base
import Expression
import Types.Flavour
import Flavour
import GHC.Packages
import Oracles.Flag
import Oracles.ModuleFiles
import Oracles.Setting
import Rules.Gmp
import Rules.Libffi
import Target
import Settings
import Settings.Packages.Rts
import Target
import Utilities
import GHC.Packages

-- | Track this file to rebuild generated files whenever it changes.
trackGenerateHs :: Expr ()
Expand Down
9 changes: 5 additions & 4 deletions src/Rules/Library.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@ module Rules.Library (
) where

import Hadrian.Haskell.Cabal
import Types.ConfiguredCabal as ConfCabal
import qualified System.Directory as IO
import Hadrian.Haskell.Cabal.Configured as ConfCabal
import Hadrian.Haskell.Cabal.Parse (parseCabalPkgId)

import Base
import Context
import Expression hiding (way, package)
import Types.Flavour
import Flavour
import GHC.Packages
import Oracles.ModuleFiles
import Oracles.Setting
import Rules.Gmp
import Settings
import Target
import Utilities
import GHC.Packages

import qualified System.Directory as IO

archive :: Way -> String -> String
archive way pkgId = "libHS" ++ pkgId ++ (waySuffix way <.> "a")
Expand Down
Loading

0 comments on commit 40709cc

Please sign in to comment.