diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/Lib.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/Lib.hs new file mode 100644 index 00000000000..f51af83e20a --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/Lib.hs @@ -0,0 +1,4 @@ +module Lib (someFunc) where + +someFunc :: IO () +someFunc = putStrLn "someFunc" diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/WithProject.cabal b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/WithProject.cabal new file mode 100644 index 00000000000..8ff172304b8 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/WithProject.cabal @@ -0,0 +1,13 @@ +cabal-version: 3.0 +name: WithProject +version: 0.1.0.0 +build-type: Simple + +common warnings + ghc-options: -Wall + +library + import: warnings + exposed-modules: Lib + build-depends: base + default-language: Haskell2010 diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/cabal.project b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/cabal.project new file mode 100644 index 00000000000..3f3d6b6e7ae --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/cabal.project @@ -0,0 +1,4 @@ +packages: ./ + +package WithProject + ghc-options: -haddock diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.out b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.out new file mode 100644 index 00000000000..b600e6ad2e4 --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.out @@ -0,0 +1,10 @@ +# cabal build +Resolving dependencies... +Build profile: -w ghc- -O1 +In order, the following will be built: + - WithProject-0.1.0.0 (lib) (first run) +Configuring library for WithProject-0.1.0.0... +Preprocessing library for WithProject-0.1.0.0... +Building library for WithProject-0.1.0.0... +# show-build-info WithProject lib +{"cabal-lib-version":"","compiler":{"flavour":"ghc","compiler-id":"ghc-","path":""},"components":[{"type":"lib","name":"lib","unit-id":"WithProject-0.1.0.0-inplace","compiler-args":["-fbuilding-cabal-package","-O","-outputdir","with-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-odir","with-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-hidir","with-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-stubdir","with-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-i","-i.","-iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build/autogen","-iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build/global-autogen","-Iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build/autogen","-Iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build/global-autogen","-Iwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build","-optP-include","-optPwith-project.dist/work/./dist/build//ghc-/WithProject-0.1.0.0/build/autogen/cabal_macros.h","-this-unit-id","WithProject-0.1.0.0-inplace","-hide-all-packages","-Wmissing-home-modules","-no-user-package-db","-package-db","/with-project.dist/home/.cabal/store/ghc-/package.db","-package-db","/with-project.dist/work/./dist/packagedb/ghc-","-package-id","","-XHaskell2010","-Wall"],"modules":["Lib"],"src-files":[],"hs-src-dirs":["."],"src-dir":"/","cabal-file":"WithProject.cabal"}]} diff --git a/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.test.hs b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.test.hs new file mode 100644 index 00000000000..442674e756e --- /dev/null +++ b/cabal-testsuite/PackageTests/ShowBuildInfo/WithProject/with-project.test.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE OverloadedStrings #-} +import Test.Cabal.Prelude +import Test.Cabal.DecodeShowBuildInfo + +main = cabalTest $ do + runShowBuildInfo ["lib:WithProject"] + withPlan $ do + recordBuildInfo "WithProject" mainLib + assertComponent "WithProject" mainLib defCompAssertion + { compilerArgsPred = ("-Wall" `elem`) -- added by 'WithProject.cabal' + , modules = ["Lib"] + , sourceDirs = ["."] + } + + -- See #9927 + assertComponent "WithProject" mainLib defCompAssertion + { compilerArgsPred = ("-haddock" `notElem`) -- added by 'cabal.project', but not present + , modules = ["Lib"] + , sourceDirs = ["."] + } +