diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 593bf4e9119..a402eba5910 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -60,7 +60,6 @@ module Distribution.Simple.GHC , hcPkgInfo , registerPackage , Internal.componentGhcOptions - , Internal.componentCcGhcOptions , getGhcAppDir , getLibDir , compilerBuildWay @@ -801,7 +800,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do , ghcOptFPic = toFlag True , ghcOptHiSuffix = toFlag "dyn_hi" , ghcOptObjSuffix = toFlag "dyn_o" - , ghcOptExtra = hcOptions GHC libBi ++ hcSharedOptions GHC libBi + , ghcOptExtra = hcSharedOptions GHC libBi } profArgs = vanillaArgs @@ -813,7 +812,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do (withProfLibDetail lbi) , ghcOptHiSuffix = toFlag "p_hi" , ghcOptObjSuffix = toFlag "p_o" - , ghcOptExtra = hcOptions GHC libBi ++ hcProfOptions GHC libBi + , ghcOptExtra = hcProfOptions GHC libBi } profDynArgs = vanillaArgs @@ -827,7 +826,7 @@ libAbiHash verbosity _pkg_descr lbi lib clbi = do , ghcOptFPic = toFlag True , ghcOptHiSuffix = toFlag "p_dyn_hi" , ghcOptObjSuffix = toFlag "p_dyn_o" - , ghcOptExtra = hcOptions GHC libBi ++ hcProfSharedOptions GHC libBi + , ghcOptExtra = hcProfSharedOptions GHC libBi } ghcArgs = let (libWays, _, _) = buildWays lbi diff --git a/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs b/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs index f2ca9aba02f..594882d308e 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/ExtraSources.hs @@ -17,9 +17,10 @@ import Distribution.Utils.NubList import Distribution.Types.BuildInfo import Distribution.Types.Component import Distribution.Types.TargetInfo +import Distribution.Types.Version import Distribution.Simple.Build.Inputs -import Distribution.Simple.GHC.Build.Modules +import Distribution.Simple.BuildWay import Distribution.Simple.GHC.Build.Utils import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program.Types @@ -73,7 +74,23 @@ buildCSources buildCSources mbMainFile = buildExtraSources "C Sources" - Internal.componentCcGhcOptions + ( \verbosity lbi bi clbi odir filename -> + (Internal.sourcesGhcOptions verbosity lbi bi clbi odir filename) + { -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + -- we want to be able to support cxx-options and cc-options separately + -- https://gitlab.haskell.org/ghc/ghc/-/issues/16477 + -- see example in cabal-testsuite/PackageTests/FFI/ForeignOptsC + ghcOptCxxOptions = + Internal.separateGhcOptions + (mkVersion [8, 10]) + (compiler lbi) + (Internal.defaultGhcOptCxxOptions lbi bi) + , -- there are problems with linking with versions below 9.4, + -- that's why we need this replacement for linkGhcOptions + -- see example in cabal-testsuite/PackageTests/ShowBuildInfo/Complex + ghcOptCcProgram = Internal.defaultGhcOptCcProgram lbi + } + ) ( \c -> do let cFiles = cSources (componentBuildInfo c) case c of @@ -86,7 +103,23 @@ buildCSources mbMainFile = buildCxxSources mbMainFile = buildExtraSources "C++ Sources" - Internal.componentCxxGhcOptions + ( \verbosity lbi bi clbi odir filename -> + (Internal.sourcesGhcOptions verbosity lbi bi clbi odir filename) + { -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + -- we want to be able to support cxx-options and cc-options separately + -- https://gitlab.haskell.org/ghc/ghc/-/issues/16477 + -- see example in cabal-testsuite/PackageTests/FFI/ForeignOptsCxx + ghcOptCcOptions = + Internal.separateGhcOptions + (mkVersion [8, 10]) + (compiler lbi) + (Internal.defaultGhcOptCcOptions lbi bi) + , -- there are problems with linking with versions below 9.4, + -- that's why we need this replacement for linkGhcOptions + -- see example in cabal-testsuite/PackageTests/ShowBuildInfo/Complex + ghcOptCcProgram = Internal.defaultGhcOptCcProgram lbi + } + ) ( \c -> do let cxxFiles = cxxSources (componentBuildInfo c) case c of @@ -101,7 +134,7 @@ buildJsSources _mbMainFile ghcProg buildTargetDir neededWays = do let hasJsSupport = hostArch == JavaScript buildExtraSources "JS Sources" - Internal.componentJsGhcOptions + Internal.sourcesGhcOptions ( \c -> if hasJsSupport then -- JS files are C-like with GHC's JS backend: they are @@ -117,12 +150,12 @@ buildJsSources _mbMainFile ghcProg buildTargetDir neededWays = do buildAsmSources _mbMainFile = buildExtraSources "Assembler Sources" - Internal.componentAsmGhcOptions + Internal.sourcesGhcOptions (asmSources . componentBuildInfo) buildCmmSources _mbMainFile = buildExtraSources "C-- Sources" - Internal.componentCmmGhcOptions + Internal.sourcesGhcOptions (cmmSources . componentBuildInfo) -- | Create 'PreBuildComponentRules' for a given type of extra build sources @@ -140,9 +173,7 @@ buildExtraSources -> GhcOptions ) -- ^ Function to determine the @'GhcOptions'@ for the - -- invocation of GHC when compiling these extra sources (e.g. - -- @'Internal.componentCxxGhcOptions'@, - -- @'Internal.componentCmmGhcOptions'@) + -- invocation of GHC when compiling these extra sources -> (Component -> [SymbolicPath Pkg File]) -- ^ View the extra sources of a component, typically from -- the build info (e.g. @'asmSources'@, @'cSources'@). diff --git a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs index 962d0d95c7a..ca07408b76a 100644 --- a/Cabal/src/Distribution/Simple/GHC/Build/Link.hs +++ b/Cabal/src/Distribution/Simple/GHC/Build/Link.hs @@ -121,10 +121,9 @@ linkOrLoadComponent linkerOpts rpaths = mempty { ghcOptLinkOptions = - PD.ldOptions bi - ++ [ "-static" - | withFullyStaticExe lbi - ] + [ "-static" + | withFullyStaticExe lbi + ] -- Pass extra `ld-options` given -- through to GHC's linker. ++ maybe @@ -344,36 +343,11 @@ linkLibrary buildTargetDir cleanedExtraLibDirs pkg_descr verbosity runGhcProg li -- -- Right now, instead, we pass the path to each object file. ghcBaseLinkArgs = - mempty - { -- TODO: This basically duplicates componentGhcOptions. - -- I think we want to do the same as we do for executables: re-use the - -- base options, and link by module names, not object paths. - ghcOptExtra = hcStaticOptions GHC libBi - , ghcOptHideAllPackages = toFlag True - , ghcOptNoAutoLinkPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi - , ghcOptThisUnitId = case clbi of - LibComponentLocalBuildInfo{componentCompatPackageKey = pk} -> - toFlag pk - _ -> mempty - , ghcOptThisComponentId = case clbi of - LibComponentLocalBuildInfo - { componentInstantiatedWith = insts - } -> - if null insts - then mempty - else toFlag (componentComponentId clbi) - _ -> mempty - , ghcOptInstantiatedWith = case clbi of - LibComponentLocalBuildInfo - { componentInstantiatedWith = insts - } -> - insts - _ -> [] - , ghcOptPackages = - toNubListR $ - Internal.mkGhcOptPackages mempty clbi - } + Internal.linkGhcOptions verbosity lbi libBi clbi + <> mempty + { ghcOptExtra = hcStaticOptions GHC libBi + , ghcOptNoAutoLinkPackages = toFlag True + } -- After the relocation lib is created we invoke ghc -shared -- with the dependencies spelled out as -package arguments diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index 9e252d7c889..71682612cb5 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -1,6 +1,5 @@ {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} -{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} ----------------------------------------------------------------------------- @@ -20,12 +19,8 @@ module Distribution.Simple.GHC.Internal , getExtensions , targetPlatform , getGhcInfo - , componentCcGhcOptions - , componentCmmGhcOptions - , componentCxxGhcOptions - , componentAsmGhcOptions - , componentJsGhcOptions , componentGhcOptions + , sourcesGhcOptions , mkGHCiLibName , mkGHCiProfLibName , filterGhciFlags @@ -35,6 +30,11 @@ module Distribution.Simple.GHC.Internal , substTopDir , checkPackageDbEnvVar , profDetailLevelFlag + , defaultGhcOptCcOptions + , defaultGhcOptCxxOptions + , defaultGhcOptCcProgram + , separateGhcOptions + , linkGhcOptions -- * GHC platform and version strings , ghcArchString @@ -59,16 +59,14 @@ import qualified Data.Map as Map import qualified Data.Set as Set import Distribution.Backpack import Distribution.Compat.Stack -import qualified Distribution.InstalledPackageInfo as IPI import Distribution.Lex import qualified Distribution.ModuleName as ModuleName -import Distribution.PackageDescription import Distribution.Parsec (simpleParsec) import Distribution.Pretty (prettyShow) import Distribution.Simple.BuildPaths import Distribution.Simple.Compiler import Distribution.Simple.Errors -import Distribution.Simple.Flag (Flag, maybeToFlag, toFlag, pattern NoFlag) +import Distribution.Simple.Flag import Distribution.Simple.GHC.ImplInfo import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program @@ -76,15 +74,20 @@ import Distribution.Simple.Program.GHC import Distribution.Simple.Setup.Common (extraCompilationArtifacts) import Distribution.Simple.Utils import Distribution.System +import Distribution.Types.BuildInfo import Distribution.Types.ComponentLocalBuildInfo import Distribution.Types.GivenComponent +import qualified Distribution.Types.InstalledPackageInfo as IPI +import Distribution.Types.Library import Distribution.Types.LocalBuildInfo +import Distribution.Types.ModuleRenaming +import Distribution.Types.PackageName import Distribution.Types.TargetInfo import Distribution.Types.UnitId +import Distribution.Types.Version import Distribution.Utils.NubList (NubListR, toNubListR) import Distribution.Utils.Path import Distribution.Verbosity -import Distribution.Version (Version) import Language.Haskell.Extension import System.Directory (getDirectoryContents) import System.Environment (getEnv) @@ -377,7 +380,7 @@ includePaths lbi bi clbi odir = | dir <- mapMaybe (symbolicPathRelative_maybe . unsafeCoerceSymbolicPath) $ includeDirs bi ] -componentCcGhcOptions +sourcesGhcOptions :: Verbosity -> LocalBuildInfo -> BuildInfo @@ -385,149 +388,105 @@ componentCcGhcOptions -> SymbolicPath Pkg (Dir Artifacts) -> SymbolicPath Pkg File -> GhcOptions -componentCcGhcOptions verbosity lbi bi clbi odir filename = - mempty - { -- Respect -v0, but don't crank up verbosity on GHC if - -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! - ghcOptVerbosity = toFlag (min verbosity normal) - , ghcOptMode = toFlag GhcModeCompile +sourcesGhcOptions verbosity lbi bi clbi odir filename = + (componentGhcOptions verbosity lbi bi clbi odir) + { ghcOptMode = toFlag GhcModeCompile , ghcOptInputFiles = toNubListR [filename] - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptHideAllPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi - , ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi - , ghcOptCcOptions = - ( case withOptimization lbi of - NoOptimisation -> [] - _ -> ["-O2"] - ) - ++ ( case withDebugInfo lbi of - NoDebugInfo -> [] - MinimalDebugInfo -> ["-g1"] - NormalDebugInfo -> ["-g"] - MaximalDebugInfo -> ["-g3"] - ) - ++ ccOptions bi - , ghcOptCcProgram = - maybeToFlag $ - programPath - <$> lookupProgram gccProgram (withPrograms lbi) , ghcOptObjDir = toFlag odir - , ghcOptExtra = hcOptions GHC bi - } - -componentCxxGhcOptions - :: Verbosity - -> LocalBuildInfo - -> BuildInfo - -> ComponentLocalBuildInfo - -> SymbolicPath Pkg (Dir Artifacts) - -> SymbolicPath Pkg File - -> GhcOptions -componentCxxGhcOptions verbosity lbi bi clbi odir filename = - mempty - { -- Respect -v0, but don't crank up verbosity on GHC if - -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! - ghcOptVerbosity = toFlag (min verbosity normal) - , ghcOptMode = toFlag GhcModeCompile - , ghcOptInputFiles = toNubListR [filename] - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptHideAllPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi , ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi - , ghcOptCxxOptions = - ( case withOptimization lbi of - NoOptimisation -> [] - _ -> ["-O2"] - ) - ++ ( case withDebugInfo lbi of - NoDebugInfo -> [] - MinimalDebugInfo -> ["-g1"] - NormalDebugInfo -> ["-g"] - MaximalDebugInfo -> ["-g3"] - ) - ++ cxxOptions bi - , ghcOptCcProgram = - maybeToFlag $ - programPath - <$> lookupProgram gccProgram (withPrograms lbi) - , ghcOptObjDir = toFlag odir - , ghcOptExtra = hcOptions GHC bi } -componentAsmGhcOptions - :: Verbosity - -> LocalBuildInfo - -> BuildInfo - -> ComponentLocalBuildInfo - -> SymbolicPath Pkg (Dir Artifacts) - -> SymbolicPath Pkg File - -> GhcOptions -componentAsmGhcOptions verbosity lbi bi clbi odir filename = - mempty - { -- Respect -v0, but don't crank up verbosity on GHC if - -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! - ghcOptVerbosity = toFlag (min verbosity normal) - , ghcOptMode = toFlag GhcModeCompile - , ghcOptInputFiles = toNubListR [filename] - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptHideAllPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi - , ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi - , ghcOptAsmOptions = - ( case withOptimization lbi of - NoOptimisation -> [] - _ -> ["-O2"] - ) - ++ ( case withDebugInfo lbi of - NoDebugInfo -> [] - MinimalDebugInfo -> ["-g1"] - NormalDebugInfo -> ["-g"] - MaximalDebugInfo -> ["-g3"] - ) - ++ asmOptions bi - , ghcOptObjDir = toFlag odir - , ghcOptExtra = hcOptions GHC bi - } +optimizationCFlags :: LocalBuildInfo -> [String] +optimizationCFlags lbi = + ( case withOptimization lbi of + -- see --disable-optimization + NoOptimisation -> [] + -- '*-options: -O[n]' is generally not needed. When building with + -- optimisations Cabal automatically adds '-O2' for * code. Setting it + -- yourself interferes with the --disable-optimization flag. + -- see https://github.com/haskell/cabal/pull/8250 + NormalOptimisation -> ["-O2"] + -- see --enable-optimization + MaximumOptimisation -> ["-O2"] + ) + ++ ( case withDebugInfo lbi of + NoDebugInfo -> [] + MinimalDebugInfo -> ["-g1"] + NormalDebugInfo -> ["-g"] + MaximalDebugInfo -> ["-g3"] + ) + +defaultGhcOptCcOptions :: LocalBuildInfo -> BuildInfo -> [String] +defaultGhcOptCcOptions lbi bi = optimizationCFlags lbi ++ ccOptions bi + +defaultGhcOptCxxOptions :: LocalBuildInfo -> BuildInfo -> [String] +defaultGhcOptCxxOptions lbi bi = optimizationCFlags lbi ++ cxxOptions bi + +defaultGhcOptCcProgram :: LocalBuildInfo -> Flag FilePath +defaultGhcOptCcProgram lbi = + maybeToFlag $ programPath <$> lookupProgram gccProgram (withPrograms lbi) + +-- Since the GHС is sensitive to what is given to it, we sometimes need to +-- be able to pass options only to new versions +-- We want to be able to support C++ and C separately in older ghc +-- See example in buildExtraSources "C++ Sources" or "C Sources" +separateGhcOptions :: Monoid a => Version -> Compiler -> a -> a +separateGhcOptions ver comp defaultOptions = + case compilerCompatVersion GHC comp of + Just v + | v >= ver -> defaultOptions + | otherwise -> mempty + Nothing -> mempty -componentJsGhcOptions +componentGhcOptions :: Verbosity -> LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo - -> SymbolicPath Pkg (Dir Artifacts) - -> SymbolicPath Pkg File + -> SymbolicPath Pkg (Dir build) -> GhcOptions -componentJsGhcOptions verbosity lbi bi clbi odir filename = - mempty - { -- Respect -v0, but don't crank up verbosity on GHC if - -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! - ghcOptVerbosity = toFlag (min verbosity normal) - , ghcOptMode = toFlag GhcModeCompile - , ghcOptInputFiles = toNubListR [filename] - , ghcOptJSppOptions = jsppOptions bi - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptHideAllPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi - , ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi - , ghcOptObjDir = toFlag odir - , ghcOptExtra = hcOptions GHC bi - } +componentGhcOptions verbosity lbi bi clbi odir = + let implInfo = getImplInfo $ compiler lbi + in (linkGhcOptions verbosity lbi bi clbi) + { ghcOptSourcePath = + toNubListR $ + (hsSourceDirs bi) + ++ [coerceSymbolicPath odir] + ++ [autogenComponentModulesDir lbi clbi] + ++ [autogenPackageModulesDir lbi] + , ghcOptCppIncludePath = includePaths lbi bi clbi odir + , ghcOptObjDir = toFlag $ coerceSymbolicPath odir + , ghcOptHiDir = toFlag $ coerceSymbolicPath odir + , ghcOptHieDir = bool NoFlag (toFlag $ coerceSymbolicPath odir (extraCompilationArtifacts makeRelativePathEx "hie")) $ flagHie implInfo + , ghcOptStubDir = toFlag $ coerceSymbolicPath odir + , ghcOptOutputDir = toFlag $ coerceSymbolicPath odir + } -componentGhcOptions +linkGhcOptions :: Verbosity -> LocalBuildInfo -> BuildInfo -> ComponentLocalBuildInfo - -> SymbolicPath Pkg (Dir build) -> GhcOptions -componentGhcOptions verbosity lbi bi clbi odir = +linkGhcOptions verbosity lbi bi clbi = let implInfo = getImplInfo $ compiler lbi in mempty { -- Respect -v0, but don't crank up verbosity on GHC if -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! ghcOptVerbosity = toFlag (min verbosity normal) + , ghcOptCcOptions = defaultGhcOptCcOptions lbi bi + , ghcOptCxxOptions = defaultGhcOptCxxOptions lbi bi + , ghcOptAsmOptions = optimizationCFlags lbi ++ asmOptions bi + , ghcOptLinkOptions = ldOptions bi + , ghcOptCppOptions = cppOptions bi + , ghcOptJSppOptions = jsppOptions bi + , ghcOptExtra = hcOptions GHC bi <> cmmOptions bi , ghcOptCabal = toFlag True + , ghcOptCcProgram = + separateGhcOptions + (mkVersion [9, 4]) + (compiler lbi) + (defaultGhcOptCcProgram lbi) , ghcOptThisUnitId = case clbi of LibComponentLocalBuildInfo{componentCompatPackageKey = pk} -> toFlag pk @@ -561,27 +520,12 @@ componentGhcOptions verbosity lbi bi clbi odir = , ghcOptSplitSections = toFlag (splitSections lbi) , ghcOptSplitObjs = toFlag (splitObjs lbi) , ghcOptSourcePathClear = toFlag True - , ghcOptSourcePath = - toNubListR $ - (hsSourceDirs bi) - ++ [coerceSymbolicPath odir] - ++ [autogenComponentModulesDir lbi clbi] - ++ [autogenPackageModulesDir lbi] - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptCppOptions = cppOptions bi - , ghcOptJSppOptions = jsppOptions bi , ghcOptCppIncludes = toNubListR $ [coerceSymbolicPath (autogenComponentModulesDir lbi clbi makeRelativePathEx cppHeaderName)] , ghcOptFfiIncludes = toNubListR $ map getSymbolicPath $ includes bi - , ghcOptObjDir = toFlag $ coerceSymbolicPath odir - , ghcOptHiDir = toFlag $ coerceSymbolicPath odir - , ghcOptHieDir = bool NoFlag (toFlag $ coerceSymbolicPath odir (extraCompilationArtifacts makeRelativePathEx "hie")) $ flagHie implInfo - , ghcOptStubDir = toFlag $ coerceSymbolicPath odir - , ghcOptOutputDir = toFlag $ coerceSymbolicPath odir , ghcOptOptimisation = toGhcOptimisation (withOptimization lbi) , ghcOptDebugInfo = toFlag (withDebugInfo lbi) - , ghcOptExtra = hcOptions GHC bi , ghcOptExtraPath = toNubListR exe_paths , ghcOptLanguage = toFlag (fromMaybe Haskell98 (defaultLanguage bi)) , -- Unsupported extensions have already been checked by configure @@ -601,35 +545,6 @@ toGhcOptimisation NoOptimisation = mempty -- TODO perhaps override? toGhcOptimisation NormalOptimisation = toFlag GhcNormalOptimisation toGhcOptimisation MaximumOptimisation = toFlag GhcMaximumOptimisation -componentCmmGhcOptions - :: Verbosity - -> LocalBuildInfo - -> BuildInfo - -> ComponentLocalBuildInfo - -> SymbolicPath Pkg (Dir Artifacts) - -> SymbolicPath Pkg File - -> GhcOptions -componentCmmGhcOptions verbosity lbi bi clbi odir filename = - mempty - { -- Respect -v0, but don't crank up verbosity on GHC if - -- Cabal verbosity is requested. For that, use --ghc-option=-v instead! - ghcOptVerbosity = toFlag (min verbosity normal) - , ghcOptMode = toFlag GhcModeCompile - , ghcOptInputFiles = toNubListR [filename] - , ghcOptCppIncludePath = includePaths lbi bi clbi odir - , ghcOptCppOptions = cppOptions bi - , ghcOptCppIncludes = - toNubListR $ - [autogenComponentModulesDir lbi clbi makeRelativePathEx cppHeaderName] - , ghcOptHideAllPackages = toFlag True - , ghcOptPackageDBs = withPackageDB lbi - , ghcOptPackages = toNubListR $ mkGhcOptPackages (promisedPkgs lbi) clbi - , ghcOptOptimisation = toGhcOptimisation (withOptimization lbi) - , ghcOptDebugInfo = toFlag (withDebugInfo lbi) - , ghcOptExtra = hcOptions GHC bi <> cmmOptions bi - , ghcOptObjDir = toFlag odir - } - -- | Strip out flags that are not supported in ghci filterGhciFlags :: [String] -> [String] filterGhciFlags = filter supported diff --git a/Cabal/src/Distribution/Simple/GHCJS.hs b/Cabal/src/Distribution/Simple/GHCJS.hs index 56a4b120b63..1bcc2cf0a82 100644 --- a/Cabal/src/Distribution/Simple/GHCJS.hs +++ b/Cabal/src/Distribution/Simple/GHCJS.hs @@ -24,7 +24,6 @@ module Distribution.Simple.GHCJS , hcPkgInfo , registerPackage , componentGhcOptions - , Internal.componentCcGhcOptions , getLibDir , isDynamic , getGlobalPackageDB @@ -1474,13 +1473,21 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do sequence_ [ do let baseCxxOpts = - Internal.componentCxxGhcOptions - verbosity - lbi - bnfo - clbi - tmpDir - filename + (Internal.sourcesGhcOptions verbosity lbi bnfo clbi odir filename) + { -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + -- we want to be able to support cxx-options and cc-options separately + -- https://gitlab.haskell.org/ghc/ghc/-/issues/16477 + -- see example in cabal-testsuite/PackageTests/FFI/ForeignOptsCxx + ghcOptCcOptions = + Internal.separateGhcOptions + (mkVersion [8, 10]) + (compiler lbi) + (Internal.defaultGhcOptCcOptions lbi bnfo) + , -- there are problems with linking with versions below 9.4, + -- that's why we need this replacement for linkGhcOptions + -- see example in cabal-testsuite/PackageTests/ShowBuildInfo/Complex + ghcOptCcProgram = Internal.defaultGhcOptCcProgram lbi + } vanillaCxxOpts = if isGhcDynamic then -- Dynamic GHC requires C++ sources to be built @@ -1520,13 +1527,21 @@ gbuild verbosity numJobs pkg_descr lbi bm clbi = do sequence_ [ do let baseCcOpts = - Internal.componentCcGhcOptions - verbosity - lbi - bnfo - clbi - tmpDir - filename + (Internal.sourcesGhcOptions verbosity lbi bnfo clbi tmpDir filename) + { -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + -- we want to be able to support cxx-options and cc-options separately + -- https://gitlab.haskell.org/ghc/ghc/-/issues/16477 + -- see example in cabal-testsuite/PackageTests/FFI/ForeignOptsC + ghcOptCxxOptions = + Internal.separateGhcOptions + (mkVersion [8, 10]) + (compiler lbi) + (Internal.defaultGhcOptCxxOptions lbi bnfo) + , -- there are problems with linking with versions below 9.4, + -- that's why we need this replacement for linkGhcOptions + -- see example in cabal-testsuite/PackageTests/ShowBuildInfo/Complex + ghcOptCcProgram = Internal.defaultGhcOptCcProgram lbi + } vanillaCcOpts = if isGhcDynamic then -- Dynamic GHC requires C sources to be built diff --git a/Cabal/src/Distribution/Simple/Program/GHC.hs b/Cabal/src/Distribution/Simple/Program/GHC.hs index 29b722ad278..5ce25506f5a 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -867,6 +867,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts ] , ["-optc" ++ opt | opt <- ghcOptCcOptions opts] , -- C++ compiler options: GHC >= 8.10 requires -optcxx, older requires -optc + -- https://gitlab.haskell.org/ghc/ghc/-/issues/16477 let cxxflag = case compilerCompatVersion GHC comp of Just v | v >= mkVersion [8, 10] -> "-optcxx" _ -> "-optc" diff --git a/cabal-testsuite/PackageTests/Cmm/CmmSources/README.md b/cabal-testsuite/PackageTests/Cmm/CmmSources/README.md new file mode 100644 index 00000000000..d8fff395767 --- /dev/null +++ b/cabal-testsuite/PackageTests/Cmm/CmmSources/README.md @@ -0,0 +1,4 @@ +# CmmSources + +This asserts that cabal passes `cmm-options` to the Haskell compiler when +compiling C-- code. diff --git a/cabal-testsuite/PackageTests/CmmSources/cabal.out b/cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/cabal.out rename to cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.out diff --git a/cabal-testsuite/PackageTests/CmmSources/cabal.project b/cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.project similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/cabal.project rename to cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.project diff --git a/cabal-testsuite/PackageTests/CmmSources/cabal.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/cabal.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSources/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSources/cbits/HeapPrim.cmm b/cabal-testsuite/PackageTests/Cmm/CmmSources/cbits/HeapPrim.cmm similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/cbits/HeapPrim.cmm rename to cabal-testsuite/PackageTests/Cmm/CmmSources/cbits/HeapPrim.cmm diff --git a/cabal-testsuite/PackageTests/CmmSources/cmmexperiment.cabal b/cabal-testsuite/PackageTests/Cmm/CmmSources/cmmexperiment.cabal similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/cmmexperiment.cabal rename to cabal-testsuite/PackageTests/Cmm/CmmSources/cmmexperiment.cabal diff --git a/cabal-testsuite/PackageTests/CmmSources/demo/Main.hs b/cabal-testsuite/PackageTests/Cmm/CmmSources/demo/Main.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/demo/Main.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSources/demo/Main.hs diff --git a/cabal-testsuite/PackageTests/CmmSources/setup.out b/cabal-testsuite/PackageTests/Cmm/CmmSources/setup.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/setup.out rename to cabal-testsuite/PackageTests/Cmm/CmmSources/setup.out diff --git a/cabal-testsuite/PackageTests/CmmSources/setup.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSources/setup.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/setup.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSources/setup.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSources/src/Demo.hs b/cabal-testsuite/PackageTests/Cmm/CmmSources/src/Demo.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSources/src/Demo.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSources/src/Demo.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.out rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.out diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.project b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.project similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.project rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.project diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/cabal.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cbits/HeapPrim.cmm b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cbits/HeapPrim.cmm similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/cbits/HeapPrim.cmm rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cbits/HeapPrim.cmm diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/cmmexperiment.cabal b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cmmexperiment.cabal similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/cmmexperiment.cabal rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/cmmexperiment.cabal diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/demo/Main.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/demo/Main.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/demo/Main.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/demo/Main.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.out b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/setup.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/setup.out rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/setup.out diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/setup.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/setup.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/setup.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/src/Demo.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesDyn/src/Demo.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesDyn/src/Demo.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/cabal.out rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.out diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.project b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.project similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/cabal.project rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.project diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cabal.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/cabal.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cabal.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cbits/HeapPrim.cmm b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cbits/HeapPrim.cmm similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/cbits/HeapPrim.cmm rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cbits/HeapPrim.cmm diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/cmmexperiment.cabal b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cmmexperiment.cabal similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/cmmexperiment.cabal rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/cmmexperiment.cabal diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/demo/Main.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/demo/Main.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/demo/Main.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/demo/Main.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/setup.out b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/setup.out similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/setup.out rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/setup.out diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/setup.test.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/setup.test.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/setup.test.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/setup.test.hs diff --git a/cabal-testsuite/PackageTests/CmmSourcesExe/src/Demo.hs b/cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/src/Demo.hs similarity index 100% rename from cabal-testsuite/PackageTests/CmmSourcesExe/src/Demo.hs rename to cabal-testsuite/PackageTests/Cmm/CmmSourcesExe/src/Demo.hs diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/Main.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/Main.hs new file mode 100644 index 00000000000..f46505ab473 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/Main.hs @@ -0,0 +1,15 @@ +{-# LANGUAGE CApiFFI #-} + +module Main where + +import Foreign.C (CInt (..)) + +foreign import capi "clib.h myplus" + myplus :: CInt -> CInt -> IO CInt + +main :: IO () +main = do + result <- myplus 5 6 + if (result == 11) + then putStrLn ("The result is " ++ show result) + else error ("Expected value 11, got " ++ show result) diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/README.md b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/README.md new file mode 100644 index 00000000000..e9484711f3d --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/README.md @@ -0,0 +1,3 @@ +# ForeignOptsCapi + +This test case asserts that cabal passes `cc-options` to the C compiler when use `foreign import capi`. diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.out b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.out new file mode 100644 index 00000000000..7b6f22a35ad --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.out @@ -0,0 +1,10 @@ +# cabal v2-build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - foreign-opts-capi-0.1 (exe:foreign-opts-capi-exe) (first run) +Configuring executable 'foreign-opts-capi-exe' for foreign-opts-capi-0.1... +Preprocessing executable 'foreign-opts-capi-exe' for foreign-opts-capi-0.1... +Building executable 'foreign-opts-capi-exe' for foreign-opts-capi-0.1... +# foreign-opts-capi foreign-opts-capi-exe +The result is 11 diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.project b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.project new file mode 100644 index 00000000000..e6fdbadb439 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.project @@ -0,0 +1 @@ +packages: . diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.test.hs b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.test.hs new file mode 100644 index 00000000000..dc22334a884 --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cabal.test.hs @@ -0,0 +1,4 @@ +import Test.Cabal.Prelude +main = cabalTest $ do + cabal "v2-build" ["foreign-opts-capi-exe"] + withPlan $ runPlanExe "foreign-opts-capi" "foreign-opts-capi-exe" [] diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cbits/clib.c b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cbits/clib.c new file mode 100644 index 00000000000..e69de29bb2d diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cbits/clib.h b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cbits/clib.h new file mode 100644 index 00000000000..d3f26d370ca --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/cbits/clib.h @@ -0,0 +1,7 @@ +#ifndef MYDEF +#error "Did not get required MYDEF from cc-options" +#endif + +static inline int myplus(int a, int b) { + return a + b; +} diff --git a/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/foreign-opts-capi.cabal b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/foreign-opts-capi.cabal new file mode 100644 index 00000000000..68f3b45603e --- /dev/null +++ b/cabal-testsuite/PackageTests/FFI/ForeignOptsCapi/foreign-opts-capi.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.0 +name: foreign-opts-capi +version: 0.1 +build-type: Simple + +executable foreign-opts-capi-exe + main-is: Main.hs + build-depends: base + default-language: Haskell2010 + include-dirs: cbits + cc-options: -DMYDEF=1 diff --git a/cabal-testsuite/PackageTests/JS/JSPPOptions/README.md b/cabal-testsuite/PackageTests/JS/JSPPOptions/README.md new file mode 100644 index 00000000000..7acb5233aed --- /dev/null +++ b/cabal-testsuite/PackageTests/JS/JSPPOptions/README.md @@ -0,0 +1,3 @@ +# JSPPOptions + +This asserts that cabal passes `jspp-options` to the JavaScript-preprocessor. diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.out new file mode 100644 index 00000000000..549d33bc4a6 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.out @@ -0,0 +1,67 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - Complex-0.1.0.0 (lib) (first run) + - Complex-0.1.0.0 (exe:Complex) (first run) +Configuring library for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing library for Complex-0.1.0.0... +Building library for Complex-0.1.0.0... +Configuring executable 'Complex' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing executable 'Complex' for Complex-0.1.0.0... +Building executable 'Complex' for Complex-0.1.0.0... +# show-build-info Complex exe:Complex +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single-2.dist/home/.cabal/store/ghc-/package.db","-package-db","/single-2.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Up to date +# show-build-info Complex lib +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPsingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single-2.dist/home/.cabal/store/ghc-/package.db","-package-db","/single-2.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - criterion-1.1.4.0 (lib) (requires build) + - Complex-0.1.0.0 (bench:complex-benchmarks) (first run) +Configuring library for criterion-1.1.4.0... +Preprocessing library for criterion-1.1.4.0... +Building library for criterion-1.1.4.0... +Installing library in +Configuring benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... +# show-build-info Complex bench:complex-benchmarks +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single-2.dist/home/.cabal/store/ghc-/package.db","-package-db","/single-2.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - test-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:func-test) (first run) +Configuring library for test-framework-0.8.1.1... +Preprocessing library for test-framework-0.8.1.1... +Building library for test-framework-0.8.1.1... +Installing library in +Configuring test suite 'func-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'func-test' for Complex-0.1.0.0... +Building test suite 'func-test' for Complex-0.1.0.0... +# show-build-info Complex test:func-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single-2.dist/home/.cabal/store/ghc-/package.db","-package-db","/single-2.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - another-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:unit-test) (first run) +Configuring library for another-framework-0.8.1.1... +Preprocessing library for another-framework-0.8.1.1... +Building library for another-framework-0.8.1.1... +Installing library in +Configuring test suite 'unit-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'unit-test' for Complex-0.1.0.0... +Building test suite 'unit-test' for Complex-0.1.0.0... +# show-build-info Complex test:unit-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle-2.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single-2.dist/home/.cabal/store/ghc-/package.db","-package-db","/single-2.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.test.hs new file mode 100644 index 00000000000..663aa7f01b5 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single-2.test.hs @@ -0,0 +1,76 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude + +main = do + cabalTest $ do + -- the With GHC-9.2+ output contains -this-unit-id + skipUnlessGhcVersion "^>= 9.2" + withRepo "repo" $ do + runShowBuildInfo ["exe:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" (exe "Complex") + assertComponent + "Complex" + (exe "Complex") + defCompAssertion + { modules = ["Other", "Paths_Complex"] + , sourceFiles = ["Main.lhs"] + , sourceDirs = ["app"] + } + ) + + runShowBuildInfo ["lib:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" mainLib + assertComponent + "Complex" + mainLib + defCompAssertion + { modules = ["A", "B", "C", "D", "Paths_Complex"] + , sourceDirs = ["src", "doesnt-exist"] + } + ) + + runShowBuildInfo ["benchmark:complex-benchmarks"] + >> withPlan + ( do + recordBuildInfo "Complex" (bench "complex-benchmarks") + assertComponent + "Complex" + (bench "complex-benchmarks") + defCompAssertion + { modules = ["Paths_Complex"] + , sourceFiles = ["Main.hs"] + , sourceDirs = ["benchmark"] + } + ) + + runShowBuildInfo ["test:func-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "func-test") + assertComponent + "Complex" + (test "func-test") + defCompAssertion + { sourceFiles = ["FuncMain.hs"] + , sourceDirs = ["test"] + } + ) + + runShowBuildInfo ["test:unit-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "unit-test") + assertComponent + "Complex" + (test "unit-test") + defCompAssertion + { sourceFiles = ["UnitMain.hs"] + , sourceDirs = ["test"] + } + ) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out index 3825d1f6cf8..53d7231d1ff 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out @@ -15,11 +15,11 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing executable 'Complex' for Complex-0.1.0.0... Building executable 'Complex' for Complex-0.1.0.0... # show-build-info Complex exe:Complex -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/usr/bin/gcc","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build Up to date # show-build-info Complex lib -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/usr/bin/gcc","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build Build profile: -w ghc- -O1 In order, the following will be built: @@ -34,7 +34,7 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... # show-build-info Complex bench:complex-benchmarks -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/usr/bin/gcc","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build Build profile: -w ghc- -O1 In order, the following will be built: @@ -49,7 +49,7 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing test suite 'func-test' for Complex-0.1.0.0... Building test suite 'func-test' for Complex-0.1.0.0... # show-build-info Complex test:func-test -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/usr/bin/gcc","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} # cabal build Build profile: -w ghc- -O1 In order, the following will be built: @@ -64,4 +64,4 @@ Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a director Preprocessing test suite 'unit-test' for Complex-0.1.0.0... Building test suite 'unit-test' for Complex-0.1.0.0... # show-build-info Complex test:unit-test -{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Isingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPsingle.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/usr/bin/gcc","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/single.dist/home/.cabal/store/ghc-/package.db","-package-db","/single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.test.hs index b4bdc16f0cd..384db7cf7e7 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.test.hs +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.test.hs @@ -1,44 +1,78 @@ {-# LANGUAGE OverloadedStrings #-} -import Test.Cabal.Prelude -import Test.Cabal.DecodeShowBuildInfo -main = cabalTest $ do - -- the With GHC-9.2+ output contains -this-unit-id - skipUnlessGhcVersion ">= 9.2" - withRepo "repo" $ do - runShowBuildInfo ["exe:Complex"] >> withPlan (do - recordBuildInfo "Complex" (exe "Complex") - assertComponent "Complex" (exe "Complex") defCompAssertion - { modules = ["Other", "Paths_Complex"] - , sourceFiles = ["Main.lhs"] - , sourceDirs = ["app"] - }) +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude - runShowBuildInfo ["lib:Complex"] >> withPlan (do - recordBuildInfo "Complex" mainLib - assertComponent "Complex" mainLib defCompAssertion - { modules = ["A", "B", "C", "D", "Paths_Complex"] - , sourceDirs = ["src", "doesnt-exist"] - }) +main = do + skipIfWindows "-pgmc introduces output differences between gcc and mingw" + cabalTest $ do + -- the With GHC-9.2+ output contains -this-unit-id + -- the With GHC-9.4+ output contains -pgmc by default + skipUnlessGhcVersion ">= 9.4" + withRepo "repo" $ do + runShowBuildInfo ["exe:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" (exe "Complex") + assertComponent + "Complex" + (exe "Complex") + defCompAssertion + { modules = ["Other", "Paths_Complex"] + , sourceFiles = ["Main.lhs"] + , sourceDirs = ["app"] + } + ) - runShowBuildInfo ["benchmark:complex-benchmarks"] >> withPlan (do - recordBuildInfo "Complex" (bench "complex-benchmarks") - assertComponent "Complex" (bench "complex-benchmarks") defCompAssertion - { modules = ["Paths_Complex"] - , sourceFiles = ["Main.hs"] - , sourceDirs = ["benchmark"] - }) + runShowBuildInfo ["lib:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" mainLib + assertComponent + "Complex" + mainLib + defCompAssertion + { modules = ["A", "B", "C", "D", "Paths_Complex"] + , sourceDirs = ["src", "doesnt-exist"] + } + ) - runShowBuildInfo ["test:func-test"] >> withPlan (do - recordBuildInfo "Complex" (test "func-test") - assertComponent "Complex" (test "func-test") defCompAssertion - { sourceFiles = ["FuncMain.hs"] - , sourceDirs = ["test"] - }) + runShowBuildInfo ["benchmark:complex-benchmarks"] + >> withPlan + ( do + recordBuildInfo "Complex" (bench "complex-benchmarks") + assertComponent + "Complex" + (bench "complex-benchmarks") + defCompAssertion + { modules = ["Paths_Complex"] + , sourceFiles = ["Main.hs"] + , sourceDirs = ["benchmark"] + } + ) - runShowBuildInfo ["test:unit-test"] >> withPlan (do - recordBuildInfo "Complex" (test "unit-test") - assertComponent "Complex" (test "unit-test") defCompAssertion - { sourceFiles = ["UnitMain.hs"] - , sourceDirs = ["test"] - }) + runShowBuildInfo ["test:func-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "func-test") + assertComponent + "Complex" + (test "func-test") + defCompAssertion + { sourceFiles = ["FuncMain.hs"] + , sourceDirs = ["test"] + } + ) + + runShowBuildInfo ["test:unit-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "unit-test") + assertComponent + "Complex" + (test "unit-test") + defCompAssertion + { sourceFiles = ["UnitMain.hs"] + , sourceDirs = ["test"] + } + ) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.out new file mode 100644 index 00000000000..04c64ca0569 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.out @@ -0,0 +1,67 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - Complex-0.1.0.0 (lib) (first run) + - Complex-0.1.0.0 (exe:Complex) (first run) +Configuring library for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing library for Complex-0.1.0.0... +Building library for Complex-0.1.0.0... +Configuring executable 'Complex' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing executable 'Complex' for Complex-0.1.0.0... +Building executable 'Complex' for Complex-0.1.0.0... +# show-build-info Complex exe:Complex +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/tools/ghc-/lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-4.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-4.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Up to date +# show-build-info Complex lib +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/tools/ghc-/lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-4.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-4.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - criterion-1.1.4.0 (lib) (requires build) + - Complex-0.1.0.0 (bench:complex-benchmarks) (first run) +Configuring library for criterion-1.1.4.0... +Preprocessing library for criterion-1.1.4.0... +Building library for criterion-1.1.4.0... +Installing library in +Configuring benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... +# show-build-info Complex bench:complex-benchmarks +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/tools/ghc-/lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-4.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-4.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - test-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:func-test) (first run) +Configuring library for test-framework-0.8.1.1... +Preprocessing library for test-framework-0.8.1.1... +Building library for test-framework-0.8.1.1... +Installing library in +Configuring test suite 'func-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'func-test' for Complex-0.1.0.0... +Building test suite 'func-test' for Complex-0.1.0.0... +# show-build-info Complex test:func-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/tools/ghc-/lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-4.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-4.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - another-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:unit-test) (first run) +Configuring library for another-framework-0.8.1.1... +Preprocessing library for another-framework-0.8.1.1... +Building library for another-framework-0.8.1.1... +Installing library in +Configuring test suite 'unit-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'unit-test' for Complex-0.1.0.0... +Building test suite 'unit-test' for Complex-0.1.0.0... +# show-build-info Complex test:unit-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","win-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPwin-single-4.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/tools/ghc-/lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-4.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-4.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.test.hs new file mode 100644 index 00000000000..aca0b5b634f --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-4.test.hs @@ -0,0 +1,78 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ do + -- the With GHC-9.2+ output contains -this-unit-id + -- the With GHC-9.4+ output contains -pgmc by default + skipUnlessGhcVersion "^>= 9.4" + withRepo "repo" $ do + runShowBuildInfo ["exe:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" (exe "Complex") + assertComponent + "Complex" + (exe "Complex") + defCompAssertion + { modules = ["Other", "Paths_Complex"] + , sourceFiles = ["Main.lhs"] + , sourceDirs = ["app"] + } + ) + + runShowBuildInfo ["lib:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" mainLib + assertComponent + "Complex" + mainLib + defCompAssertion + { modules = ["A", "B", "C", "D", "Paths_Complex"] + , sourceDirs = ["src", "doesnt-exist"] + } + ) + + runShowBuildInfo ["benchmark:complex-benchmarks"] + >> withPlan + ( do + recordBuildInfo "Complex" (bench "complex-benchmarks") + assertComponent + "Complex" + (bench "complex-benchmarks") + defCompAssertion + { modules = ["Paths_Complex"] + , sourceFiles = ["Main.hs"] + , sourceDirs = ["benchmark"] + } + ) + + runShowBuildInfo ["test:func-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "func-test") + assertComponent + "Complex" + (test "func-test") + defCompAssertion + { sourceFiles = ["FuncMain.hs"] + , sourceDirs = ["test"] + } + ) + + runShowBuildInfo ["test:unit-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "unit-test") + assertComponent + "Complex" + (test "unit-test") + defCompAssertion + { sourceFiles = ["UnitMain.hs"] + , sourceDirs = ["test"] + } + ) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.out new file mode 100644 index 00000000000..daf15a7079d --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.out @@ -0,0 +1,67 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - Complex-0.1.0.0 (lib) (first run) + - Complex-0.1.0.0 (exe:Complex) (first run) +Configuring library for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing library for Complex-0.1.0.0... +Building library for Complex-0.1.0.0... +Configuring executable 'Complex' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing executable 'Complex' for Complex-0.1.0.0... +Building executable 'Complex' for Complex-0.1.0.0... +# show-build-info Complex exe:Complex +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-8-6.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-8-6.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Up to date +# show-build-info Complex lib +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-8-6.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-8-6.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - criterion-1.1.4.0 (lib) (requires build) + - Complex-0.1.0.0 (bench:complex-benchmarks) (first run) +Configuring library for criterion-1.1.4.0... +Preprocessing library for criterion-1.1.4.0... +Building library for criterion-1.1.4.0... +Installing library in +Configuring benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... +# show-build-info Complex bench:complex-benchmarks +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-8-6.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-8-6.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - test-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:func-test) (first run) +Configuring library for test-framework-0.8.1.1... +Preprocessing library for test-framework-0.8.1.1... +Building library for test-framework-0.8.1.1... +Installing library in +Configuring test suite 'func-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'func-test' for Complex-0.1.0.0... +Building test suite 'func-test' for Complex-0.1.0.0... +# show-build-info Complex test:func-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-8-6.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-8-6.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - another-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:unit-test) (first run) +Configuring library for another-framework-0.8.1.1... +Preprocessing library for another-framework-0.8.1.1... +Building library for another-framework-0.8.1.1... +Installing library in +Configuring test suite 'unit-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'unit-test' for Complex-0.1.0.0... +Building test suite 'unit-test' for Complex-0.1.0.0... +# show-build-info Complex test:unit-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","win-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPwin-single-8-6.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw/bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single-8-6.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single-8-6.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.test.hs new file mode 100644 index 00000000000..f4ded97fa74 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single-8-6.test.hs @@ -0,0 +1,78 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ do + -- the With GHC-9.2+ output contains -this-unit-id + -- the With GHC-9.4+ output contains -pgmc by default + skipUnlessGhcVersion ">= 9.6 && <= 9.10" + withRepo "repo" $ do + runShowBuildInfo ["exe:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" (exe "Complex") + assertComponent + "Complex" + (exe "Complex") + defCompAssertion + { modules = ["Other", "Paths_Complex"] + , sourceFiles = ["Main.lhs"] + , sourceDirs = ["app"] + } + ) + + runShowBuildInfo ["lib:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" mainLib + assertComponent + "Complex" + mainLib + defCompAssertion + { modules = ["A", "B", "C", "D", "Paths_Complex"] + , sourceDirs = ["src", "doesnt-exist"] + } + ) + + runShowBuildInfo ["benchmark:complex-benchmarks"] + >> withPlan + ( do + recordBuildInfo "Complex" (bench "complex-benchmarks") + assertComponent + "Complex" + (bench "complex-benchmarks") + defCompAssertion + { modules = ["Paths_Complex"] + , sourceFiles = ["Main.hs"] + , sourceDirs = ["benchmark"] + } + ) + + runShowBuildInfo ["test:func-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "func-test") + assertComponent + "Complex" + (test "func-test") + defCompAssertion + { sourceFiles = ["FuncMain.hs"] + , sourceDirs = ["test"] + } + ) + + runShowBuildInfo ["test:unit-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "unit-test") + assertComponent + "Complex" + (test "unit-test") + defCompAssertion + { sourceFiles = ["UnitMain.hs"] + , sourceDirs = ["test"] + } + ) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.out new file mode 100644 index 00000000000..3b30714c432 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.out @@ -0,0 +1,67 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - Complex-0.1.0.0 (lib) (first run) + - Complex-0.1.0.0 (exe:Complex) (first run) +Configuring library for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing library for Complex-0.1.0.0... +Building library for Complex-0.1.0.0... +Configuring executable 'Complex' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing executable 'Complex' for Complex-0.1.0.0... +Building executable 'Complex' for Complex-0.1.0.0... +# show-build-info Complex exe:Complex +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"exe","name":"exe:Complex","unit-id":"Complex-0.1.0.0-inplace-Complex","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-odir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hidir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-hiedir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/extra-compilation-artifacts/hie","-stubdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optPwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw//bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-Complex","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010","-threaded","-rtsopts","-with-rtsopts=-N -T","-Wredundant-constraints"],"modules":["Other","Paths_Complex"],"src-files":["Main.lhs"],"hs-src-dirs":["app"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Up to date +# show-build-info Complex lib +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"Complex-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-odir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hidir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-hiedir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/extra-compilation-artifacts/hie","-stubdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optPwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw//bin/clang","-this-unit-id","Complex-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single.dist/work/dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["A","B","C","D","Paths_Complex"],"src-files":[],"hs-src-dirs":["src","doesnt-exist"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - criterion-1.1.4.0 (lib) (requires build) + - Complex-0.1.0.0 (bench:complex-benchmarks) (first run) +Configuring library for criterion-1.1.4.0... +Preprocessing library for criterion-1.1.4.0... +Building library for criterion-1.1.4.0... +Installing library in +Configuring benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing benchmark 'complex-benchmarks' for Complex-0.1.0.0... +Building benchmark 'complex-benchmarks' for Complex-0.1.0.0... +# show-build-info Complex bench:complex-benchmarks +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"bench","name":"bench:complex-benchmarks","unit-id":"Complex-0.1.0.0-inplace-complex-benchmarks","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-odir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hidir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-hiedir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/extra-compilation-artifacts/hie","-stubdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optPwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw//bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-complex-benchmarks","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010","-Wall","-rtsopts","-threaded","-with-rtsopts=-N"],"modules":["Paths_Complex"],"src-files":["Main.hs"],"hs-src-dirs":["benchmark"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - test-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:func-test) (first run) +Configuring library for test-framework-0.8.1.1... +Preprocessing library for test-framework-0.8.1.1... +Building library for test-framework-0.8.1.1... +Installing library in +Configuring test suite 'func-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'func-test' for Complex-0.1.0.0... +Building test suite 'func-test' for Complex-0.1.0.0... +# show-build-info Complex test:func-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:func-test","unit-id":"Complex-0.1.0.0-inplace-func-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-odir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hidir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-hiedir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/extra-compilation-artifacts/hie","-stubdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optPwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw//bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-func-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["FuncMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} +# cabal build +Build profile: -w ghc- -O1 +In order, the following will be built: + - another-framework-0.8.1.1 (lib) (requires build) + - Complex-0.1.0.0 (test:unit-test) (first run) +Configuring library for another-framework-0.8.1.1... +Preprocessing library for another-framework-0.8.1.1... +Building library for another-framework-0.8.1.1... +Installing library in +Configuring test suite 'unit-test' for Complex-0.1.0.0... +Warning: [unknown-directory] 'hs-source-dirs: doesnt-exist' specifies a directory which does not exist. +Preprocessing test suite 'unit-test' for Complex-0.1.0.0... +Building test suite 'unit-test' for Complex-0.1.0.0... +# show-build-info Complex test:unit-test +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"test","name":"test:unit-test","unit-id":"Complex-0.1.0.0-inplace-unit-test","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-odir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hidir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-hiedir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/extra-compilation-artifacts/hie","-stubdir","win-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-Iwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optPwin-single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen/cabal_macros.h","-optc-O2","-optcxx-O2","-opta-O2","-pgmc","/ghcup/ghc//lib/../mingw//bin/clang","-this-unit-id","Complex-0.1.0.0-inplace-unit-test","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/win-single.dist/home/.cabal/store/ghc-/package.db","-package-db","/win-single.dist/work/dist/packagedb/ghc-","-package-id","","-package-id","","-XHaskell2010"],"modules":[],"src-files":["UnitMain.hs"],"hs-src-dirs":["test"],"src-dir":"/","cabal-file":"Complex.cabal"}]} \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.test.hs new file mode 100644 index 00000000000..c7e2edc85b9 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/win-single.test.hs @@ -0,0 +1,78 @@ +{-# LANGUAGE OverloadedStrings #-} + +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude + +main = do + skipUnlessWindows + cabalTest $ do + -- the With GHC-9.2+ output contains -this-unit-id + -- the With GHC-9.4+ output contains -pgmc by default + skipUnlessGhcVersion ">= 9.10" + withRepo "repo" $ do + runShowBuildInfo ["exe:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" (exe "Complex") + assertComponent + "Complex" + (exe "Complex") + defCompAssertion + { modules = ["Other", "Paths_Complex"] + , sourceFiles = ["Main.lhs"] + , sourceDirs = ["app"] + } + ) + + runShowBuildInfo ["lib:Complex"] + >> withPlan + ( do + recordBuildInfo "Complex" mainLib + assertComponent + "Complex" + mainLib + defCompAssertion + { modules = ["A", "B", "C", "D", "Paths_Complex"] + , sourceDirs = ["src", "doesnt-exist"] + } + ) + + runShowBuildInfo ["benchmark:complex-benchmarks"] + >> withPlan + ( do + recordBuildInfo "Complex" (bench "complex-benchmarks") + assertComponent + "Complex" + (bench "complex-benchmarks") + defCompAssertion + { modules = ["Paths_Complex"] + , sourceFiles = ["Main.hs"] + , sourceDirs = ["benchmark"] + } + ) + + runShowBuildInfo ["test:func-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "func-test") + assertComponent + "Complex" + (test "func-test") + defCompAssertion + { sourceFiles = ["FuncMain.hs"] + , sourceDirs = ["test"] + } + ) + + runShowBuildInfo ["test:unit-test"] + >> withPlan + ( do + recordBuildInfo "Complex" (test "unit-test") + assertComponent + "Complex" + (test "unit-test") + defCompAssertion + { sourceFiles = ["UnitMain.hs"] + , sourceDirs = ["test"] + } + ) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Custom/custom.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/Custom/custom.test.hs index f8c413c7c5b..182a0338347 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/Custom/custom.test.hs +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Custom/custom.test.hs @@ -1,7 +1,8 @@ {-# LANGUAGE OverloadedStrings #-} -import Test.Cabal.Prelude -import Test.Cabal.DecodeShowBuildInfo -import Control.Monad.Trans.Reader + +import Control.Monad.Trans.Reader +import Test.Cabal.DecodeShowBuildInfo +import Test.Cabal.Prelude main = setupTest $ do -- No cabal test because per-component is broken with it @@ -14,15 +15,18 @@ main = setupTest $ do assertCommonBuildInfo buildInfo let [libBI, exeBI] = components buildInfo - assertComponentPure libBI defCompAssertion - { modules = ["MyLib"] - , compType = "lib" - , sourceDirs = ["src"] - } - - assertComponentPure exeBI defCompAssertion - { sourceFiles = ["Main.hs"] - , compType = "exe" - , sourceDirs = ["app"] - } + assertComponentPure + libBI + defCompAssertion + { modules = ["MyLib"] + , compType = "lib" + , sourceDirs = ["src"] + } + assertComponentPure + exeBI + defCompAssertion + { sourceFiles = ["Main.hs"] + , compType = "exe" + , sourceDirs = ["app"] + } diff --git a/cabal-testsuite/src/Test/Cabal/DecodeShowBuildInfo.hs b/cabal-testsuite/src/Test/Cabal/DecodeShowBuildInfo.hs index e335d6b93db..d32c74263cc 100644 --- a/cabal-testsuite/src/Test/Cabal/DecodeShowBuildInfo.hs +++ b/cabal-testsuite/src/Test/Cabal/DecodeShowBuildInfo.hs @@ -1,21 +1,22 @@ {-# LANGUAGE DeriveGeneric #-} -{-# LANGUAGE RecordWildCards #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE RecordWildCards #-} + module Test.Cabal.DecodeShowBuildInfo where -import Test.Cabal.Prelude -import Test.Cabal.Plan -import Distribution.Compat.Stack -import Distribution.Text (display) -import Distribution.Types.ComponentName -import Distribution.Types.LibraryName -import Distribution.Types.UnqualComponentName -import Distribution.Package -import Distribution.Pretty (prettyShow) -import Control.Monad.Trans.Reader -import Data.Aeson -import GHC.Generics -import System.Exit +import Control.Monad.Trans.Reader +import Data.Aeson +import Distribution.Compat.Stack +import Distribution.Package +import Distribution.Pretty (prettyShow) +import Distribution.Text (display) +import Distribution.Types.ComponentName +import Distribution.Types.LibraryName +import Distribution.Types.UnqualComponentName +import GHC.Generics +import System.Exit +import Test.Cabal.Plan +import Test.Cabal.Prelude -- | Execute 'cabal build --enable-build-info'. -- @@ -129,7 +130,7 @@ assertComponentPure :: WithCallStack (ComponentInfo -> ComponentAssertion -> Tes assertComponentPure component ComponentAssertion{..} = do assertEqual "Component type" compType (componentType component) assertBool "Component Unit Id" (unitIdPred $ componentUnitId component) - assertBool "Component compiler args" (compilerArgsPred $ componentCompilerArgs component) + assertBool "Component compiler args" (compilerArgsPred $ componentCompilerArgs component) assertEqual "Component modules" modules (componentModules component) assertEqual "Component source files" sourceFiles (componentSrcFiles component) assertEqual "Component source directories" sourceDirs (componentHsSrcDirs component) @@ -152,7 +153,7 @@ assertComponent pkgName cname assert = do assertComponentPure component assertWithCompType where compTypeStr :: ComponentName -> String - compTypeStr (CLibName _) = "lib" + compTypeStr (CLibName _) = "lib" compTypeStr (CFLibName _) = "flib" compTypeStr (CExeName _) = "exe" compTypeStr (CTestName _) = "test" diff --git a/changelog.d/pr-10969.md b/changelog.d/pr-10969.md new file mode 100644 index 00000000000..7939797f3fe --- /dev/null +++ b/changelog.d/pr-10969.md @@ -0,0 +1,25 @@ +--- +synopsis: Pass *-options and -pgmc gcc to GHC when compiling ordinary Haskell sources +packages: [Cabal] +prs: 10969 +issues: [9801, 4435] +significance: significant +--- + +`cc-options`, `cxx-options`, `jspp-options`, `asm-options`, +`cmm-options`, `ld-options`, `cpp-options`, +gccProgram(`-pgmc`) should be always passed when invoking GHC, +similarly as `ghc-options` should be always used when +invoking `ghc` - regardless of what is the intention of a particular GHC-call. +GHC might use or not use the options, Cabal cannot know and should not guess. + +[Historical note] +Before `ghc` 8.10, `cc-options` and `cxx-options` were split into one flag `-optc`, +then in 8.10 they started to split into `-optc` and `-optcxx`, cabal picked up +this change and started to give flags separately not only for new versions, +but also for old ones. That is, now for 8.8 we send `-optc` flags separately for +different sources. + +`cc-options` and `cxx-options` still need to be separated (C/C++) for versions below 8.10. + +gccProgram till need to be separated (C/C++) for versions below 9.4.