From a977cd93c190de56562656ddc9629517f8a669e9 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Thu, 1 Jun 2023 22:02:57 -0500 Subject: [PATCH 01/17] Generate hie files for dependencies --- Cabal/src/Distribution/Simple/GHC.hs | 1 + Cabal/src/Distribution/Simple/Program/GHC.hs | 1 + 2 files changed, 2 insertions(+) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 8949b24c9cf..fbacbbb1eff 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -2474,6 +2474,7 @@ installLib installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do -- copy .hi files over: whenVanilla $ copyModuleFiles "hi" + whenVanilla $ copyModuleFiles "hie" whenProf $ copyModuleFiles "p_hi" whenShared $ copyModuleFiles "dyn_hi" diff --git a/Cabal/src/Distribution/Simple/Program/GHC.hs b/Cabal/src/Distribution/Simple/Program/GHC.hs index 71294c59d00..cbdc14a4b50 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -716,6 +716,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 ghcOptHiDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path From 984bca66138250e0c5e075618bda7b03e778859a Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Thu, 8 Jun 2023 13:04:45 -0500 Subject: [PATCH 02/17] Don't fail on missing .hie files --- Cabal/src/Distribution/Simple/GHC.hs | 6 ++++- Cabal/src/Distribution/Simple/Utils.hs | 36 ++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index fbacbbb1eff..9b00bfade53 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -2474,7 +2474,7 @@ installLib installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do -- copy .hi files over: whenVanilla $ copyModuleFiles "hi" - whenVanilla $ copyModuleFiles "hie" + whenVanilla $ copyAvailableModuleFiles "hie" whenProf $ copyModuleFiles "p_hi" whenShared $ copyModuleFiles "dyn_hi" @@ -2569,6 +2569,10 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do findModuleFilesEx verbosity [builtDir] [ext] (allLibModules lib clbi) >>= installOrdinaryFiles verbosity targetDir + copyAvailableModuleFiles ext = + findAvailableModuleFilesEx [builtDir] [ext] (allLibModules lib clbi) + >>= installOrdinaryFiles verbosity targetDir + copyDirectoryIfExists dirName = do let src = builtDir dirName dst = targetDir dirName diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index 6bede1f2fdc..aa12d65283d 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -114,6 +114,8 @@ module Distribution.Simple.Utils , findAllFilesCwdWithExtension , findModuleFileEx , findModuleFilesEx + , findAvailableModuleFileEx + , findAvailableModuleFilesEx , getDirectoryContentsRecursive -- * environment variables @@ -1291,6 +1293,40 @@ findModuleFileEx verbosity searchPath extensions mod_name = ++ " in the search path: " ++ show searchPath +-- | Finds the files corresponding to a list of Haskell module names. +-- | The list can be empty. +-- +-- As 'findAvailableModuleFile' but for a list of module names. +findAvailableModuleFilesEx + :: [FilePath] + -- ^ build prefix (location of objects) + -> [String] + -- ^ search suffixes + -> [ModuleName] + -- ^ modules + -> IO [(FilePath, FilePath)] +findAvailableModuleFilesEx searchPath extensions moduleNames = + fmap catMaybes + $ traverse (findAvailableModuleFileEx searchPath extensions) moduleNames + +-- | Find the file corresponding to a Haskell module name. +-- +-- This is similar to 'findModuleFileEx' but doesn't fail if the file +-- corresponding to the module is missing, instead returning Nothing. +findAvailableModuleFileEx + :: [FilePath] + -- ^ build prefix (location of objects) + -> [String] + -- ^ search suffixes + -> ModuleName + -- ^ module + -> IO (Maybe (FilePath, FilePath)) +findAvailableModuleFileEx searchPath extensions mod_name = + findFileWithExtension' + extensions + searchPath + (ModuleName.toFilePath mod_name) + -- | List all the files in a directory and all subdirectories. -- -- The order places files in sub-directories after all the files in their From b09fcee2939146b255eac0ecb0f25f2543286bc1 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Fri, 9 Jun 2023 07:44:42 -0500 Subject: [PATCH 03/17] Add GhcOptions flag for -hiedir --- Cabal/src/Distribution/Simple/GHC/Internal.hs | 1 + Cabal/src/Distribution/Simple/Program/GHC.hs | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index b8c3490f33e..176754ffc39 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -576,6 +576,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir + , ghcOptHieDir = toFlag odir , 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 cbdc14a4b50..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,7 +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 ghcOptHiDir] + , concat [["-hiedir", dir] | dir <- flag ghcOptHieDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path From 458703ca011add31ffc4a348dc246f71af47404f Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Mon, 12 Jun 2023 15:36:17 -0500 Subject: [PATCH 04/17] Add golden tests --- cabal-testsuite/PackageTests/CopyHie/HieLocal.hs | 2 ++ cabal-testsuite/PackageTests/CopyHie/cabal.out | 15 +++++++++++++++ .../PackageTests/CopyHie/cabal.project | 3 +++ .../PackageTests/CopyHie/cabal.test.hs | 7 +++++++ .../PackageTests/CopyHie/hie-local.cabal | 13 +++++++++++++ cabal-testsuite/PackageTests/CopyHie/hie/Hie.hs | 3 +++ .../PackageTests/CopyHie/hie/hie.cabal | 13 +++++++++++++ .../repo/hie-dependency-0.1.0.0/HieDependency.hs | 2 ++ .../hie-dependency-0.1.0.0/hie-dependency.cabal | 12 ++++++++++++ .../PackageTests/CopyHie/setup.cabal.out | 9 +++++++++ cabal-testsuite/PackageTests/CopyHie/setup.out | 9 +++++++++ .../PackageTests/CopyHie/setup.test.hs | 6 ++++++ cabal-testsuite/src/Test/Cabal/Monad.hs | 10 +++++++++- 13 files changed, 103 insertions(+), 1 deletion(-) create mode 100644 cabal-testsuite/PackageTests/CopyHie/HieLocal.hs create mode 100644 cabal-testsuite/PackageTests/CopyHie/cabal.out create mode 100644 cabal-testsuite/PackageTests/CopyHie/cabal.project create mode 100644 cabal-testsuite/PackageTests/CopyHie/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/CopyHie/hie-local.cabal create mode 100644 cabal-testsuite/PackageTests/CopyHie/hie/Hie.hs create mode 100644 cabal-testsuite/PackageTests/CopyHie/hie/hie.cabal create mode 100644 cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/HieDependency.hs create mode 100644 cabal-testsuite/PackageTests/CopyHie/repo/hie-dependency-0.1.0.0/hie-dependency.cabal create mode 100644 cabal-testsuite/PackageTests/CopyHie/setup.cabal.out create mode 100644 cabal-testsuite/PackageTests/CopyHie/setup.out create mode 100644 cabal-testsuite/PackageTests/CopyHie/setup.test.hs 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..0f00e0dc229 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs @@ -0,0 +1,7 @@ +import Test.Cabal.Prelude + +main = withShorterPathForNewBuildStore $ \storeDir -> cabalTest $ withRepo "repo" $ do + cabalG ["--store-dir=" ++ storeDir] "v2-build" ["hie"] + liftIO $ do + installedDependencyLibDir <- findDependencyInStore storeDir "hie-dependency" + shouldExist $ installedDependencyLibDir "lib" "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..ffc83374372 --- /dev/null +++ b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs @@ -0,0 +1,6 @@ +import Test.Cabal.Prelude + +main = setupAndCabalTest $ withPackageDb $ do + setup_install ["hie-local"] + env <- getTestEnv + shouldExist $ testLibInstallDir env "hie-local-0.1.0.0" "HieLocal.hie" diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index b64566ddf2c..def7c950952 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,12 @@ testWorkDir env = testPrefixDir :: TestEnv -> FilePath testPrefixDir env = testWorkDir env "usr" +-- | The absolute path where library installs go. +testLibInstallDir :: TestEnv -> FilePath +testLibInstallDir env = testPrefixDir env "lib" compilerDir + where + compilerDir = prettyShow (testPlatform env) ++ "-" ++ showCompilerId (testCompiler env) + -- | The absolute path to the build directory that should be used -- for the current package in a test. testDistDir :: TestEnv -> FilePath From b31a7dd035dd8f55b190a8076ce1dd319240b13c Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Mon, 12 Jun 2023 16:44:11 -0500 Subject: [PATCH 05/17] Add -hiedir to complex build info test --- .../PackageTests/ShowBuildInfo/Complex/single.out | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out index 309b9f6d6e1..8d74b71dba4 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","-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","-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","-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","-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","-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"}]} From 024348bff74454eeeaede4e92cb24c35817b6e54 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Mon, 12 Jun 2023 17:58:50 -0500 Subject: [PATCH 06/17] Run fourmolu --- Cabal/src/Distribution/Simple/Utils.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index aa12d65283d..7f1806531dd 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -1306,8 +1306,8 @@ findAvailableModuleFilesEx -- ^ modules -> IO [(FilePath, FilePath)] findAvailableModuleFilesEx searchPath extensions moduleNames = - fmap catMaybes - $ traverse (findAvailableModuleFileEx searchPath extensions) moduleNames + fmap catMaybes $ + traverse (findAvailableModuleFileEx searchPath extensions) moduleNames -- | Find the file corresponding to a Haskell module name. -- From adbf378516f295fedd83cd504e5ad26660ac6f00 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 08:21:36 -0500 Subject: [PATCH 07/17] Revert "Don't fail on missing .hie files" This reverts commit c3686d1e01e14c3b0bfe578fa2b57ea4a89a144e. --- Cabal/src/Distribution/Simple/GHC.hs | 6 +---- Cabal/src/Distribution/Simple/Utils.hs | 36 -------------------------- 2 files changed, 1 insertion(+), 41 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index 9b00bfade53..fbacbbb1eff 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -2474,7 +2474,7 @@ installLib installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do -- copy .hi files over: whenVanilla $ copyModuleFiles "hi" - whenVanilla $ copyAvailableModuleFiles "hie" + whenVanilla $ copyModuleFiles "hie" whenProf $ copyModuleFiles "p_hi" whenShared $ copyModuleFiles "dyn_hi" @@ -2569,10 +2569,6 @@ installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do findModuleFilesEx verbosity [builtDir] [ext] (allLibModules lib clbi) >>= installOrdinaryFiles verbosity targetDir - copyAvailableModuleFiles ext = - findAvailableModuleFilesEx [builtDir] [ext] (allLibModules lib clbi) - >>= installOrdinaryFiles verbosity targetDir - copyDirectoryIfExists dirName = do let src = builtDir dirName dst = targetDir dirName diff --git a/Cabal/src/Distribution/Simple/Utils.hs b/Cabal/src/Distribution/Simple/Utils.hs index 7f1806531dd..6bede1f2fdc 100644 --- a/Cabal/src/Distribution/Simple/Utils.hs +++ b/Cabal/src/Distribution/Simple/Utils.hs @@ -114,8 +114,6 @@ module Distribution.Simple.Utils , findAllFilesCwdWithExtension , findModuleFileEx , findModuleFilesEx - , findAvailableModuleFileEx - , findAvailableModuleFilesEx , getDirectoryContentsRecursive -- * environment variables @@ -1293,40 +1291,6 @@ findModuleFileEx verbosity searchPath extensions mod_name = ++ " in the search path: " ++ show searchPath --- | Finds the files corresponding to a list of Haskell module names. --- | The list can be empty. --- --- As 'findAvailableModuleFile' but for a list of module names. -findAvailableModuleFilesEx - :: [FilePath] - -- ^ build prefix (location of objects) - -> [String] - -- ^ search suffixes - -> [ModuleName] - -- ^ modules - -> IO [(FilePath, FilePath)] -findAvailableModuleFilesEx searchPath extensions moduleNames = - fmap catMaybes $ - traverse (findAvailableModuleFileEx searchPath extensions) moduleNames - --- | Find the file corresponding to a Haskell module name. --- --- This is similar to 'findModuleFileEx' but doesn't fail if the file --- corresponding to the module is missing, instead returning Nothing. -findAvailableModuleFileEx - :: [FilePath] - -- ^ build prefix (location of objects) - -> [String] - -- ^ search suffixes - -> ModuleName - -- ^ module - -> IO (Maybe (FilePath, FilePath)) -findAvailableModuleFileEx searchPath extensions mod_name = - findFileWithExtension' - extensions - searchPath - (ModuleName.toFilePath mod_name) - -- | List all the files in a directory and all subdirectories. -- -- The order places files in sub-directories after all the files in their From 6c027834ddf3b70007f8c937ccedb4ee9e810d9b Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 08:50:37 -0500 Subject: [PATCH 08/17] Put .hie files in extra-compilation-artifacts --- Cabal/src/Distribution/Simple/GHC.hs | 1 - Cabal/src/Distribution/Simple/GHC/Internal.hs | 2 +- cabal-testsuite/PackageTests/CopyHie/cabal.test.hs | 2 +- cabal-testsuite/PackageTests/CopyHie/setup.test.hs | 2 +- 4 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC.hs b/Cabal/src/Distribution/Simple/GHC.hs index fbacbbb1eff..8949b24c9cf 100644 --- a/Cabal/src/Distribution/Simple/GHC.hs +++ b/Cabal/src/Distribution/Simple/GHC.hs @@ -2474,7 +2474,6 @@ installLib installLib verbosity lbi targetDir dynlibTargetDir _builtDir pkg lib clbi = do -- copy .hi files over: whenVanilla $ copyModuleFiles "hi" - whenVanilla $ copyModuleFiles "hie" whenProf $ copyModuleFiles "p_hi" whenShared $ copyModuleFiles "dyn_hi" diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index 176754ffc39..8696609435d 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -576,7 +576,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir - , ghcOptHieDir = toFlag odir + , ghcOptHieDir = toFlag $ odir "extra-compilation-artifacts" , ghcOptStubDir = toFlag odir , ghcOptOutputDir = toFlag odir , ghcOptOptimisation = toGhcOptimisation (withOptimization lbi) diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs index 0f00e0dc229..8c0c96315d3 100644 --- a/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs @@ -4,4 +4,4 @@ main = withShorterPathForNewBuildStore $ \storeDir -> cabalTest $ withRepo "repo cabalG ["--store-dir=" ++ storeDir] "v2-build" ["hie"] liftIO $ do installedDependencyLibDir <- findDependencyInStore storeDir "hie-dependency" - shouldExist $ installedDependencyLibDir "lib" "HieDependency.hie" + shouldExist $ installedDependencyLibDir "lib" "extra-compilation-artifacts" "HieDependency.hie" diff --git a/cabal-testsuite/PackageTests/CopyHie/setup.test.hs b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs index ffc83374372..d276add57df 100644 --- a/cabal-testsuite/PackageTests/CopyHie/setup.test.hs +++ b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs @@ -3,4 +3,4 @@ import Test.Cabal.Prelude main = setupAndCabalTest $ withPackageDb $ do setup_install ["hie-local"] env <- getTestEnv - shouldExist $ testLibInstallDir env "hie-local-0.1.0.0" "HieLocal.hie" + shouldExist $ testLibInstallDir env "hie-local-0.1.0.0" "extra-compilation-artifacts" "HieLocal.hie" From 529b0c965f0b2ad2279170ed33765903c73aa462 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 09:53:19 -0500 Subject: [PATCH 09/17] Check ghc supports -hiedir flag --- Cabal/src/Distribution/Simple/GHC/ImplInfo.hs | 4 ++++ Cabal/src/Distribution/Simple/GHC/Internal.hs | 3 ++- Cabal/src/Distribution/Simple/Program/GHC.hs | 4 ++-- cabal-testsuite/PackageTests/CopyHie/cabal.test.hs | 1 + cabal-testsuite/PackageTests/CopyHie/setup.test.hs | 1 + 5 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs index 34935f5c93e..8fea17576ac 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 = False , 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 8696609435d..c278c2d5517 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -82,6 +82,7 @@ import qualified Data.ByteString.Lazy.Char8 as BS import qualified Data.Map as Map import qualified Data.Set as Set import Distribution.Types.ComponentId (ComponentId) +import Data.Bool (bool) import System.Directory (getDirectoryContents, getTemporaryDirectory) import System.Environment (getEnv) import System.FilePath @@ -576,7 +577,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir - , ghcOptHieDir = toFlag $ odir "extra-compilation-artifacts" + , ghcOptHieDir = toFlag $ bool Nothing (Just $ odir "extra-compilation-artifacts") $ 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 5e786e2e8e2..b0b3dfbaced 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -532,7 +532,7 @@ data GhcOptions = GhcOptions , ghcOptDynObjSuffix :: Flag String -- ^ only in 'GhcStaticAndDynamic' mode , ghcOptHiDir :: Flag FilePath - , ghcOptHieDir :: Flag FilePath + , ghcOptHieDir :: Flag (Maybe FilePath) , ghcOptObjDir :: Flag FilePath , ghcOptOutputDir :: Flag FilePath , ghcOptStubDir :: Flag FilePath @@ -717,7 +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 [ maybe [] (\dir -> ["-hiedir", dir]) mdir | mdir <- flag ghcOptHieDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path diff --git a/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs index 8c0c96315d3..1c4430fd426 100644 --- a/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs +++ b/cabal-testsuite/PackageTests/CopyHie/cabal.test.hs @@ -1,6 +1,7 @@ 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" diff --git a/cabal-testsuite/PackageTests/CopyHie/setup.test.hs b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs index d276add57df..2c52e33e4ce 100644 --- a/cabal-testsuite/PackageTests/CopyHie/setup.test.hs +++ b/cabal-testsuite/PackageTests/CopyHie/setup.test.hs @@ -1,6 +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" From b35560a6f124880995cfc5c037fcadf6c8de28fd Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 11:35:44 -0500 Subject: [PATCH 10/17] Run fourmolu --- Cabal/src/Distribution/Simple/GHC/Internal.hs | 2 +- Cabal/src/Distribution/Simple/Program/GHC.hs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index c278c2d5517..18931013d3a 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -78,11 +78,11 @@ 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 import Distribution.Types.ComponentId (ComponentId) -import Data.Bool (bool) import System.Directory (getDirectoryContents, getTemporaryDirectory) import System.Environment (getEnv) import System.FilePath diff --git a/Cabal/src/Distribution/Simple/Program/GHC.hs b/Cabal/src/Distribution/Simple/Program/GHC.hs index b0b3dfbaced..9b748ae15d1 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -717,7 +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 [ maybe [] (\dir -> ["-hiedir", dir]) mdir | mdir <- flag ghcOptHieDir] + , concat [maybe [] (\dir -> ["-hiedir", dir]) mdir | mdir <- flag ghcOptHieDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path From e4ad7ad35542a4913efe6fb1db3b41c3cc6e7b79 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 11:52:25 -0500 Subject: [PATCH 11/17] Add changelog --- changelog.d/pr-9019 | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 changelog.d/pr-9019 diff --git a/changelog.d/pr-9019 b/changelog.d/pr-9019 new file mode 100644 index 00000000000..c949f056f54 --- /dev/null +++ b/changelog.d/pr-9019 @@ -0,0 +1,9 @@ +synopsis: Installation of .hie files +packages: Cabal +prs: #9019 +issues: +description: { + +- Hie files generated by ghc are now stored in the 'extra-compilation-artifacts' directory which gets installed with the package. + +} From ddeeecfdeff410deececf3aff3124c269fe6158b Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 13 Jun 2023 12:35:33 -0500 Subject: [PATCH 12/17] Add extra-compilation-artifacts to buildInfo test --- .../PackageTests/ShowBuildInfo/Complex/single.out | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out b/cabal-testsuite/PackageTests/ShowBuildInfo/Complex/single.out index 8d74b71dba4..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","-hiedir","/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","-hiedir","/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","-hiedir","/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","-hiedir","/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","-hiedir","/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"}]} From af6e24dd5e3aa1788c655e905533b2a349e7b197 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Wed, 14 Jun 2023 10:24:54 -0500 Subject: [PATCH 13/17] Correct testLibInstallDir for Windows --- cabal-testsuite/src/Test/Cabal/Monad.hs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cabal-testsuite/src/Test/Cabal/Monad.hs b/cabal-testsuite/src/Test/Cabal/Monad.hs index def7c950952..f8ceddb52ed 100644 --- a/cabal-testsuite/src/Test/Cabal/Monad.hs +++ b/cabal-testsuite/src/Test/Cabal/Monad.hs @@ -573,9 +573,13 @@ testPrefixDir env = testWorkDir env "usr" -- | The absolute path where library installs go. testLibInstallDir :: TestEnv -> FilePath -testLibInstallDir env = testPrefixDir env "lib" compilerDir +testLibInstallDir env = libDir compilerDir where - compilerDir = prettyShow (testPlatform env) ++ "-" ++ showCompilerId (testCompiler env) + 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. From 3edc730160678c75509ed3e302db17aefd19766f Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Thu, 15 Jun 2023 09:39:07 -0500 Subject: [PATCH 14/17] Add constant extraCompilationArtifacts --- Cabal/src/Distribution/Simple/GHC.hs | 3 ++- Cabal/src/Distribution/Simple/GHC/Internal.hs | 3 ++- Cabal/src/Distribution/Simple/Setup/Common.hs | 6 ++++++ 3 files changed, 10 insertions(+), 2 deletions(-) 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/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index 18931013d3a..33ac3aabcb8 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -66,6 +66,7 @@ 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 @@ -577,7 +578,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir - , ghcOptHieDir = toFlag $ bool Nothing (Just $ odir "extra-compilation-artifacts") $ flagHie implInfo + , ghcOptHieDir = toFlag $ bool Nothing (Just $ odir extraCompilationArtifacts) $ flagHie implInfo , ghcOptStubDir = toFlag odir , ghcOptOutputDir = toFlag odir , ghcOptOptimisation = toGhcOptimisation (withOptimization lbi) 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 From 5ab24037e0b0516554552d17fcc76196c3ddd1e0 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Fri, 16 Jun 2023 07:30:17 -0500 Subject: [PATCH 15/17] Update changelog --- changelog.d/pr-9019 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/changelog.d/pr-9019 b/changelog.d/pr-9019 index c949f056f54..22dc3723671 100644 --- a/changelog.d/pr-9019 +++ b/changelog.d/pr-9019 @@ -1,9 +1,9 @@ synopsis: Installation of .hie files packages: Cabal prs: #9019 -issues: +issues: #8685 description: { -- Hie files generated by ghc are now stored in the 'extra-compilation-artifacts' directory which gets installed with the package. +- Hie files generated by GHC are now stored in the `extra-compilation-artifacts` directory which gets installed with the package. } From d23145657047dc6a72799de26c675cdef74f90b4 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Fri, 16 Jun 2023 07:32:36 -0500 Subject: [PATCH 16/17] Remove redundant Maybe in Flag --- Cabal/src/Distribution/Simple/GHC/Internal.hs | 4 ++-- Cabal/src/Distribution/Simple/Program/GHC.hs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Cabal/src/Distribution/Simple/GHC/Internal.hs b/Cabal/src/Distribution/Simple/GHC/Internal.hs index 33ac3aabcb8..bb77d20c5cf 100644 --- a/Cabal/src/Distribution/Simple/GHC/Internal.hs +++ b/Cabal/src/Distribution/Simple/GHC/Internal.hs @@ -61,7 +61,7 @@ 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 @@ -578,7 +578,7 @@ componentGhcOptions verbosity implInfo lbi bi clbi odir = , ghcOptFfiIncludes = toNubListR $ includes bi , ghcOptObjDir = toFlag odir , ghcOptHiDir = toFlag odir - , ghcOptHieDir = toFlag $ bool Nothing (Just $ odir extraCompilationArtifacts) $ flagHie implInfo + , 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 9b748ae15d1..5e786e2e8e2 100644 --- a/Cabal/src/Distribution/Simple/Program/GHC.hs +++ b/Cabal/src/Distribution/Simple/Program/GHC.hs @@ -532,7 +532,7 @@ data GhcOptions = GhcOptions , ghcOptDynObjSuffix :: Flag String -- ^ only in 'GhcStaticAndDynamic' mode , ghcOptHiDir :: Flag FilePath - , ghcOptHieDir :: Flag (Maybe FilePath) + , ghcOptHieDir :: Flag FilePath , ghcOptObjDir :: Flag FilePath , ghcOptOutputDir :: Flag FilePath , ghcOptStubDir :: Flag FilePath @@ -717,7 +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 [maybe [] (\dir -> ["-hiedir", dir]) mdir | mdir <- flag ghcOptHieDir] + , concat [["-hiedir", dir] | dir <- flag ghcOptHieDir] , concat [["-stubdir", dir] | dir <- flag ghcOptStubDir] , ----------------------- -- Source search path From 0deba9d9f730601003cd2d184705d03af5ac9d13 Mon Sep 17 00:00:00 2001 From: Elodie Lander Date: Tue, 20 Jun 2023 12:30:05 -0500 Subject: [PATCH 17/17] Set flagHie the same for GHCJS --- Cabal/src/Distribution/Simple/GHC/ImplInfo.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs index 8fea17576ac..df1a811bfb6 100644 --- a/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs +++ b/Cabal/src/Distribution/Simple/GHC/ImplInfo.hs @@ -121,7 +121,7 @@ ghcjsVersionImplInfo _ghcjsver ghcver = , flagProfLate = True , flagPackageConf = False , flagDebugInfo = False - , flagHie = False + , flagHie = ghcv >= [8, 8] , supportsDebugLevels = ghcv >= [8, 0] , supportsPkgEnvFiles = ghcv >= [8, 0, 2] -- TODO: check this works in ghcjs , flagWarnMissingHomeModules = ghcv >= [8, 2]