From 62b55eaffbb36fde418350e565f454470fa8dc3a Mon Sep 17 00:00:00 2001 From: Andrey Mokhov Date: Tue, 3 Apr 2018 01:24:37 +0100 Subject: [PATCH 1/2] Fix warnings See #544 --- src/CommandLine.hs | 1 - src/GHC.hs | 20 ++++++------ src/Hadrian/Haskell/Cabal/Parse.hs | 49 +++++++++++++++--------------- src/Rules/Clean.hs | 2 +- src/Rules/SourceDist.hs | 3 +- src/Settings/Builders/Common.hs | 1 - src/Settings/Builders/GhcCabal.hs | 11 +------ src/Settings/Default.hs | 1 - 8 files changed, 39 insertions(+), 49 deletions(-) diff --git a/src/CommandLine.hs b/src/CommandLine.hs index a76b47cd0b..5aa476d4a0 100644 --- a/src/CommandLine.hs +++ b/src/CommandLine.hs @@ -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 diff --git a/src/GHC.hs b/src/GHC.hs index b22f3bb028..8d7ca13181 100644 --- a/src/GHC.hs +++ b/src/GHC.hs @@ -158,16 +158,16 @@ autogenPath context@Context {..} -- ref: mk/config.mk -- | 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" +-- 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 diff --git a/src/Hadrian/Haskell/Cabal/Parse.hs b/src/Hadrian/Haskell/Cabal/Parse.hs index e3c675baa3..692b8a2431 100644 --- a/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/src/Hadrian/Haskell/Cabal/Parse.hs @@ -1,3 +1,4 @@ +{-# OPTIONS_GHC -Wno-deprecations #-} ----------------------------------------------------------------------------- -- | -- Module : Hadrian.Haskell.Cabal.Parse @@ -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) @@ -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) @@ -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. @@ -221,6 +221,7 @@ 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 let extDeps = C.externalPackageDeps lbi' deps = map (C.display . snd) extDeps dep_direct = map (fromMaybe (error "dep_keys failed") diff --git a/src/Rules/Clean.hs b/src/Rules/Clean.hs index 1633ecde41..629d9a19f7 100644 --- a/src/Rules/Clean.hs +++ b/src/Rules/Clean.hs @@ -1,4 +1,4 @@ -module Rules.Clean (clean, cleanRules) where +module Rules.Clean (clean, cleanSourceTree, cleanRules) where import Base diff --git a/src/Rules/SourceDist.hs b/src/Rules/SourceDist.hs index a28da83209..6ef79294a1 100644 --- a/src/Rules/SourceDist.hs +++ b/src/Rules/SourceDist.hs @@ -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" diff --git a/src/Settings/Builders/Common.hs b/src/Settings/Builders/Common.hs index 40e5d707fd..36be143746 100644 --- a/src/Settings/Builders/Common.hs +++ b/src/Settings/Builders/Common.hs @@ -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 diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs index 4ed06d6b6b..0267185def 100644 --- a/src/Settings/Builders/GhcCabal.hs +++ b/src/Settings/Builders/GhcCabal.hs @@ -23,7 +23,7 @@ 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`. , crossCompiling ? pure [ "--disable-executable-stripping", "--disable-library-stripping" ] , arg "--cabal-file" , arg =<< fromJust . pkgCabalFile <$> getPackage @@ -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) diff --git a/src/Settings/Default.hs b/src/Settings/Default.hs index 5ef0cc3e04..e9ff8584a8 100644 --- a/src/Settings/Default.hs +++ b/src/Settings/Default.hs @@ -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 From e504410dbe0d0e2a396777762477a85301708fa3 Mon Sep 17 00:00:00 2001 From: Andrey Mokhov Date: Tue, 3 Apr 2018 01:41:14 +0100 Subject: [PATCH 2/2] Link to GitHub issues --- src/GHC.hs | 13 ------------- src/Hadrian/Haskell/Cabal/Parse.hs | 1 + src/Settings/Builders/GhcCabal.hs | 2 +- 3 files changed, 2 insertions(+), 14 deletions(-) diff --git a/src/GHC.hs b/src/GHC.hs index 8d7ca13181..5a7dc31456 100644 --- a/src/GHC.hs +++ b/src/GHC.hs @@ -156,19 +156,6 @@ autogenPath context@Context {..} where autogen dir = contextPath context <&> (-/- dir -/- "autogen") --- ref: mk/config.mk --- | 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 diff --git a/src/Hadrian/Haskell/Cabal/Parse.hs b/src/Hadrian/Haskell/Cabal/Parse.hs index 692b8a2431..20eece719d 100644 --- a/src/Hadrian/Haskell/Cabal/Parse.hs +++ b/src/Hadrian/Haskell/Cabal/Parse.hs @@ -222,6 +222,7 @@ parsePackageData context@Context {..} = do 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") diff --git a/src/Settings/Builders/GhcCabal.hs b/src/Settings/Builders/GhcCabal.hs index 0267185def..d656039fb1 100644 --- a/src/Settings/Builders/GhcCabal.hs +++ b/src/Settings/Builders/GhcCabal.hs @@ -24,6 +24,7 @@ ghcCabalBuilderArgs = mconcat -- 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 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 @@ -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`?