1 import Distribution
.Simple
.LocalBuildInfo
2 import Test
.Cabal
.Prelude
3 import System
.Directory
6 -- Test if extra-compilation-artifacts are installed
7 main
= setupAndCabalTest
. recordMode DoNotRecord
$ do
11 generateExtraCompArtifactsToBuildDir
14 lbi
<- getLocalBuildInfoM
15 let installedLibPath
= libdir
$ absoluteInstallDirs
(localPkgDescr lbi
) lbi NoCopyDest
17 shouldExist
$ installedLibPath
</> "extra-compilation-artifacts" </> "ghc-plugin-X" </> "data-dir" </> "content-A.txt"
18 shouldExist
$ installedLibPath
</> "extra-compilation-artifacts" </> "ghc-plugin-X" </> "data-dir" </> "content-B.txt"
19 shouldExist
$ installedLibPath
</> "extra-compilation-artifacts" </> "ghc-plugin-Y" </> "content-Y.txt"
21 generateExtraCompArtifactsToBuildDir
:: TestM
()
22 generateExtraCompArtifactsToBuildDir
= do
23 -- extra compilation artifacts can be generated optionally by ghc plugins
24 dist_dir
<- fmap testDistDir getTestEnv
25 let genArtifact fname
= liftIO
$ do
26 let dst
= dist_dir
</> "build" </> "extra-compilation-artifacts" </> fname
27 createDirectoryIfMissing
True (takeDirectory dst
)
29 genArtifact
$ "ghc-plugin-X" </> "data-dir" </> "content-A.txt"
30 genArtifact
$ "ghc-plugin-X" </> "data-dir" </> "content-B.txt"
31 genArtifact
$ "ghc-plugin-Y" </> "content-Y.txt"