Skip to content
This repository has been archived by the owner on Aug 2, 2020. It is now read-only.

Fix warnings #547

Merged
merged 2 commits into from
Apr 3, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion src/CommandLine.hs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import Development.Shake hiding (Normal)
import Hadrian.Utilities hiding (buildRoot)
import System.Console.GetOpt
import System.Environment
import qualified UserSettings

-- | All arguments that can be passed to Hadrian via the command line.
data CommandLineArgs = CommandLineArgs
Expand Down
13 changes: 0 additions & 13 deletions src/GHC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -156,19 +156,6 @@ autogenPath context@Context {..}
where
autogen dir = contextPath context <&> (-/- dir -/- "autogen")

-- ref: mk/config.mk
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #549.

-- | Command line tool for stripping.
stripCmdPath :: Action FilePath
stripCmdPath = do
targetPlatform <- setting TargetPlatform
top <- topDirectory
case targetPlatform of
"x86_64-unknown-mingw32" ->
return (top -/- "inplace/mingw/bin/strip.exe")
"arm-unknown-linux" ->
return ":" -- HACK: from the make-based system, see the ref above
_ -> return "strip"

buildDll0 :: Context -> Action Bool
buildDll0 Context {..} = do
windows <- windowsHost
Expand Down
50 changes: 26 additions & 24 deletions src/Hadrian/Haskell/Cabal/Parse.hs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# OPTIONS_GHC -Wno-deprecations #-}
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #548.

-----------------------------------------------------------------------------
-- |
-- Module : Hadrian.Haskell.Cabal.Parse
Expand All @@ -16,29 +17,28 @@ module Hadrian.Haskell.Cabal.Parse

import Data.List.Extra
import Development.Shake
import qualified Distribution.ModuleName as ModuleName
import qualified Distribution.Package as C
import qualified Distribution.PackageDescription as C
import qualified Distribution.ModuleName as ModuleName
import qualified Distribution.Package as C
import qualified Distribution.PackageDescription as C
import qualified Distribution.PackageDescription.Configuration as C
import qualified Distribution.PackageDescription.Parsec as C
import qualified Distribution.Simple.Compiler as C (packageKeySupported, languageToFlags, extensionsToFlags, compilerInfo)
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.Program.Db as Db
import qualified Distribution.Simple as Hooks (simpleUserHooks, autoconfUserHooks, defaultMainWithHooksNoReadArgs, compilerFlavor, CompilerFlavor(GHC))
import qualified Distribution.Simple.UserHooks as Hooks
import qualified Distribution.Simple.Program.Builtin as C
import qualified Distribution.Simple.Utils as C (findHookedPackageDesc)
import qualified Distribution.Simple.Program.Types as C (programDefaultArgs, programOverrideArgs)
import qualified Distribution.Simple.Configure as C (getPersistBuildConfig)
import qualified Distribution.Simple.Build as C (initialBuildSteps)
import qualified Distribution.Types.ComponentRequestedSpec as C (defaultComponentRequestedSpec)
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.Simple.PackageIndex as PackageIndex
import qualified Distribution.Types.LocalBuildInfo as C
import qualified Distribution.Text as C
import qualified Distribution.Types.CondTree as C
import qualified Distribution.Types.MungedPackageId as C (mungedName)
import qualified Distribution.Verbosity as C
import qualified Distribution.PackageDescription.Parsec as C
import qualified Distribution.Simple.Compiler as C (packageKeySupported, languageToFlags, extensionsToFlags, compilerInfo)
import qualified Distribution.Simple.GHC as GHC
import qualified Distribution.Simple.Program.Db as Db
import qualified Distribution.Simple as Hooks (simpleUserHooks, autoconfUserHooks, defaultMainWithHooksNoReadArgs, compilerFlavor, CompilerFlavor(GHC))
import qualified Distribution.Simple.UserHooks as Hooks
import qualified Distribution.Simple.Program.Builtin as C
import qualified Distribution.Simple.Utils as C (findHookedPackageDesc)
import qualified Distribution.Simple.Program.Types as C (programDefaultArgs, programOverrideArgs)
import qualified Distribution.Simple.Configure as C (getPersistBuildConfig)
import qualified Distribution.Simple.Build as C (initialBuildSteps)
import qualified Distribution.Types.ComponentRequestedSpec as C (defaultComponentRequestedSpec)
import qualified Distribution.InstalledPackageInfo as Installed
import qualified Distribution.Simple.PackageIndex as PackageIndex
import qualified Distribution.Types.LocalBuildInfo as C
import qualified Distribution.Text as C
import qualified Distribution.Types.MungedPackageId as C (mungedName)
import qualified Distribution.Verbosity as C

