diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 8949b24c9cf..f01d096e48c 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -107,6 +107,7 @@ import Distribution.Simple.Program.GHC import qualified Distribution.Simple.Program.HcPkg as HcPkg import qualified Distribution.Simple.Program.Ld as Ld import qualified Distribution.Simple.Program.Strip as Strip +import Distribution.Simple.Setup.Common (extraCompilationArtifacts) import Distribution.Simple.Setup.Config import Distribution.Simple.Setup.Repl import Distribution.Simple.Utils @@ -2478,7 +2479,7 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do whenShared $ copyModuleFiles "dyn_hi" -- copy extra compilation artifacts that ghc plugins may produce - copyDirectoryIfExists "extra-compilation-artifacts" + copyDirectoryIfExists extraCompilationArtifacts -- copy the built library files over: whenHasCode $ do diff --git a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs index 34935f5c93e..df1a811bfb6 100644 --- a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs +++ b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs @@ -52,6 +52,8 @@ data GhcImplInfo = GhcImplInfo -- ^ use package-conf instead of package-db , flagDebugInfo :: Bool -- ^ -g flag supported + , flagHie :: Bool + -- ^ -hiedir flag supported , supportsDebugLevels :: Bool -- ^ supports numeric @-g@ levels , supportsPkgEnvFiles :: Bool @@ -93,6 +95,7 @@ ghcVersionImplInfo ver = , flagProfLate = v >= [9, 4] , flagPackageConf = v < [7, 5] , flagDebugInfo = v >= [7, 10] + , flagHie = v >= [8, 8] , supportsDebugLevels = v >= [8, 0] , supportsPkgEnvFiles = v >= [8, 0, 1, 20160901] -- broken in 8.0.1, fixed in 8.0.2 , flagWarnMissingHomeModules = v >= [8, 2] @@ -118,6 +121,7 @@ ghcjsVersionImplInfo _ghcjsver ghcver = , flagProfLate = True , flagPackageConf = False , flagDebugInfo = False + , flagHie = ghcv >= [8, 8] , supportsDebugLevels = ghcv >= [8, 0] , supportsPkgEnvFiles = ghcv >= [8, 0, 2] -- TODO: check this works in ghcjs , flagWarnMissingHomeModules = ghcv >= [8, 2] diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index b8c3490f33e..bb77d20c5cf 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -61,11 +61,12 @@ import Distribution.Parsec (simpleParsec) import Distribution.Pretty (prettyShow) import Distribution.Simple.BuildPaths import Distribution.Simple.Compiler -import Distribution.Simple.Flag (Flag, maybeToFlag, toFlag) +import Distribution.Simple.Flag (Flag (NoFlag), maybeToFlag, toFlag) import Distribution.Simple.GHC.ImplInfo import Distribution.Simple.LocalBuildInfo import Distribution.Simple.Program import Distribution.Simple.Program.GHC +import Distribution.Simple.Setup.Common (extraCompilationArtifacts) import Distribution.Simple.Utils import Distribution.System import Distribution.Types.ComponentLocalBuildInfo @@ -78,6 +79,7 @@ import Distribution.Verbosity import Distribution.Version (Version) import Language.Haskell.Extension +import Data.Bool (bool) import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.Map as Map import qualified Data.Set as Set @@ -576,6 +578,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir + , ghcOptHieDir = bool NoFlag (toFlag $ odir extraCompilationArtifacts) $ flagHie implInfo , ghcOptStubDir = toFlag odir , ghcOptOutputDir = toFlag odir , ghcOptOptimisation = toGhcOptimisation (withOptimization lbi) diff --git a/Cabal/src/Distribution/Simple/Program/GHC.hs b/Cabal/src/Distribution/Simple/Program/GHC.hs index 71294c59d00..5e786e2e8e2 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -532,6 +532,7 @@ data GhcOptions = GhcOptions , ghcOptDynObjSuffix :: Flag String -- ^ only in 'GhcStaticAndDynamic' mode , ghcOptHiDir :: Flag FilePath + , ghcOptHieDir :: Flag FilePath , ghcOptObjDir :: Flag FilePath , ghcOptOutputDir :: Flag FilePath , ghcOptStubDir :: Flag FilePath @@ -716,6 +717,7 @@ renderGhcOptions comp _platform@(Platform _arch os) opts , concat [["-outputdir", dir] | dir <- flag ghcOptOutputDir] , concat [["-odir", dir] | dir <- flag ghcOptObjDir] , concat [["-hidir", dir] | dir <- flag ghcOptHiDir] + , concat [["-hiedir", dir] | dir <- flag ghcOptHieDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path diff --git a/Cabal/src/Distribution/Simple/Setup/Common.hs b/Cabal/src/Distribution/Simple/Setup/Common.hs index f866ba3d8d4..32068b619a5 100644 --- a/Cabal/src/Distribution/Simple/Setup/Common.hs +++ b/Cabal/src/Distribution/Simple/Setup/Common.hs @@ -29,6 +29,7 @@ module Distribution.Simple.Setup.Common , splitArgs , testOrBenchmarkHelpText , defaultDistPref + , extraCompilationArtifacts , optionDistPref , Flag (..) , toFlag @@ -63,6 +64,11 @@ import Distribution.Verbosity defaultDistPref :: FilePath defaultDistPref = "dist" +-- | The name of the directory where optional compilation artifacts +-- go, such as ghc plugins and .hie files. +extraCompilationArtifacts :: FilePath +extraCompilationArtifacts = "extra-compilation-artifacts" + -- | Help text for @test@ and @bench@ commands. testOrBenchmarkHelpText :: String diff --git a/cabal-testsuite/PackageTests/CopyHie/HieLocal.hs b/cabal-testsuite/PackageTests/CopyHie/HieLocal.hs new file mode 100644 index 00000000000..f27759875c4 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/HieLocal.hs @@ -0,0 +1,2 @@ +module HieLocal where +hieLocal = "INSTALL ME" diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.out b/cabal-testsuite/PackageTests/CopyHie/cabal.out new file mode 100644 index 00000000000..a45daf37831 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.out @@ -0,0 +1,15 @@ +# cabal v2-update +Downloading the latest package list from test-local-repo +# cabal v2-build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - hie-dependency-0.1.0.0 (lib) (requires build) + - hie-0.1.0.0 (lib) (first run) +Configuring library for hie-dependency-0.1.0.0... +Preprocessing library for hie-dependency-0.1.0.0... +Building library for hie-dependency-0.1.0.0... +Installing library in +Configuring library for hie-0.1.0.0... +Preprocessing library for hie-0.1.0.0... +Building library for hie-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.project b/cabal-testsuite/PackageTests/CopyHie/cabal.project new file mode 100644 index 00000000000..f257e5b08ab --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.project @@ -0,0 +1,3 @@ +packages: hie . +package hie-dependency + ghc-options: -fwrite-ide-info diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs new file mode 100644 index 00000000000..1c4430fd426 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs @@ -0,0 +1,8 @@ +import Test.Cabal.Prelude + +main = withShorterPathForNewBuildStore $ \storeDir -> cabalTest $ withRepo "repo" $ do + skipUnlessGhcVersion ">= 8.8" + cabalG ["--store-dir=" ++ storeDir] "v2-build" ["hie"] + liftIO $ do + installedDependencyLibDir <- findDependencyInStore storeDir "hie-dependency" + shouldExist $ installedDependencyLibDir "lib" "extra-compilation-artifacts" "HieDependency.hie" diff --git a/cabal-testsuite/PackageTests/CopyHie/hie-local.cabal b/cabal-testsuite/PackageTests/CopyHie/hie-local.cabal new file mode 100644 index 00000000000..624fd17de52 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/hie-local.cabal @@ -0,0 +1,13 @@ +name: hie-local +version: 0.1.0.0 +license: BSD3 +author: Elodie Lander +maintainer: lander89@gmail.com +build-type: Simple +cabal-version: >=1.10 + +library + exposed-modules: HieLocal + build-depends: base + default-language: Haskell2010 + ghc-options: -fwrite-ide-info diff --git a/cabal-testsuite/PackageTests/CopyHie/hie/Hie.hs b/cabal-testsuite/PackageTests/CopyHie/hie/Hie.hs new file mode 100644 index 00000000000..eb9c88b7712 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/hie/Hie.hs @@ -0,0 +1,3 @@ +module Hie where +import HieDependency (hieDependency) +hie = hieDependency diff --git a/cabal-testsuite/PackageTests/CopyHie/hie/hie.cabal b/cabal-testsuite/PackageTests/CopyHie/hie/hie.cabal new file mode 100644 index 00000000000..462fefe3ce0 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/hie/hie.cabal @@ -0,0 +1,13 @@ +name: hie +version: 0.1.0.0 +license: BSD3 +author: Elodie Lander +maintainer: lander89@gmail.com +build-type: Simple +cabal-version: >=1.10 + +library + exposed-modules: Hie + build-depends: base + , hie-dependency + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/HieDependency.hs b/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/HieDependency.hs new file mode 100644 index 00000000000..2bab8cd4666 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/HieDependency.hs @@ -0,0 +1,2 @@ +module HieDependency where +hieDependency = "INSTALL ME" diff --git a/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/hie-dependency.cabal b/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/hie-dependency.cabal new file mode 100644 index 00000000000..151f0540037 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/hie-dependency.cabal @@ -0,0 +1,12 @@ +name: hie-dependency +version: 0.1.0.0 +license: BSD3 +author: Elodie Lander +maintainer: lander89@gmail.com +build-type: Simple +cabal-version: >=1.10 + +library + exposed-modules: HieDependency + build-depends: base + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/CopyHie/setup.cabal.out b/cabal-testsuite/PackageTests/CopyHie/setup.cabal.out new file mode 100644 index 00000000000..c2c8499b59a --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/setup.cabal.out @@ -0,0 +1,9 @@ +# Setup configure +Configuring library for hie-local-0.1.0.0... +# Setup build +Preprocessing library for hie-local-0.1.0.0... +Building library for hie-local-0.1.0.0... +# Setup copy +Installing library in +# Setup register +Registering library for hie-local-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CopyHie/setup.out b/cabal-testsuite/PackageTests/CopyHie/setup.out new file mode 100644 index 00000000000..c2c8499b59a --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/setup.out @@ -0,0 +1,9 @@ +# Setup configure +Configuring library for hie-local-0.1.0.0... +# Setup build +Preprocessing library for hie-local-0.1.0.0... +Building library for hie-local-0.1.0.0... +# Setup copy +Installing library in +# Setup register +Registering library for hie-local-0.1.0.0... diff --git a/cabal-testsuite/PackageTests/CopyHie/setup.test.hs b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs new file mode 100644 index 00000000000..2c52e33e4ce --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +main = setupAndCabalTest $ withPackageDb $ do + skipUnlessGhcVersion ">= 8.8" + setup_install ["hie-local"] + env <- getTestEnv + shouldExist $ testLibInstallDir env "hie-local-0.1.0.0" "extra-compilation-artifacts" "HieLocal.hie" diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out index 309b9f6d6e1..c720a3b3f5c 100644 --- a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out @@ -15,11 +15,11 @@ Warning: 'hs-source-dirs: doesnt-exist' specifies a directory which does not exi 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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optP/single.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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i","-iapp","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/Complex/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/x/Complex/build","-optP-include","-optP/single.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 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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optP/single.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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i","-isrc","-idoesnt-exist","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/build","-optP-include","-optP/single.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 build Build profile: -w ghc- -O1 In order, the following will be built: @@ -34,7 +34,7 @@ Warning: 'hs-source-dirs: doesnt-exist' specifies a directory which does not exi 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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optP/single.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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i","-ibenchmark","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/complex-benchmarks/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/b/complex-benchmarks/build","-optP-include","-optP/single.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 build Build profile: -w ghc- -O1 In order, the following will be built: @@ -49,7 +49,7 @@ Warning: 'hs-source-dirs: doesnt-exist' specifies a directory which does not exi 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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optP/single.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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i","-itest","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/func-test/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/func-test/build","-optP-include","-optP/single.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 build Build profile: -w ghc- -O1 In order, the following will be built: @@ -64,4 +64,4 @@ Warning: 'hs-source-dirs: doesnt-exist' specifies a directory which does not exi 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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optP/single.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","-stubdir","/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i","-itest","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-i/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/unit-test/autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build/global-autogen","-I/single.dist/work/./dist/build//ghc-/Complex-0.1.0.0/t/unit-test/build","-optP-include","-optP/single.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"}]} diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index b64566ddf2c..f8ceddb52ed 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -30,6 +30,7 @@ module Test.Cabal.Monad ( testCurrentDir, testWorkDir, testPrefixDir, + testLibInstallDir, testDistDir, testPackageDbDir, testRepoDir, @@ -59,9 +60,10 @@ import Test.Cabal.Plan import Test.Cabal.OutputNormalizer import Test.Cabal.TestCode +import Distribution.Pretty (prettyShow) import Distribution.Simple.Compiler ( PackageDBStack, PackageDB(..), compilerFlavor - , Compiler, compilerVersion ) + , Compiler, compilerVersion, showCompilerId ) import Distribution.System import Distribution.Simple.Program.Db import Distribution.Simple.Program @@ -569,6 +571,16 @@ testWorkDir env = testPrefixDir :: TestEnv -> FilePath testPrefixDir env = testWorkDir env "usr" +-- | The absolute path where library installs go. +testLibInstallDir :: TestEnv -> FilePath +testLibInstallDir env = libDir compilerDir + where + platform@(Platform _ os) = testPlatform env + libDir = case os of + Windows -> testPrefixDir env + _ -> testPrefixDir env "lib" + compilerDir = prettyShow platform ++ "-" ++ showCompilerId (testCompiler env) + -- | The absolute path to the build directory that should be used -- for the current package in a test. testDistDir :: TestEnv -> FilePath diff --git a/changelog.d/pr-9019 b/changelog.d/pr-9019 new file mode 100644 index 00000000000..22dc3723671 --- /dev/null +++ b/changelog.d/pr-9019 @@ -0,0 +1,9 @@ +synopsis: Installation of .hie files +packages: Cabal +prs: #9019 +issues: #8685 +description: { + +- Hie files generated by GHC are now stored in the `extra-compilation-artifacts` directory which gets installed with the package. + +}