import Base
import Builder hiding (Builder)
Expand Down Expand Up @@ -102,7 +102,7 @@ parseCabal context@Context {..} = do
addFlag ('+':name) = C.insertFlagAssignment (C.mkFlagName name) True
addFlag name = C.insertFlagAssignment (C.mkFlagName name) True

let (Right (pd,_)) = C.finalizePackageDescription flags (const True) platform (C.compilerInfo compiler) [] gpd
let (Right (pd,_)) = C.finalizePD flags C.defaultComponentRequestedSpec (const True) platform (C.compilerInfo compiler) [] gpd
-- depPkgs are all those packages that are needed. These should be found in
-- the known build packages. Even if they are not build in this stage.
let depPkgs = map (findPackageByName' . C.unPackageName . C.depPkgName)
Expand Down Expand Up @@ -200,7 +200,7 @@ parsePackageData context@Context {..} = do
-- We should use the gpd, and
-- the flagAssignment and compiler, hostPlatform, ... information
-- from the lbi. And then compute the finaliz PD (flags, satisfiable dependencies, platform, compiler info, deps, gpd.)
--
--
-- let (Right (pd,_)) = C.finalizePackageDescription flags (const True) platform (compilerInfo compiler) [] gpd
--
-- However when using the new-build path's this might change.
Expand All @@ -221,6 +221,8 @@ parsePackageData context@Context {..} = do
lbi' = lbi { C.localPkgDescr = pd' }
liftIO $ C.initialBuildSteps cPath pd' lbi' C.silent

-- TODO: Get rid of deprecated 'externalPackageDeps' and drop -Wno-deprecations
-- See: https://github.com/snowleopard/hadrian/issues/548
let extDeps = C.externalPackageDeps lbi'
deps = map (C.display . snd) extDeps
dep_direct = map (fromMaybe (error "dep_keys failed")
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/Clean.hs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Rules.Clean (clean, cleanRules) where
module Rules.Clean (clean, cleanSourceTree, cleanRules) where

import Base

Expand Down
3 changes: 2 additions & 1 deletion src/Rules/SourceDist.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ sourceDistRules = do
"sdist-ghc" ~> do
-- We clean the source tree first.
-- See https://github.com/snowleopard/hadrian/issues/384.
-- cleanSourceTree
-- TODO: Do we still need to clean the tree?
cleanSourceTree
version <- setting ProjectVersion
need ["sdistprep/ghc-" ++ version ++ "-src.tar.xz"]
putSuccess "| Done"
Expand Down
1 change: 0 additions & 1 deletion src/Settings/Builders/Common.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ packageDatabaseArgs = do
stage <- getStage
dbPath <- expr (packageDbPath stage)
expr (need [dbPath -/- packageDbStamp])
top <- expr topDirectory
root <- getBuildRoot
prefix <- ifM (builder Ghc) (return "-package-db ") (return "--package-db=")
arg $ prefix ++ root -/- relativePackageDbPath stage
Expand Down
13 changes: 2 additions & 11 deletions src/Settings/Builders/GhcCabal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ ghcCabalBuilderArgs = mconcat
-- don't strip libraries when cross compiling.
-- XXX we need to set --with-strip= (stripCmdPath :: Action FilePath), and if it's ':' disable
-- stripping as well. As it is now, I believe we might have issues with stripping on
-- windows, as I can't see a consumre of `stripCmdPath`.
-- windows, as I can't see a consumer of `stripCmdPath`.
-- TODO: See https://github.com/snowleopard/hadrian/issues/549.
, crossCompiling ? pure [ "--disable-executable-stripping", "--disable-library-stripping" ]
, arg "--cabal-file"
, arg =<< fromJust . pkgCabalFile <$> getPackage
Expand Down Expand Up @@ -52,7 +53,6 @@ ghcCabalBuilderArgs = mconcat
]
]


-- TODO: Isn't vanilla always built? If yes, some conditions are redundant.
-- TODO: Need compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci?
-- TODO: should `elem` be `wayUnit`?
Expand Down Expand Up @@ -155,12 +155,3 @@ with b = do
withStaged :: (Stage -> Builder) -> Args
withStaged sb = with . sb =<< getStage

stagedBuilderPath :: (Stage -> Builder) -> Args
stagedBuilderPath sb = builderPath . sb =<< getStage
where builderPath :: Builder -> Args
builderPath b = do
path <- getBuilderPath b
if (null path) then mempty else do
top <- expr topDirectory
expr $ needBuilder b
arg $ unifyPath (top </> path)
1 change: 0 additions & 1 deletion src/Settings/Default.hs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ import Settings.Warnings

import {-# SOURCE #-} Builder
import GHC
import GHC.Packages
import qualified Hadrian.Builder.Ar
import qualified Hadrian.Builder.Sphinx
import qualified Hadrian.Builder.Tar
Expand Down