From 413bb8332f090bb002dfcb3af194756b16e66975 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9ana=20=E6=B1=9F?= Date: Tue, 28 Oct 2025 21:29:45 +0800 Subject: [PATCH] feat: defer merging of common stanza imports proof of concept retain imports for foreignLib section retain imports for executable section retain imports for test-suite retain imports for benchmark attempt to insert used imports and not all imports use newtype change import data type; fix issues with import propagation & decoration fix missing import names in testSuite fix missing import names in benchmark run fourmolu run hlint defer merging prototype Currently we have achieve the following: - Stop merging, the merging function "endo" is id - CondTree are completly retained in bigger types such as libarry and executable We will need to do the following: - Allow merging in the accessor We broke: - A bunch of Read and Ord instances Revert "defer merging prototype" This reverts commit 21636db8b0acfc1cf87119d6900552994b243013. stop merging retain common stanza in GenericPackageDescription experiment: use WithImport in gpd add function to merge imports mergeLibrary fix transitive imports retaintion and merging run fourmolu deferred merging for sublibraries simplification; remove todos retain foreignlib imports retain executable imports retain TestSuiteStanza imports We isolated the type TestSuiteStanza and the logic to infer test type retain BenchmarkStanza imports We isolated the BenchmarkStanza type and the logic to infer benchmark type. clean up remove benchmark import field We now use the WithImports type to tag imports introduce type alias in GenericPackageDescription add GenericPackageDescription pattern to hide internal implementation backward compatible accessors fix compiler errors add todo fix compiler errors for integration test run fourmolu don't expose intemediary accessors remove early experiment "import" fields in TestSuite and Benchmark move TestSuiteStanza validation to its module clean up {TestSuite,Benchmark}Stanza exports from FieldGrammar restore old behaviour in code working with PackageDescription we fixed GenericPackageDescription's constructor patch {TestSuite,Benchmark}Stanza type when using accessor remove accessors tests fix accessor dropping common stanza map when non it is not required This guarantees that unmerged internal representation is correct run fourmolu remove FieldGrammar export {TestSuite,Benchmark}Stanza fix(GenericPackageDescription): "pattern" keyword deprecated after 914 test: remove new test files test: add tests for gpd accessors test: check equality on each field test: improve import list test: use @? operator test: use a tuple to store all gpd fields test: define ToExpr tuple instance manually test: update expected test: use Rec constructor to annotate field names test: update expected test: remove comment not in scope for this PR test: use field equality in hackage tests test: add new test files test: fix test build test: newtype to guide GPD ToExpr instance test: add internal accessors test test: update expected for internal accessors test test: update expected test: fix hackage tests ToExpr instance --- Cabal-syntax/Cabal-syntax.cabal | 4 + .../src/Distribution/PackageDescription.hs | 8 + .../PackageDescription/FieldGrammar.hs | 232 ---------- .../Distribution/PackageDescription/Parsec.hs | 204 ++++----- .../PackageDescription/PrettyPrint.hs | 5 +- .../src/Distribution/Types/BenchmarkStanza.hs | 135 ++++++ .../src/Distribution/Types/CondTree.hs | 21 + .../Types/GenericPackageDescription.hs | 367 +++++++++++++-- .../Types/GenericPackageDescription/Lens.hs | 77 +++- .../src/Distribution/Types/Imports.hs | 25 + .../src/Distribution/Types/Imports/Lens.hs | 21 + .../src/Distribution/Types/TestSuiteStanza.hs | 160 +++++++ Cabal-tests/tests/HackageTests.hs | 43 +- Cabal-tests/tests/NoThunks.hs | 4 + Cabal-tests/tests/ParserTests.hs | 102 ++++- .../accessors/library-merging.cabal | 30 ++ .../accessors/library-merging.expr | 429 ++++++++++++++++++ .../ParserTests/regressions/Octree-0.5.expr | 8 +- .../ParserTests/regressions/anynone.expr | 4 +- .../ParserTests/regressions/big-version.expr | 4 +- .../regressions/common-conditional.expr | 18 +- .../tests/ParserTests/regressions/common.expr | 6 +- .../ParserTests/regressions/common2.expr | 18 +- .../ParserTests/regressions/common3.expr | 6 +- .../tests/ParserTests/regressions/elif.expr | 6 +- .../tests/ParserTests/regressions/elif2.expr | 12 +- .../ParserTests/regressions/encoding-0.8.expr | 4 +- .../ParserTests/regressions/generics-sop.expr | 16 +- .../ParserTests/regressions/hasktorch.expr | 38 +- .../regressions/hidden-main-lib.expr | 4 +- .../ParserTests/regressions/indentation.expr | 4 +- .../ParserTests/regressions/indentation2.expr | 4 +- .../ParserTests/regressions/indentation3.expr | 4 +- .../ParserTests/regressions/issue-5055.expr | 8 +- .../ParserTests/regressions/issue-5846.expr | 4 +- .../ParserTests/regressions/issue-6083-a.expr | 10 +- .../ParserTests/regressions/issue-6083-b.expr | 10 +- .../ParserTests/regressions/issue-6083-c.expr | 6 +- .../regressions/issue-6083-pkg-pkg.expr | 4 +- .../ParserTests/regressions/issue-774.expr | 4 +- .../regressions/jaeger-flamegraph.expr | 8 +- .../regressions/leading-comma-2.expr | 4 +- .../regressions/leading-comma.expr | 4 +- .../tests/ParserTests/regressions/libpq1.expr | 18 +- .../tests/ParserTests/regressions/libpq2.expr | 18 +- .../ParserTests/regressions/mixin-1.expr | 4 +- .../ParserTests/regressions/mixin-2.expr | 4 +- .../ParserTests/regressions/mixin-3.expr | 4 +- .../ParserTests/regressions/monad-param.expr | 4 +- .../regressions/multiple-libs-2.expr | 6 +- .../ParserTests/regressions/noVersion.expr | 4 +- .../regressions/nothing-unicode.expr | 6 +- .../tests/ParserTests/regressions/shake.expr | 44 +- .../tests/ParserTests/regressions/spdx-1.expr | 4 +- .../tests/ParserTests/regressions/spdx-2.expr | 4 +- .../tests/ParserTests/regressions/spdx-3.expr | 4 +- .../regressions/supervisors-0.1.cabal | 68 +++ .../regressions/supervisors-0.1.expr | 330 ++++++++++++++ .../regressions/supervisors-0.1.format | 65 +++ .../regressions/th-lift-instances.expr | 10 +- .../ParserTests/regressions/version-sets.expr | 4 +- .../regressions/wl-pprint-indef.expr | 6 +- .../Distribution/Utils/Structured.hs | 2 +- .../tests/custom-setup/CabalDoctestSetup.hs | 4 +- .../src/Data/TreeDiff/Instances/Cabal.hs | 77 +++- .../Solver/Modular/IndexConversion.hs | 2 +- .../src/Distribution/Client/IndexUtils.hs | 11 + .../src/Distribution/Client/Install.hs | 4 +- .../src/Distribution/Client/ScriptUtils.hs | 1 + .../src/Distribution/Client/SetupWrapper.hs | 2 +- 70 files changed, 2184 insertions(+), 611 deletions(-) create mode 100644 Cabal-syntax/src/Distribution/Types/BenchmarkStanza.hs create mode 100644 Cabal-syntax/src/Distribution/Types/Imports.hs create mode 100644 Cabal-syntax/src/Distribution/Types/Imports/Lens.hs create mode 100644 Cabal-syntax/src/Distribution/Types/TestSuiteStanza.hs create mode 100644 Cabal-tests/tests/ParserTests/accessors/library-merging.cabal create mode 100644 Cabal-tests/tests/ParserTests/accessors/library-merging.expr create mode 100644 Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.cabal create mode 100644 Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.expr create mode 100644 Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.format diff --git a/Cabal-syntax/Cabal-syntax.cabal b/Cabal-syntax/Cabal-syntax.cabal index 85137dc147c..09edee0eced 100644 --- a/Cabal-syntax/Cabal-syntax.cabal +++ b/Cabal-syntax/Cabal-syntax.cabal @@ -121,6 +121,7 @@ library Distribution.Types.AbiDependency Distribution.Types.AbiHash Distribution.Types.Benchmark + Distribution.Types.BenchmarkStanza Distribution.Types.Benchmark.Lens Distribution.Types.BenchmarkInterface Distribution.Types.BenchmarkType @@ -160,6 +161,8 @@ library Distribution.Types.Library.Lens Distribution.Types.LibraryName Distribution.Types.LibraryVisibility + Distribution.Types.Imports + Distribution.Types.Imports.Lens Distribution.Types.MissingDependency Distribution.Types.MissingDependencyReason Distribution.Types.Mixin @@ -183,6 +186,7 @@ library Distribution.Types.SourceRepo Distribution.Types.SourceRepo.Lens Distribution.Types.TestSuite + Distribution.Types.TestSuiteStanza Distribution.Types.TestSuite.Lens Distribution.Types.TestSuiteInterface Distribution.Types.TestType diff --git a/Cabal-syntax/src/Distribution/PackageDescription.hs b/Cabal-syntax/src/Distribution/PackageDescription.hs index 47d46673e5f..bda173bd969 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription.hs @@ -15,6 +15,9 @@ module Distribution.PackageDescription module Distribution.Types.PackageDescription , module Distribution.Types.GenericPackageDescription + -- * Working with Imports + , module Distribution.Types.Imports + -- * Components , module Distribution.Types.ComponentName @@ -29,11 +32,13 @@ module Distribution.PackageDescription -- ** TestSuite , module Distribution.Types.TestSuite + , module Distribution.Types.TestSuiteStanza , module Distribution.Types.TestType , module Distribution.Types.TestSuiteInterface -- ** Benchmark , module Distribution.Types.Benchmark + , module Distribution.Types.BenchmarkStanza , module Distribution.Types.BenchmarkType , module Distribution.Types.BenchmarkInterface @@ -88,6 +93,7 @@ import Prelude () import Distribution.Types.Benchmark import Distribution.Types.BenchmarkInterface +import Distribution.Types.BenchmarkStanza import Distribution.Types.BenchmarkType import Distribution.Types.BuildInfo import Distribution.Types.BuildType @@ -105,6 +111,7 @@ import Distribution.Types.ForeignLibOption import Distribution.Types.ForeignLibType import Distribution.Types.GenericPackageDescription import Distribution.Types.HookedBuildInfo +import Distribution.Types.Imports import Distribution.Types.IncludeRenaming import Distribution.Types.LegacyExeDependency import Distribution.Types.Library @@ -124,5 +131,6 @@ import Distribution.Types.SetupBuildInfo import Distribution.Types.SourceRepo import Distribution.Types.TestSuite import Distribution.Types.TestSuiteInterface +import Distribution.Types.TestSuiteStanza import Distribution.Types.TestType import Distribution.Types.UnqualComponentName diff --git a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs index 24861389b8f..f08db2bc58f 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs @@ -22,22 +22,10 @@ module Distribution.PackageDescription.FieldGrammar , executableFieldGrammar -- * Test suite - , TestSuiteStanza (..) , testSuiteFieldGrammar - , validateTestSuite - , unvalidateTestSuite - - -- ** Lenses - , testStanzaTestType - , testStanzaMainIs - , testStanzaTestModule - , testStanzaBuildInfo -- * Benchmark - , BenchmarkStanza (..) , benchmarkFieldGrammar - , validateBenchmark - , unvalidateBenchmark -- * Field grammars , formatDependencyList @@ -48,12 +36,6 @@ module Distribution.PackageDescription.FieldGrammar , formatOtherExtensions , formatOtherModules - -- ** Lenses - , benchmarkStanzaBenchmarkType - , benchmarkStanzaMainIs - , benchmarkStanzaBenchmarkModule - , benchmarkStanzaBuildInfo - -- * Flag , flagFieldGrammar @@ -290,43 +272,6 @@ executableFieldGrammar n = {-# SPECIALIZE executableFieldGrammar :: UnqualComponentName -> ParsecFieldGrammar' Executable #-} {-# SPECIALIZE executableFieldGrammar :: UnqualComponentName -> PrettyFieldGrammar' Executable #-} -------------------------------------------------------------------------------- --- TestSuite -------------------------------------------------------------------------------- - --- | An intermediate type just used for parsing the test-suite stanza. --- After validation it is converted into the proper 'TestSuite' type. -data TestSuiteStanza = TestSuiteStanza - { _testStanzaTestType :: Maybe TestType - , _testStanzaMainIs :: Maybe (RelativePath Source File) - , _testStanzaTestModule :: Maybe ModuleName - , _testStanzaBuildInfo :: BuildInfo - , _testStanzaCodeGenerators :: [String] - } - -instance L.HasBuildInfo TestSuiteStanza where - buildInfo = testStanzaBuildInfo - -testStanzaTestType :: Lens' TestSuiteStanza (Maybe TestType) -testStanzaTestType f s = fmap (\x -> s{_testStanzaTestType = x}) (f (_testStanzaTestType s)) -{-# INLINE testStanzaTestType #-} - -testStanzaMainIs :: Lens' TestSuiteStanza (Maybe (RelativePath Source File)) -testStanzaMainIs f s = fmap (\x -> s{_testStanzaMainIs = x}) (f (_testStanzaMainIs s)) -{-# INLINE testStanzaMainIs #-} - -testStanzaTestModule :: Lens' TestSuiteStanza (Maybe ModuleName) -testStanzaTestModule f s = fmap (\x -> s{_testStanzaTestModule = x}) (f (_testStanzaTestModule s)) -{-# INLINE testStanzaTestModule #-} - -testStanzaBuildInfo :: Lens' TestSuiteStanza BuildInfo -testStanzaBuildInfo f s = fmap (\x -> s{_testStanzaBuildInfo = x}) (f (_testStanzaBuildInfo s)) -{-# INLINE testStanzaBuildInfo #-} - -testStanzaCodeGenerators :: Lens' TestSuiteStanza [String] -testStanzaCodeGenerators f s = fmap (\x -> s{_testStanzaCodeGenerators = x}) (f (_testStanzaCodeGenerators s)) -{-# INLINE testStanzaCodeGenerators #-} - testSuiteFieldGrammar :: ( FieldGrammar c g , Applicative (g TestSuiteStanza) @@ -361,117 +306,10 @@ testSuiteFieldGrammar = <*> monoidalFieldAla "code-generators" (alaList' CommaFSep Token) testStanzaCodeGenerators ^^^ availableSince CabalSpecV3_8 [] -validateTestSuite :: CabalSpecVersion -> Position -> TestSuiteStanza -> ParseResult src TestSuite -validateTestSuite cabalSpecVersion pos stanza = case testSuiteType of - Nothing -> pure basicTestSuite - Just tt@(TestTypeUnknown _ _) -> - pure - basicTestSuite - { testInterface = TestSuiteUnsupported tt - } - Just tt - | tt `notElem` knownTestTypes -> - pure - basicTestSuite - { testInterface = TestSuiteUnsupported tt - } - Just tt@(TestTypeExe ver) -> case _testStanzaMainIs stanza of - Nothing -> do - parseFailure pos (missingField "main-is" tt) - pure emptyTestSuite - Just file -> do - when (isJust (_testStanzaTestModule stanza)) $ - parseWarning pos PWTExtraBenchmarkModule (extraField "test-module" tt) - pure - basicTestSuite - { testInterface = TestSuiteExeV10 ver file - } - Just tt@(TestTypeLib ver) -> case _testStanzaTestModule stanza of - Nothing -> do - parseFailure pos (missingField "test-module" tt) - pure emptyTestSuite - Just module_ -> do - when (isJust (_testStanzaMainIs stanza)) $ - parseWarning pos PWTExtraMainIs (extraField "main-is" tt) - pure - basicTestSuite - { testInterface = TestSuiteLibV09 ver module_ - } - where - testSuiteType = - _testStanzaTestType stanza - <|> do - guard (cabalSpecVersion >= CabalSpecV3_8) - - testTypeExe <$ _testStanzaMainIs stanza - <|> testTypeLib <$ _testStanzaTestModule stanza - - missingField name tt = - "The '" - ++ name - ++ "' field is required for the " - ++ prettyShow tt - ++ " test suite type." - - extraField name tt = - "The '" - ++ name - ++ "' field is not used for the '" - ++ prettyShow tt - ++ "' test suite type." - basicTestSuite = - emptyTestSuite - { testBuildInfo = _testStanzaBuildInfo stanza - , testCodeGenerators = _testStanzaCodeGenerators stanza - } - -unvalidateTestSuite :: TestSuite -> TestSuiteStanza -unvalidateTestSuite t = - TestSuiteStanza - { _testStanzaTestType = ty - , _testStanzaMainIs = ma - , _testStanzaTestModule = mo - , _testStanzaBuildInfo = testBuildInfo t - , _testStanzaCodeGenerators = testCodeGenerators t - } - where - (ty, ma, mo) = case testInterface t of - TestSuiteExeV10 ver file -> (Just $ TestTypeExe ver, Just file, Nothing) - TestSuiteLibV09 ver modu -> (Just $ TestTypeLib ver, Nothing, Just modu) - _ -> (Nothing, Nothing, Nothing) - ------------------------------------------------------------------------------- -- Benchmark ------------------------------------------------------------------------------- --- | An intermediate type just used for parsing the benchmark stanza. --- After validation it is converted into the proper 'Benchmark' type. -data BenchmarkStanza = BenchmarkStanza - { _benchmarkStanzaBenchmarkType :: Maybe BenchmarkType - , _benchmarkStanzaMainIs :: Maybe (RelativePath Source File) - , _benchmarkStanzaBenchmarkModule :: Maybe ModuleName - , _benchmarkStanzaBuildInfo :: BuildInfo - } - -instance L.HasBuildInfo BenchmarkStanza where - buildInfo = benchmarkStanzaBuildInfo - -benchmarkStanzaBenchmarkType :: Lens' BenchmarkStanza (Maybe BenchmarkType) -benchmarkStanzaBenchmarkType f s = fmap (\x -> s{_benchmarkStanzaBenchmarkType = x}) (f (_benchmarkStanzaBenchmarkType s)) -{-# INLINE benchmarkStanzaBenchmarkType #-} - -benchmarkStanzaMainIs :: Lens' BenchmarkStanza (Maybe (RelativePath Source File)) -benchmarkStanzaMainIs f s = fmap (\x -> s{_benchmarkStanzaMainIs = x}) (f (_benchmarkStanzaMainIs s)) -{-# INLINE benchmarkStanzaMainIs #-} - -benchmarkStanzaBenchmarkModule :: Lens' BenchmarkStanza (Maybe ModuleName) -benchmarkStanzaBenchmarkModule f s = fmap (\x -> s{_benchmarkStanzaBenchmarkModule = x}) (f (_benchmarkStanzaBenchmarkModule s)) -{-# INLINE benchmarkStanzaBenchmarkModule #-} - -benchmarkStanzaBuildInfo :: Lens' BenchmarkStanza BuildInfo -benchmarkStanzaBuildInfo f s = fmap (\x -> s{_benchmarkStanzaBuildInfo = x}) (f (_benchmarkStanzaBuildInfo s)) -{-# INLINE benchmarkStanzaBuildInfo #-} - benchmarkFieldGrammar :: ( FieldGrammar c g , Applicative (g BenchmarkStanza) @@ -503,76 +341,6 @@ benchmarkFieldGrammar = <*> optionalField "benchmark-module" benchmarkStanzaBenchmarkModule <*> blurFieldGrammar benchmarkStanzaBuildInfo buildInfoFieldGrammar -validateBenchmark :: CabalSpecVersion -> Position -> BenchmarkStanza -> ParseResult src Benchmark -validateBenchmark cabalSpecVersion pos stanza = case benchmarkStanzaType of - Nothing -> - pure - emptyBenchmark - { benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza - } - Just tt@(BenchmarkTypeUnknown _ _) -> - pure - emptyBenchmark - { benchmarkInterface = BenchmarkUnsupported tt - , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza - } - Just tt - | tt `notElem` knownBenchmarkTypes -> - pure - emptyBenchmark - { benchmarkInterface = BenchmarkUnsupported tt - , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza - } - Just tt@(BenchmarkTypeExe ver) -> case _benchmarkStanzaMainIs stanza of - Nothing -> do - parseFailure pos (missingField "main-is" tt) - pure emptyBenchmark - Just file -> do - when (isJust (_benchmarkStanzaBenchmarkModule stanza)) $ - parseWarning pos PWTExtraBenchmarkModule (extraField "benchmark-module" tt) - pure - emptyBenchmark - { benchmarkInterface = BenchmarkExeV10 ver file - , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza - } - where - benchmarkStanzaType = - _benchmarkStanzaBenchmarkType stanza <|> do - guard (cabalSpecVersion >= CabalSpecV3_8) - - benchmarkTypeExe <$ _benchmarkStanzaMainIs stanza - - missingField name tt = - "The '" - ++ name - ++ "' field is required for the " - ++ prettyShow tt - ++ " benchmark type." - - extraField name tt = - "The '" - ++ name - ++ "' field is not used for the '" - ++ prettyShow tt - ++ "' benchmark type." - -unvalidateBenchmark :: Benchmark -> BenchmarkStanza -unvalidateBenchmark b = - BenchmarkStanza - { _benchmarkStanzaBenchmarkType = ty - , _benchmarkStanzaMainIs = ma - , _benchmarkStanzaBenchmarkModule = mo - , _benchmarkStanzaBuildInfo = benchmarkBuildInfo b - } - where - (ty, ma, mo) = case benchmarkInterface b of - BenchmarkExeV10 ver ma' - | getSymbolicPath ma' == "" -> - (Just $ BenchmarkTypeExe ver, Nothing, Nothing) - | otherwise -> - (Just $ BenchmarkTypeExe ver, Just ma', Nothing) - _ -> (Nothing, Nothing, Nothing) - ------------------------------------------------------------------------------- -- Build info ------------------------------------------------------------------------------- diff --git a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs index c7e327ddb7f..4b605c93268 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/Parsec.hs @@ -63,8 +63,6 @@ import qualified Data.Set as Set import qualified Distribution.Compat.Newtype as Newtype import qualified Distribution.Compat.NonEmptySet as NES import qualified Distribution.Types.BuildInfo.Lens as L -import qualified Distribution.Types.Executable.Lens as L -import qualified Distribution.Types.ForeignLib.Lens as L import qualified Distribution.Types.GenericPackageDescription.Lens as L import qualified Distribution.Types.PackageDescription.Lens as L import qualified Distribution.Types.SetupBuildInfo.Lens as L @@ -129,14 +127,14 @@ type SectionParser src = StateT SectionS (ParseResult src) -- | State of section parser data SectionS = SectionS { _stateGpd :: !GenericPackageDescription - , _stateCommonStanzas :: !(Map String CondTreeBuildInfo) + , _stateCommonStanzas :: !(Map String CondTreeBuildInfoWithImports) } stateGpd :: Lens' SectionS GenericPackageDescription stateGpd f (SectionS gpd cs) = (\x -> SectionS x cs) <$> f gpd {-# INLINE stateGpd #-} -stateCommonStanzas :: Lens' SectionS (Map String CondTreeBuildInfo) +stateCommonStanzas :: Lens' SectionS (Map String CondTreeBuildInfoWithImports) stateCommonStanzas f (SectionS gpd cs) = SectionS gpd <$> f cs {-# INLINE stateCommonStanzas #-} @@ -240,9 +238,15 @@ parseGenericPackageDescription' scannedVer lexWarnings utf8WarnPos fs = do cabalFormatVersionsDesc :: String cabalFormatVersionsDesc = "Current cabal-version values are listed at https://cabal.readthedocs.io/en/stable/file-format-changelog.html." -goSections :: CabalSpecVersion -> [Field Position] -> SectionParser src () -goSections specVer = traverse_ process +goSections :: forall src. CabalSpecVersion -> [Field Position] -> SectionParser src () +goSections specVer fieldPositions = do + traverse_ process fieldPositions + + -- Retain commen stanzas after parsing sections + commonStanzas <- use stateCommonStanzas + (stateGpd . L.gpdCommonStanzas) .= commonStanzas where + process :: Field Position -> SectionParser src () process (Field (Name pos name) _) = lift $ parseWarning pos PWTTrailingFields $ @@ -259,11 +263,10 @@ goSections specVer = traverse_ process :: L.HasBuildInfo a => ParsecFieldGrammar' a -- \^ grammar - -> (BuildInfo -> a) - -> Map String CondTreeBuildInfo + -> Map String CondTreeBuildInfoWithImports -- \^ common stanzas -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) + -> ParseResult src (CondTree ConfVar [Dependency] (WithImports a)) parseCondTree' = parseCondTreeWithCommonStanzas specVer parseSection :: Name Position -> [SectionArg Position] -> [Field Position] -> SectionParser src () @@ -274,8 +277,7 @@ goSections specVer = traverse_ process | name == "common" = do commonStanzas <- use stateCommonStanzas name' <- lift $ parseCommonName pos args - biTree <- lift $ parseCondTree' buildInfoFieldGrammar id commonStanzas fields - + biTree <- lift $ parseCondTree' buildInfoFieldGrammar commonStanzas fields case Map.lookup name' commonStanzas of Nothing -> stateCommonStanzas .= Map.insert name' biTree commonStanzas Just _ -> @@ -283,18 +285,18 @@ goSections specVer = traverse_ process parseFailure pos $ "Duplicate common stanza: " ++ name' | name == "library" && null args = do - prev <- use $ stateGpd . L.condLibrary + prev <- use $ stateGpd . L.condLibraryUnmerged when (isJust prev) $ lift $ parseFailure pos $ "Multiple main libraries; have you forgotten to specify a name for an internal library?" commonStanzas <- use stateCommonStanzas - let name'' = LMainLibName - lib <- lift $ parseCondTree' (libraryFieldGrammar name'') (libraryFromBuildInfo name'') commonStanzas fields + let name' = LMainLibName + lib <- lift $ parseCondTree' (libraryFieldGrammar name') commonStanzas fields -- -- TODO check that not set - stateGpd . L.condLibrary ?= lib + stateGpd . L.condLibraryUnmerged ?= lib -- Sublibraries -- TODO: check cabal-version @@ -302,18 +304,18 @@ goSections specVer = traverse_ process commonStanzas <- use stateCommonStanzas name' <- parseUnqualComponentName pos args let name'' = LSubLibName name' - lib <- lift $ parseCondTree' (libraryFieldGrammar name'') (libraryFromBuildInfo name'') commonStanzas fields + lib <- lift $ parseCondTree' (libraryFieldGrammar name'') commonStanzas fields -- TODO check duplicate name here? - stateGpd . L.condSubLibraries %= snoc (name', lib) + stateGpd . L.condSubLibrariesUnmerged %= snoc (name', lib) -- TODO: check cabal-version | name == "foreign-library" = do commonStanzas <- use stateCommonStanzas name' <- parseUnqualComponentName pos args - flib <- lift $ parseCondTree' (foreignLibFieldGrammar name') (fromBuildInfo' name') commonStanzas fields + flib <- lift $ parseCondTree' (foreignLibFieldGrammar name') commonStanzas fields let hasType ts = foreignLibType ts /= foreignLibType mempty - unless (onAllBranches hasType flib) $ + unless (onAllBranches hasType (mapTreeData unImportNames flib)) $ lift $ parseFailure pos $ concat @@ -325,21 +327,28 @@ goSections specVer = traverse_ process ] -- TODO check duplicate name here? - stateGpd . L.condForeignLibs %= snoc (name', flib) + stateGpd . L.condForeignLibsUnmerged %= snoc (name', flib) | name == "executable" = do commonStanzas <- use stateCommonStanzas name' <- parseUnqualComponentName pos args - exe <- lift $ parseCondTree' (executableFieldGrammar name') (fromBuildInfo' name') commonStanzas fields + exe <- lift $ parseCondTree' (executableFieldGrammar name') commonStanzas fields -- TODO check duplicate name here? - stateGpd . L.condExecutables %= snoc (name', exe) + stateGpd . L.condExecutablesUnmerged %= snoc (name', exe) | name == "test-suite" = do commonStanzas <- use stateCommonStanzas name' <- parseUnqualComponentName pos args - testStanza <- lift $ parseCondTree' testSuiteFieldGrammar (fromBuildInfo' name') commonStanzas fields - testSuite <- lift $ traverse (validateTestSuite specVer pos) testStanza + testStanza <- lift $ parseCondTree' testSuiteFieldGrammar commonStanzas fields + + -- Patching depends on merging, validation depends on patching + let testStanza' :: CondTree ConfVar [Dependency] TestSuiteStanza + testStanza' = + mergeTestSuiteStanza commonStanzas testStanza + & fmap (patchTestSuiteType specVer) + _ok <- lift $ traverse (validateTestSuite pos) testStanza' + let validated = mapTreeData convertTestSuite testStanza' let hasType ts = testInterface ts /= testInterface mempty - unless (onAllBranches hasType testSuite) $ + unless (onAllBranches hasType validated) $ lift $ parseFailure pos $ concat @@ -359,15 +368,23 @@ goSections specVer = traverse_ process ] -- TODO check duplicate name here? - stateGpd . L.condTestSuites %= snoc (name', testSuite) + -- Store the unmerged unvalidated version + stateGpd . L.condTestSuitesUnmerged %= snoc (name', testStanza) | name == "benchmark" = do commonStanzas <- use stateCommonStanzas name' <- parseUnqualComponentName pos args - benchStanza <- lift $ parseCondTree' benchmarkFieldGrammar (fromBuildInfo' name') commonStanzas fields - bench <- lift $ traverse (validateBenchmark specVer pos) benchStanza + benchStanza <- lift $ parseCondTree' benchmarkFieldGrammar commonStanzas fields + + -- Patching depends on merging, validation depends on patching + let benchStanza' :: CondTree ConfVar [Dependency] BenchmarkStanza + benchStanza' = + mergeBenchmarkStanza commonStanzas benchStanza + & fmap (patchBenchmarkType specVer) + _ok <- lift $ traverse (validateBenchmark pos . unImportNames) benchStanza + let validated = mapTreeData convertBenchmark benchStanza' let hasType ts = benchmarkInterface ts /= benchmarkInterface mempty - unless (onAllBranches hasType bench) $ + unless (onAllBranches hasType validated) $ lift $ parseFailure pos $ concat @@ -387,7 +404,7 @@ goSections specVer = traverse_ process ] -- TODO check duplicate name here? - stateGpd . L.condBenchmarks %= snoc (name', bench) + stateGpd . L.condBenchmarksUnmerged %= snoc (name', benchStanza) | name == "flag" = do name' <- parseNameBS pos args name'' <- lift $ runFieldParser' [pos] parsec specVer (fieldLineStreamFromBS name') `recoverWith` mkFlagName "" @@ -469,34 +486,32 @@ warnInvalidSubsection (MkSection (Name pos name) _ _) = parseCondTree :: forall src a - . L.HasBuildInfo a - => CabalSpecVersion + . CabalSpecVersion -> HasElif -- ^ accept @elif@ -> ParsecFieldGrammar' a -- ^ grammar - -> Map String CondTreeBuildInfo + -> Map String CondTreeBuildInfoWithImports -- ^ common stanzas - -> (BuildInfo -> a) - -- ^ constructor from buildInfo -> (a -> [Dependency]) -- ^ condition extractor -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) -parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go + -> ParseResult src (CondTree ConfVar [Dependency] (WithImports a)) +parseCondTree v hasElif grammar commonStanzas cond = go where + go :: [Field Position] -> ParseResult src (CondTree ConfVar [Dependency] (WithImports a)) go fields0 = do - (fields, endo) <- + (fields, imports) <- if v >= CabalSpecV3_0 - then processImports v fromBuildInfo commonStanzas fields0 - else traverse (warnImport v) fields0 >>= \fields1 -> return (catMaybes fields1, id) + then processImports v commonStanzas fields0 + else traverse (warnImport v) fields0 >>= \fields1 -> return (catMaybes fields1, mempty) let (fs, ss) = partitionFields fields x <- parseFieldGrammar v fs grammar branches <- concat <$> traverse parseIfs ss - return $ endo $ CondNode x (cond x) branches + return $ CondNode (WithImports imports x) (cond x) branches - parseIfs :: [Section Position] -> ParseResult src [CondBranch ConfVar [Dependency] a] + parseIfs :: [Section Position] -> ParseResult src [CondBranch ConfVar [Dependency] (WithImports a)] parseIfs [] = return [] parseIfs (MkSection (Name pos name) test fields : sections) | name == "if" = do test' <- parseConditionConfVar (startOfSection (incPos 2 pos) test) test @@ -509,7 +524,7 @@ parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go parseElseIfs :: [Section Position] - -> ParseResult src (Maybe (CondTree ConfVar [Dependency] a), [CondBranch ConfVar [Dependency] a]) + -> ParseResult src (Maybe (CondTree ConfVar [Dependency] (WithImports a)), [CondBranch ConfVar [Dependency] (WithImports a)]) parseElseIfs [] = return (Nothing, []) parseElseIfs (MkSection (Name pos name) args fields : sections) | name == "else" = do unless (null args) $ @@ -526,7 +541,7 @@ parseCondTree v hasElif grammar commonStanzas fromBuildInfo cond = go (elseFields, sections') <- parseElseIfs sections -- we parse an empty 'Fields', to get empty value for a node a <- parseFieldGrammar v mempty grammar - return (Just $ CondNode a (cond a) [CondBranch test' fields' elseFields], sections') + return (Just $ CondNode (noImports a) (cond a) [CondBranch test' fields' elseFields], sections') parseElseIfs (MkSection (Name pos name) _ _ : sections) | name == "elif" = do parseWarning pos PWTInvalidSubsection $ "invalid subsection \"elif\". You should set cabal-version: 2.2 or larger to use elif-conditionals." (,) Nothing <$> parseIfs sections @@ -594,36 +609,7 @@ with new AST, this all need to be rewritten. -- The approach is simple, and have good properties: -- -- * Common stanzas are parsed exactly once, even if not-used. Thus we report errors in them. -type CondTreeBuildInfo = CondTree ConfVar [Dependency] BuildInfo - --- | Create @a@ from 'BuildInfo'. --- This class is used to implement common stanza parsing. --- --- Law: @view buildInfo . fromBuildInfo = id@ --- --- This takes name, as 'FieldGrammar's take names too. -class L.HasBuildInfo a => FromBuildInfo a where - fromBuildInfo' :: UnqualComponentName -> BuildInfo -> a - -libraryFromBuildInfo :: LibraryName -> BuildInfo -> Library -libraryFromBuildInfo n bi = - emptyLibrary - { libName = n - , libVisibility = case n of - LMainLibName -> LibraryVisibilityPublic - LSubLibName _ -> LibraryVisibilityPrivate - , libBuildInfo = bi - } - -instance FromBuildInfo BuildInfo where fromBuildInfo' _ = id -instance FromBuildInfo ForeignLib where fromBuildInfo' n bi = set L.foreignLibName n $ set L.buildInfo bi emptyForeignLib -instance FromBuildInfo Executable where fromBuildInfo' n bi = set L.exeName n $ set L.buildInfo bi emptyExecutable - -instance FromBuildInfo TestSuiteStanza where - fromBuildInfo' _ bi = TestSuiteStanza Nothing Nothing Nothing bi [] - -instance FromBuildInfo BenchmarkStanza where - fromBuildInfo' _ bi = BenchmarkStanza Nothing Nothing Nothing bi +type CondTreeBuildInfoWithImports = CondTree ConfVar [Dependency] (WithImports BuildInfo) parseCondTreeWithCommonStanzas :: forall src a @@ -631,36 +617,44 @@ parseCondTreeWithCommonStanzas => CabalSpecVersion -> ParsecFieldGrammar' a -- ^ grammar - -> (BuildInfo -> a) - -- ^ construct fromBuildInfo - -> Map String CondTreeBuildInfo + -> Map String CondTreeBuildInfoWithImports -- ^ common stanzas -> [Field Position] - -> ParseResult src (CondTree ConfVar [Dependency] a) -parseCondTreeWithCommonStanzas v grammar fromBuildInfo commonStanzas fields = do - (fields', endo) <- processImports v fromBuildInfo commonStanzas fields - x <- parseCondTree v hasElif grammar commonStanzas fromBuildInfo (view L.targetBuildDepends) fields' - return (endo x) + -> ParseResult src (CondTree ConfVar [Dependency] (WithImports a)) +parseCondTreeWithCommonStanzas v grammar commonStanzas fields = do + (fields', imports) <- processImports v commonStanzas fields + x <- parseCondTree v hasElif grammar commonStanzas (view L.targetBuildDepends) fields' + -- We replace the imports from parseCondTree, because it comes right after + -- the import processing and hence is always empty, if such imports should + -- exist in the grammar, that is >= cabal 3.0. + return (replaceImportsOnRoot imports x) where hasElif = specHasElif v +-- | only attach import annotation on root +replaceImportsOnRoot + :: [ImportName] + -> CondTree v c (WithImports a) + -> CondTree v c (WithImports a) +replaceImportsOnRoot imports = mapTreeData' (WithImports imports . unImportNames) id + processImports - :: forall src a - . L.HasBuildInfo a - => CabalSpecVersion - -> (BuildInfo -> a) - -- ^ construct fromBuildInfo - -> Map String CondTreeBuildInfo + :: CabalSpecVersion + -> Map String CondTreeBuildInfoWithImports -- ^ common stanzas -> [Field Position] - -> ParseResult src ([Field Position], CondTree ConfVar [Dependency] a -> CondTree ConfVar [Dependency] a) -processImports v fromBuildInfo commonStanzas = go [] + -> ParseResult src ([Field Position], [ImportName]) +processImports v commonStanzas = go [] where hasCommonStanzas = specHasCommonStanzas v getList' :: List CommaFSep Token String -> [String] getList' = Newtype.unpack + go + :: [ImportName] + -> [Field Position] + -> ParseResult src ([Field Position], [ImportName]) go acc (Field (Name pos name) _ : fields) | name == "import" , hasCommonStanzas == NoCommonStanzas = do @@ -669,20 +663,19 @@ processImports v fromBuildInfo commonStanzas = go [] -- supported: go acc (Field (Name pos name) fls : fields) | name == "import" = do names <- getList' <$> runFieldParser pos parsec v fls - names' <- for names $ \commonName -> - case Map.lookup commonName commonStanzas of - Nothing -> do + validNames <- for names $ \commonName -> + if Map.member commonName commonStanzas + then pure (Just commonName) + else do parseFailure pos $ "Undefined common stanza imported: " ++ commonName pure Nothing - Just commonTree -> - pure (Just commonTree) - go (acc ++ catMaybes names') fields + go (acc ++ catMaybes validNames) fields -- parse actual CondTree - go acc fields = do + go names fields = do fields' <- catMaybes <$> traverse (warnImport v) fields - pure $ (fields', \x -> foldr (mergeCommonStanza fromBuildInfo) x acc) + pure (fields', names) -- | Warn on "import" fields, also map to Maybe, so erroneous fields can be filtered warnImport :: CabalSpecVersion -> Field Position -> ParseResult src (Maybe (Field Position)) @@ -693,21 +686,6 @@ warnImport v (Field (Name pos name) _) | name == "import" = do return Nothing warnImport _ f = pure (Just f) -mergeCommonStanza - :: L.HasBuildInfo a - => (BuildInfo -> a) - -> CondTree ConfVar [Dependency] BuildInfo - -> CondTree ConfVar [Dependency] a - -> CondTree ConfVar [Dependency] a -mergeCommonStanza fromBuildInfo (CondNode bi _ bis) (CondNode x _ cs) = - CondNode x' (x' ^. L.targetBuildDepends) cs' - where - -- new value is old value with buildInfo field _prepended_. - x' = x & L.buildInfo %~ (bi <>) - - -- tree components are appended together. - cs' = map (fmap fromBuildInfo) bis ++ cs - ------------------------------------------------------------------------------- -- Branches ------------------------------------------------------------------------------- diff --git a/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs b/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs index 15c2c15fe09..7998a477a16 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/PrettyPrint.hs @@ -53,7 +53,6 @@ import Distribution.PackageDescription.FieldGrammar import Distribution.Pretty import Distribution.Utils.Generic (writeFileAtomic, writeUTF8File) -import qualified Distribution.PackageDescription.FieldGrammar as FG import qualified Distribution.Types.BuildInfo.Lens as L import qualified Distribution.Types.SetupBuildInfo.Lens as L @@ -171,14 +170,14 @@ ppCondExecutables v exes = ppCondTestSuites :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] TestSuite)] -> [PrettyField ()] ppCondTestSuites v suites = [ PrettySection () "test-suite" [pretty n] $ - ppCondTree2 v testSuiteFieldGrammar (fmap FG.unvalidateTestSuite condTree) + ppCondTree2 v testSuiteFieldGrammar (fmap unvalidateTestSuite condTree) | (n, condTree) <- suites ] ppCondBenchmarks :: CabalSpecVersion -> [(UnqualComponentName, CondTree ConfVar [Dependency] Benchmark)] -> [PrettyField ()] ppCondBenchmarks v suites = [ PrettySection () "benchmark" [pretty n] $ - ppCondTree2 v benchmarkFieldGrammar (fmap FG.unvalidateBenchmark condTree) + ppCondTree2 v benchmarkFieldGrammar (fmap unvalidateBenchmark condTree) | (n, condTree) <- suites ] diff --git a/Cabal-syntax/src/Distribution/Types/BenchmarkStanza.hs b/Cabal-syntax/src/Distribution/Types/BenchmarkStanza.hs new file mode 100644 index 00000000000..b57610a2c35 --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/BenchmarkStanza.hs @@ -0,0 +1,135 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuantifiedConstraints #-} + +module Distribution.Types.BenchmarkStanza where + +import Distribution.Compat.Lens +import Distribution.Compat.Prelude +import Prelude () + +import Distribution.CabalSpecVersion +import Distribution.Fields +import Distribution.ModuleName (ModuleName) +import Distribution.Parsec +import Distribution.Pretty (prettyShow) +import Distribution.Types.Benchmark +import Distribution.Types.BenchmarkInterface +import Distribution.Types.BenchmarkType +import Distribution.Types.BuildInfo +import qualified Distribution.Types.BuildInfo.Lens as L +import Distribution.Utils.Path + +-- | An intermediate type just used for parsing the benchmark stanza. +-- After validation it is converted into the proper 'Benchmark' type. +data BenchmarkStanza = BenchmarkStanza + { _benchmarkStanzaBenchmarkType :: Maybe BenchmarkType + , _benchmarkStanzaMainIs :: Maybe (RelativePath Source File) + , _benchmarkStanzaBenchmarkModule :: Maybe ModuleName + , _benchmarkStanzaBuildInfo :: BuildInfo + } + deriving (Show, Eq, Data, Generic) + +instance Binary BenchmarkStanza +instance Structured BenchmarkStanza +instance NFData BenchmarkStanza where rnf = genericRnf + +validateBenchmark :: Position -> BenchmarkStanza -> ParseResult src () +validateBenchmark pos stanza = case _benchmarkStanzaBenchmarkType stanza of + Nothing -> pure () + Just (BenchmarkTypeUnknown _ _) -> pure () + Just tt | tt `notElem` knownBenchmarkTypes -> pure () + Just tt@(BenchmarkTypeExe _ver) -> case _benchmarkStanzaMainIs stanza of + Nothing -> parseFailure pos (missingField "main-is" tt) + Just _file -> + when (isJust (_benchmarkStanzaBenchmarkModule stanza)) $ + parseWarning pos PWTExtraBenchmarkModule (extraField "benchmark-module" tt) + where + missingField name tt = + "The '" + ++ name + ++ "' field is required for the " + ++ prettyShow tt + ++ " benchmark type." + + extraField name tt = + "The '" + ++ name + ++ "' field is not used for the '" + ++ prettyShow tt + ++ "' benchmark type." + +convertBenchmark :: BenchmarkStanza -> Benchmark +convertBenchmark stanza = case _benchmarkStanzaBenchmarkType stanza of + Nothing -> + emptyBenchmark + { benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza + } + Just tt@(BenchmarkTypeUnknown _ _) -> + emptyBenchmark + { benchmarkInterface = BenchmarkUnsupported tt + , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza + } + Just tt + | tt `notElem` knownBenchmarkTypes -> + emptyBenchmark + { benchmarkInterface = BenchmarkUnsupported tt + , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza + } + Just (BenchmarkTypeExe ver) -> case _benchmarkStanzaMainIs stanza of + Nothing -> emptyBenchmark + Just file -> + emptyBenchmark + { benchmarkInterface = BenchmarkExeV10 ver file + , benchmarkBuildInfo = _benchmarkStanzaBuildInfo stanza + } + +unvalidateBenchmark :: Benchmark -> BenchmarkStanza +unvalidateBenchmark b = + BenchmarkStanza + { _benchmarkStanzaBenchmarkType = ty + , _benchmarkStanzaMainIs = ma + , _benchmarkStanzaBenchmarkModule = mo + , _benchmarkStanzaBuildInfo = benchmarkBuildInfo b + } + where + (ty, ma, mo) = case benchmarkInterface b of + BenchmarkExeV10 ver ma' + | getSymbolicPath ma' == "" -> + (Just $ BenchmarkTypeExe ver, Nothing, Nothing) + | otherwise -> + (Just $ BenchmarkTypeExe ver, Just ma', Nothing) + _ -> (Nothing, Nothing, Nothing) + +patchBenchmarkType :: CabalSpecVersion -> BenchmarkStanza -> BenchmarkStanza +patchBenchmarkType cabalSpecVersion stanza = + stanza + { _benchmarkStanzaBenchmarkType = + _benchmarkStanzaBenchmarkType stanza <|> do + guard (cabalSpecVersion >= CabalSpecV3_8) + benchmarkTypeExe <$ _benchmarkStanzaMainIs stanza + } + +instance L.HasBuildInfo BenchmarkStanza where + buildInfo = benchmarkStanzaBuildInfo + +benchmarkStanzaBenchmarkType :: Lens' BenchmarkStanza (Maybe BenchmarkType) +benchmarkStanzaBenchmarkType f s = fmap (\x -> s{_benchmarkStanzaBenchmarkType = x}) (f (_benchmarkStanzaBenchmarkType s)) +{-# INLINE benchmarkStanzaBenchmarkType #-} + +benchmarkStanzaMainIs :: Lens' BenchmarkStanza (Maybe (RelativePath Source File)) +benchmarkStanzaMainIs f s = fmap (\x -> s{_benchmarkStanzaMainIs = x}) (f (_benchmarkStanzaMainIs s)) +{-# INLINE benchmarkStanzaMainIs #-} + +benchmarkStanzaBenchmarkModule :: Lens' BenchmarkStanza (Maybe ModuleName) +benchmarkStanzaBenchmarkModule f s = fmap (\x -> s{_benchmarkStanzaBenchmarkModule = x}) (f (_benchmarkStanzaBenchmarkModule s)) +{-# INLINE benchmarkStanzaBenchmarkModule #-} + +benchmarkStanzaBuildInfo :: Lens' BenchmarkStanza BuildInfo +benchmarkStanzaBuildInfo f s = fmap (\x -> s{_benchmarkStanzaBuildInfo = x}) (f (_benchmarkStanzaBuildInfo s)) +{-# INLINE benchmarkStanzaBuildInfo #-} diff --git a/Cabal-syntax/src/Distribution/Types/CondTree.hs b/Cabal-syntax/src/Distribution/Types/CondTree.hs index c74ffdf6395..0fb035fadae 100644 --- a/Cabal-syntax/src/Distribution/Types/CondTree.hs +++ b/Cabal-syntax/src/Distribution/Types/CondTree.hs @@ -13,6 +13,7 @@ module Distribution.Types.CondTree , mapTreeConstrs , mapTreeConds , mapTreeData + , mapTreeData' , traverseCondTreeV , traverseCondBranchV , traverseCondTreeC @@ -123,6 +124,26 @@ mapTreeConds f = mapCondTree id id f mapTreeData :: (a -> b) -> CondTree v c a -> CondTree v c b mapTreeData f = mapCondTree f id id +-- | Transform data and branches differently +mapTreeData' + :: (a -> b) + -- ^ transform root + -> (a -> b) + -- ^ transform subtrees + -> CondTree v c a + -> CondTree v c b +mapTreeData' f g n = + n + { condTreeData = f (condTreeData n) + , condTreeComponents = map g' (condTreeComponents n) + } + where + g' (CondBranch cond ifTrue ifFalse) = + CondBranch + (cond) + (mapTreeData' g g $ ifTrue) + (mapTreeData' g g <$> ifFalse) + -- | @@Traversal@@ for the variables traverseCondTreeV :: L.Traversal (CondTree v c a) (CondTree w c a) v w traverseCondTreeV f (CondNode a c ifs) = diff --git a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs index 97f4ed8cccb..910e127078b 100644 --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs +++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription.hs @@ -1,11 +1,42 @@ +{-# LANGUAGE CPP #-} {-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE FlexibleContexts #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE ScopedTypeVariables #-} +{-# LANGUAGE ViewPatterns #-} +#if __GLASGOW_HASKELL__ >= 914 +{-# LANGUAGE ExplicitNamespaces #-} +#endif module Distribution.Types.GenericPackageDescription ( GenericPackageDescription (..) +#if __GLASGOW_HASKELL__ >= 914 + , data GenericPackageDescription +#else + , pattern GenericPackageDescription +#endif , emptyGenericPackageDescription + , mergeImports + + -- * Accessors from 'PatternSynonyms'\'s record syntax + , packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary + , condSubLibraries + , condForeignLibs + , condExecutables + , condTestSuites + , condBenchmarks + + -- * Merging helpers + , mergeCondLibrary + , mergeCondSubLibraries + , mergeCondForeignLibs + , mergeCondExecutables + , mergeTestSuiteStanza + , mergeBenchmarkStanza ) where import Distribution.Compat.Prelude @@ -15,26 +46,42 @@ import Prelude () import Distribution.Compat.Lens as L import qualified Distribution.Types.BuildInfo.Lens as L +-- TODO(leana8959): fix it this orphan +import qualified Distribution.Types.Imports.Lens as L () + import Distribution.Types.PackageDescription +import Distribution.CabalSpecVersion import Distribution.Package import Distribution.Types.Benchmark +import Distribution.Types.BenchmarkStanza +import Distribution.Types.BuildInfo import Distribution.Types.CondTree import Distribution.Types.ConfVar import Distribution.Types.Executable import Distribution.Types.Flag import Distribution.Types.ForeignLib +import Distribution.Types.Imports import Distribution.Types.Library +import Distribution.Types.LibraryName +import Distribution.Types.LibraryVisibility import Distribution.Types.TestSuite +import Distribution.Types.TestSuiteStanza import Distribution.Types.UnqualComponentName import Distribution.Version +import qualified Data.Map as Map + -- --------------------------------------------------------------------------- -- The 'GenericPackageDescription' type -data GenericPackageDescription = GenericPackageDescription - { packageDescription :: PackageDescription - , gpdScannedVersion :: Maybe Version +type DependencyTree a = CondTree ConfVar [Dependency] a + +-- | The internal representation of 'GenericPackageDescription', containing the unmerged stanzas +-- We provide a pattern below for backward compatibility, as well for hiding the internals of wiring the imports +data GenericPackageDescription = GenericPackageDescription' + { packageDescriptionInternal :: PackageDescription + , gpdScannedVersionInternal :: Maybe Version -- ^ This is a version as specified in source. -- We populate this field in index reading for dummy GPDs, -- only when GPD reading failed, but scanning haven't. @@ -43,35 +90,283 @@ data GenericPackageDescription = GenericPackageDescription -- -- Perfectly, PackageIndex should have sum type, so we don't need to -- have dummy GPDs. - , genPackageFlags :: [PackageFlag] - , condLibrary :: Maybe (CondTree ConfVar [Dependency] Library) + , genPackageFlagsInternal :: [PackageFlag] + , gpdCommonStanzas :: Map ImportName (DependencyTree (WithImports BuildInfo)) + , condLibraryUnmerged :: Maybe (DependencyTree (WithImports Library)) + , condSubLibrariesUnmerged :: [(UnqualComponentName, DependencyTree (WithImports Library))] + , condForeignLibsUnmerged :: [(UnqualComponentName, DependencyTree (WithImports ForeignLib))] + , condExecutablesUnmerged :: [(UnqualComponentName, DependencyTree (WithImports Executable))] + , condTestSuitesUnmerged :: [(UnqualComponentName, DependencyTree (WithImports TestSuiteStanza))] + , condBenchmarksUnmerged :: [(UnqualComponentName, DependencyTree (WithImports BenchmarkStanza))] + } + deriving (Show, Eq, Data, Generic) + +pattern GenericPackageDescription + :: PackageDescription + -> Maybe Version + -> [PackageFlag] + -> Maybe (DependencyTree Library) + -> [(UnqualComponentName, DependencyTree Library)] + -> [(UnqualComponentName, DependencyTree ForeignLib)] + -> [(UnqualComponentName, DependencyTree Executable)] + -> [(UnqualComponentName, DependencyTree TestSuite)] + -> [(UnqualComponentName, DependencyTree Benchmark)] + -> GenericPackageDescription +pattern GenericPackageDescription + { packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary , condSubLibraries - :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Library - ) - ] , condForeignLibs - :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] ForeignLib - ) - ] , condExecutables - :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Executable - ) - ] , condTestSuites - :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] TestSuite - ) - ] , condBenchmarks - :: [ ( UnqualComponentName - , CondTree ConfVar [Dependency] Benchmark - ) - ] - } - deriving (Show, Eq, Data, Generic) + } <- + ( viewGenericPackageDescription -> + ( packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary + , condSubLibraries + , condForeignLibs + , condExecutables + , condTestSuites + , condBenchmarks + ) + ) + where + GenericPackageDescription + pd + scannedVersion + packageFlags + lib + sublibs + flibs + exes + tests + bms = + GenericPackageDescription' + pd + scannedVersion + packageFlags + mempty + ((fmap . fmap) noImports lib) + ((fmap . fmap . fmap) noImports sublibs) + ((fmap . fmap . fmap) noImports flibs) + ((fmap . fmap . fmap) noImports exes) + ((fmap . fmap . fmap) (noImports . unvalidateTestSuite) tests) + ((fmap . fmap . fmap) (noImports . unvalidateBenchmark) bms) + +{-# COMPLETE GenericPackageDescription #-} + +viewGenericPackageDescription + :: GenericPackageDescription + -> ( PackageDescription + , Maybe Version + , [PackageFlag] + , Maybe (DependencyTree Library) + , [(UnqualComponentName, DependencyTree Library)] + , [(UnqualComponentName, DependencyTree ForeignLib)] + , [(UnqualComponentName, DependencyTree Executable)] + , [(UnqualComponentName, DependencyTree TestSuite)] + , [(UnqualComponentName, DependencyTree Benchmark)] + ) +viewGenericPackageDescription gpd = + ( packageDescriptionInternal gpd + , gpdScannedVersionInternal gpd + , genPackageFlagsInternal gpd + , condLibrary' gpd + , condSubLibraries' gpd + , condForeignLibs' gpd + , condExecutables' gpd + , condTestSuites' gpd + , condBenchmarks' gpd + ) + +libraryFromBuildInfo :: LibraryName -> BuildInfo -> Library +libraryFromBuildInfo n bi = + emptyLibrary + { libName = n + , libVisibility = case n of + LMainLibName -> LibraryVisibilityPublic + LSubLibName _ -> LibraryVisibilityPrivate + , libBuildInfo = bi + } + +foreignLibFromBuildInfo :: UnqualComponentName -> BuildInfo -> ForeignLib +foreignLibFromBuildInfo n bi = emptyForeignLib{foreignLibName = n, foreignLibBuildInfo = bi} + +executableFromBuildInfo :: UnqualComponentName -> BuildInfo -> Executable +executableFromBuildInfo n bi = emptyExecutable{exeName = n, buildInfo = bi} + +testSuiteStanzaFromBuildInfo :: BuildInfo -> TestSuiteStanza +testSuiteStanzaFromBuildInfo bi = TestSuiteStanza Nothing Nothing Nothing bi [] + +benchmarkStanzaFromBuildInfo :: BuildInfo -> BenchmarkStanza +benchmarkStanzaFromBuildInfo bi = BenchmarkStanza Nothing Nothing Nothing bi + +condLibrary' + :: GenericPackageDescription + -> Maybe (DependencyTree Library) +condLibrary' gpd = mergeCondLibrary (gpdCommonStanzas gpd) <$> (condLibraryUnmerged gpd) + +mergeCondLibrary + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> DependencyTree (WithImports Library) + -> DependencyTree Library +mergeCondLibrary = flip mergeImports fromBuildInfo + where + fromBuildInfo = libraryFromBuildInfo . libName + +condSubLibraries' + :: GenericPackageDescription + -> [(UnqualComponentName, DependencyTree Library)] +condSubLibraries' gpd = mergeCondSubLibraries (gpdCommonStanzas gpd) (condSubLibrariesUnmerged gpd) + +mergeCondSubLibraries + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> [(UnqualComponentName, DependencyTree (WithImports Library))] + -> [(UnqualComponentName, DependencyTree Library)] +mergeCondSubLibraries commonStanzas = map (mergeCondLibrary commonStanzas <$>) + +condForeignLibs' + :: GenericPackageDescription + -> [(UnqualComponentName, DependencyTree ForeignLib)] +condForeignLibs' gpd = mergeCondForeignLibs (gpdCommonStanzas gpd) (condForeignLibsUnmerged gpd) + +mergeCondForeignLibs + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> [(UnqualComponentName, DependencyTree (WithImports ForeignLib))] + -> [(UnqualComponentName, DependencyTree ForeignLib)] +mergeCondForeignLibs commonStanzas = map $ \(name, tree) -> + -- TODO(leana8959): is the name within the foreignlib important or we should use the name in the tuple? + (name, mergeImports commonStanzas (const $ foreignLibFromBuildInfo name) tree) + +condExecutables' + :: GenericPackageDescription + -> [(UnqualComponentName, DependencyTree Executable)] +condExecutables' gpd = mergeCondExecutables (gpdCommonStanzas gpd) (condExecutablesUnmerged gpd) + +mergeCondExecutables + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> [(UnqualComponentName, DependencyTree (WithImports Executable))] + -> [(UnqualComponentName, DependencyTree Executable)] +mergeCondExecutables commonStanzas = map $ \(name, tree) -> + (name, mergeImports commonStanzas (const $ executableFromBuildInfo name) tree) + +mergeTestSuiteStanza + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> DependencyTree (WithImports TestSuiteStanza) + -> DependencyTree TestSuiteStanza +mergeTestSuiteStanza commonStanza = + mergeImports commonStanza (const $ testSuiteStanzaFromBuildInfo) + +mergeBenchmarkStanza + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> DependencyTree (WithImports BenchmarkStanza) + -> DependencyTree BenchmarkStanza +mergeBenchmarkStanza commonStanza = + mergeImports commonStanza (const $ benchmarkStanzaFromBuildInfo) + +condTestSuites' + :: GenericPackageDescription + -> [(UnqualComponentName, DependencyTree TestSuite)] +condTestSuites' gpd = + mergeTestSuiteStanza' (gpdCommonStanzas gpd) (condTestSuitesUnmerged gpd) + & (map . fmap . mapTreeData) (convertTestSuite . patchTestSuiteType specVer) + where + specVer :: CabalSpecVersion + specVer = specVersion . packageDescriptionInternal $ gpd + +mergeTestSuiteStanza' + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> [(UnqualComponentName, DependencyTree (WithImports TestSuiteStanza))] + -> [(UnqualComponentName, DependencyTree TestSuiteStanza)] +mergeTestSuiteStanza' commonStanza = + map $ + fmap $ + mergeImports commonStanza (const $ testSuiteStanzaFromBuildInfo) + +condBenchmarks' + :: GenericPackageDescription + -> [(UnqualComponentName, DependencyTree Benchmark)] +condBenchmarks' gpd = + mergeBenchmarkStanza' (gpdCommonStanzas gpd) (condBenchmarksUnmerged gpd) + & (map . fmap . mapTreeData) (convertBenchmark . patchBenchmarkType specVer) + where + specVer :: CabalSpecVersion + specVer = specVersion . packageDescriptionInternal $ gpd + +mergeBenchmarkStanza' + :: Map ImportName (DependencyTree (WithImports BuildInfo)) + -> [(UnqualComponentName, DependencyTree (WithImports BenchmarkStanza))] + -> [(UnqualComponentName, DependencyTree BenchmarkStanza)] +mergeBenchmarkStanza' commonStanza = + map $ + fmap $ + mergeImports commonStanza (const $ benchmarkStanzaFromBuildInfo) + +mergeImports + :: forall a + . L.HasBuildInfo a + => Map ImportName (DependencyTree (WithImports BuildInfo)) + -> (a -> (BuildInfo -> a)) + -- ^ We need the information regarding the root node to be able to build such a constructor function + -> DependencyTree (WithImports a) + -> DependencyTree a +mergeImports commonStanzas fromBuildInfo (CondNode root c zs) = + let endo :: DependencyTree a -> DependencyTree a + endo = resolveImports (getImportNames root) + + tree :: DependencyTree a + tree = CondNode (unImportNames root) c (map goBranch zs) + in endo tree + where + goBranch + :: L.HasBuildInfo a + => CondBranch ConfVar [Dependency] (WithImports a) + -> CondBranch ConfVar [Dependency] a + goBranch (CondBranch cond ifTrue ifFalse) = CondBranch cond (goNode ifTrue) (goNode <$> ifFalse) + where + goNode = mergeImports commonStanzas fromBuildInfo + + resolveImports + :: L.HasBuildInfo a + => [ImportName] + -> (DependencyTree a -> DependencyTree a) + resolveImports importNames = + let commonTrees :: [DependencyTree (WithImports BuildInfo)] + commonTrees = + map + ( fromMaybe (error "failed to merge imports, did you mess with GenericPackageDescription?") + . flip Map.lookup commonStanzas + ) + importNames + + commonTrees' :: [DependencyTree BuildInfo] + commonTrees' = map goNode commonTrees + in \x -> foldr mergeCondTree x commonTrees' + where + goNode = mergeImports commonStanzas (const id) + + mergeCondTree + :: L.HasBuildInfo a + => DependencyTree BuildInfo + -> DependencyTree a + -> DependencyTree a + mergeCondTree (CondNode bi _ bis) (CondNode x _ cs) = CondNode x' (x' ^. L.targetBuildDepends) cs' + where + fromBuildInfo' :: (BuildInfo -> a) + fromBuildInfo' = fromBuildInfo (unImportNames root) + + -- new value is old value with buildInfo field _prepended_. + x' :: a + x' = x & L.buildInfo %~ (bi <>) + + -- tree components are appended together. + cs' :: [CondBranch ConfVar [Dependency] a] + cs' = map (fromBuildInfo' <$>) bis ++ cs instance Package GenericPackageDescription where packageId = packageId . packageDescription @@ -81,17 +376,29 @@ instance Structured GenericPackageDescription instance NFData GenericPackageDescription where rnf = genericRnf emptyGenericPackageDescription :: GenericPackageDescription -emptyGenericPackageDescription = GenericPackageDescription emptyPackageDescription Nothing [] Nothing [] [] [] [] [] +emptyGenericPackageDescription = + GenericPackageDescription + { packageDescription = emptyPackageDescription + , gpdScannedVersion = Nothing + , genPackageFlags = [] + , condLibrary = Nothing + , condSubLibraries = [] + , condForeignLibs = [] + , condExecutables = [] + , condTestSuites = [] + , condBenchmarks = [] + } -- ----------------------------------------------------------------------------- -- Traversal Instances instance L.HasBuildInfos GenericPackageDescription where - traverseBuildInfos f (GenericPackageDescription p v a1 x1 x2 x3 x4 x5 x6) = - GenericPackageDescription + traverseBuildInfos f (GenericPackageDescription' p v a1 commonStanzas x1 x2 x3 x4 x5 x6) = + GenericPackageDescription' <$> L.traverseBuildInfos f p <*> pure v <*> pure a1 + <*> (traverse . traverseCondTreeBuildInfo) f commonStanzas <*> (traverse . traverseCondTreeBuildInfo) f x1 <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x2 <*> (traverse . L._2 . traverseCondTreeBuildInfo) f x3 diff --git a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs index 213c97128f9..9a9593790e8 100644 --- a/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs +++ b/Cabal-syntax/src/Distribution/Types/GenericPackageDescription/Lens.hs @@ -13,6 +13,7 @@ import Distribution.Compat.Prelude import Prelude () import qualified Distribution.Types.GenericPackageDescription as T +import qualified Distribution.Types.Imports as T -- We import types from their packages, so we can remove unused imports -- and have wider inter-module dependency graph @@ -20,16 +21,20 @@ import qualified Distribution.Types.GenericPackageDescription as T import Distribution.Compiler (CompilerFlavor) import Distribution.System (Arch, OS) import Distribution.Types.Benchmark (Benchmark) +import Distribution.Types.BenchmarkStanza (BenchmarkStanza) +import Distribution.Types.BuildInfo (BuildInfo) import Distribution.Types.CondTree (CondTree) import Distribution.Types.ConfVar (ConfVar (..)) import Distribution.Types.Dependency (Dependency) import Distribution.Types.Executable (Executable) import Distribution.Types.Flag (FlagName, PackageFlag (MkPackageFlag)) import Distribution.Types.ForeignLib (ForeignLib) -import Distribution.Types.GenericPackageDescription (GenericPackageDescription (GenericPackageDescription)) +import Distribution.Types.GenericPackageDescription +import Distribution.Types.Imports (ImportName) import Distribution.Types.Library (Library) import Distribution.Types.PackageDescription (PackageDescription) import Distribution.Types.TestSuite (TestSuite) +import Distribution.Types.TestSuiteStanza (TestSuiteStanza) import Distribution.Types.UnqualComponentName (UnqualComponentName) import Distribution.Version (Version, VersionRange) @@ -37,55 +42,99 @@ import Distribution.Version (Version, VersionRange) -- GenericPackageDescription ------------------------------------------------------------------------------- +type DependencyTree a = CondTree ConfVar [Dependency] a + +-- Merging drops commonStanzas! +-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +-- +-- When using an the bidirectional PatternSynonym 'GenericPackageDescription' and its accessors, +-- commonStanzas is filled with mempty. +-- +-- When there's no specific reason to use merging pattern accessors, use the internal one! + packageDescription :: Lens' GenericPackageDescription PackageDescription -packageDescription f s = fmap (\x -> s{T.packageDescription = x}) (f (T.packageDescription s)) +packageDescription f s = fmap (\x -> s{T.packageDescriptionInternal = x}) (f (T.packageDescriptionInternal s)) {-# INLINE packageDescription #-} gpdScannedVersion :: Lens' GenericPackageDescription (Maybe Version) -gpdScannedVersion f s = fmap (\x -> s{T.gpdScannedVersion = x}) (f (T.gpdScannedVersion s)) +gpdScannedVersion f s = fmap (\x -> s{T.gpdScannedVersionInternal = x}) (f (T.gpdScannedVersionInternal s)) {-# INLINE gpdScannedVersion #-} genPackageFlags :: Lens' GenericPackageDescription [PackageFlag] -genPackageFlags f s = fmap (\x -> s{T.genPackageFlags = x}) (f (T.genPackageFlags s)) +genPackageFlags f s = fmap (\x -> s{T.genPackageFlagsInternal = x}) (f (T.genPackageFlagsInternal s)) {-# INLINE genPackageFlags #-} -condLibrary :: Lens' GenericPackageDescription (Maybe (CondTree ConfVar [Dependency] Library)) +gpdCommonStanzas :: Lens' GenericPackageDescription (Map ImportName (DependencyTree (T.WithImports BuildInfo))) +gpdCommonStanzas f s = fmap (\x -> s{T.gpdCommonStanzas = x}) (f (T.gpdCommonStanzas s)) +{-# INLINE gpdCommonStanzas #-} + +condLibraryUnmerged :: Lens' GenericPackageDescription (Maybe (DependencyTree (T.WithImports Library))) +condLibraryUnmerged f s = fmap (\x -> s{T.condLibraryUnmerged = x}) (f (T.condLibraryUnmerged s)) +{-# INLINE condLibraryUnmerged #-} + +condSubLibrariesUnmerged :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree (T.WithImports Library)))] +condSubLibrariesUnmerged f s = fmap (\x -> s{T.condSubLibrariesUnmerged = x}) (f (T.condSubLibrariesUnmerged s)) +{-# INLINE condSubLibrariesUnmerged #-} + +condForeignLibsUnmerged :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree (T.WithImports ForeignLib)))] +condForeignLibsUnmerged f s = fmap (\x -> s{T.condForeignLibsUnmerged = x}) (f (T.condForeignLibsUnmerged s)) +{-# INLINE condForeignLibsUnmerged #-} + +condExecutablesUnmerged :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree (T.WithImports Executable)))] +condExecutablesUnmerged f s = fmap (\x -> s{T.condExecutablesUnmerged = x}) (f (T.condExecutablesUnmerged s)) +{-# INLINE condExecutablesUnmerged #-} + +condTestSuitesUnmerged :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree (T.WithImports TestSuiteStanza)))] +condTestSuitesUnmerged f s = fmap (\x -> s{T.condTestSuitesUnmerged = x}) (f (T.condTestSuitesUnmerged s)) +{-# INLINE condTestSuitesUnmerged #-} + +condBenchmarksUnmerged :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree (T.WithImports BenchmarkStanza)))] +condBenchmarksUnmerged f s = fmap (\x -> s{T.condBenchmarksUnmerged = x}) (f (T.condBenchmarksUnmerged s)) +{-# INLINE condBenchmarksUnmerged #-} + +-- TODO(leana8959): These accessor will merge the imports, apply f, and then put them back as if the imports weren't there +-- This is a good way to mask the import behaviour. +-- However, I do not know when this might be surprising +-- +-- If this is used in the parser for example, it would be a massive footgun because it would essentially "erase" all the imports and put the merged one back +condLibrary :: Lens' GenericPackageDescription (Maybe (DependencyTree (Library))) condLibrary f s = fmap (\x -> s{T.condLibrary = x}) (f (T.condLibrary s)) {-# INLINE condLibrary #-} -condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Library))] +condSubLibraries :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree Library))] condSubLibraries f s = fmap (\x -> s{T.condSubLibraries = x}) (f (T.condSubLibraries s)) {-# INLINE condSubLibraries #-} -condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] ForeignLib))] +condForeignLibs :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree ForeignLib))] condForeignLibs f s = fmap (\x -> s{T.condForeignLibs = x}) (f (T.condForeignLibs s)) {-# INLINE condForeignLibs #-} -condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Executable))] +condExecutables :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree Executable))] condExecutables f s = fmap (\x -> s{T.condExecutables = x}) (f (T.condExecutables s)) {-# INLINE condExecutables #-} -condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] TestSuite))] +condTestSuites :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree TestSuite))] condTestSuites f s = fmap (\x -> s{T.condTestSuites = x}) (f (T.condTestSuites s)) {-# INLINE condTestSuites #-} -condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, (CondTree ConfVar [Dependency] Benchmark))] +condBenchmarks :: Lens' GenericPackageDescription [(UnqualComponentName, (DependencyTree Benchmark))] condBenchmarks f s = fmap (\x -> s{T.condBenchmarks = x}) (f (T.condBenchmarks s)) {-# INLINE condBenchmarks #-} allCondTrees :: Applicative f => ( forall a - . CondTree ConfVar [Dependency] a - -> f (CondTree ConfVar [Dependency] a) + . DependencyTree a + -> f (DependencyTree a) ) -> GenericPackageDescription -> f GenericPackageDescription -allCondTrees f (GenericPackageDescription p v a1 x1 x2 x3 x4 x5 x6) = - GenericPackageDescription +allCondTrees f (GenericPackageDescription' p v a1 commonStanzas x1 x2 x3 x4 x5 x6) = + GenericPackageDescription' <$> pure p <*> pure v <*> pure a1 + <*> traverse f commonStanzas <*> traverse f x1 <*> (traverse . _2) f x2 <*> (traverse . _2) f x3 diff --git a/Cabal-syntax/src/Distribution/Types/Imports.hs b/Cabal-syntax/src/Distribution/Types/Imports.hs new file mode 100644 index 00000000000..732322fe79d --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/Imports.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveFunctor #-} +{-# LANGUAGE DeriveGeneric #-} + +module Distribution.Types.Imports where + +import Distribution.Compat.Prelude + +data WithImports a = WithImports + { getImportNames :: ![ImportName] + , unImportNames :: !a + } + deriving (Show, Functor, Eq, Ord, Read, Data, Generic) + +instance Binary a => Binary (WithImports a) +instance Structured a => Structured (WithImports a) +instance NFData a => NFData (WithImports a) where rnf = genericRnf + +type ImportName = String + +mapImports :: ([ImportName] -> [ImportName]) -> WithImports a -> WithImports a +mapImports f (WithImports imports x) = WithImports (f imports) x + +noImports :: a -> WithImports a +noImports = WithImports mempty diff --git a/Cabal-syntax/src/Distribution/Types/Imports/Lens.hs b/Cabal-syntax/src/Distribution/Types/Imports/Lens.hs new file mode 100644 index 00000000000..955163acce1 --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/Imports/Lens.hs @@ -0,0 +1,21 @@ +{-# OPTIONS_GHC "-Wno-orphans" #-} + +-- TODO(leana8959): how can I put HasBuildInfo elsewhere + +module Distribution.Types.Imports.Lens where + +import Distribution.Compat.Lens + +import qualified Distribution.Types.BuildInfo.Lens as L +import qualified Distribution.Types.Imports as T + +getImportNames :: Lens (T.WithImports a) (T.WithImports b) a b +getImportNames f (T.WithImports is x) = fmap (\y -> T.WithImports is y) (f x) +{-# INLINE getImportNames #-} + +unImportNames :: Lens' (T.WithImports a) [T.ImportName] +unImportNames f (T.WithImports is x) = fmap (\is' -> T.WithImports is' x) (f is) +{-# INLINE unImportNames #-} + +instance L.HasBuildInfo a => L.HasBuildInfo (T.WithImports a) where + buildInfo f (T.WithImports is x) = T.WithImports is <$> L.buildInfo f x diff --git a/Cabal-syntax/src/Distribution/Types/TestSuiteStanza.hs b/Cabal-syntax/src/Distribution/Types/TestSuiteStanza.hs new file mode 100644 index 00000000000..e31dedd2cc7 --- /dev/null +++ b/Cabal-syntax/src/Distribution/Types/TestSuiteStanza.hs @@ -0,0 +1,160 @@ +{-# LANGUAGE ConstraintKinds #-} +{-# LANGUAGE DataKinds #-} +{-# LANGUAGE DeriveDataTypeable #-} +{-# LANGUAGE DeriveGeneric #-} +{-# LANGUAGE FlexibleInstances #-} +{-# LANGUAGE MultiParamTypeClasses #-} +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE QuantifiedConstraints #-} + +module Distribution.Types.TestSuiteStanza where + +import Distribution.Compat.Lens +import Distribution.Compat.Prelude +import Prelude () + +import Distribution.CabalSpecVersion +import Distribution.Fields.ParseResult +import Distribution.ModuleName (ModuleName) +import Distribution.Parsec +import Distribution.Pretty (prettyShow) +import Distribution.Types.BuildInfo +import qualified Distribution.Types.BuildInfo.Lens as L +import Distribution.Types.TestSuite +import Distribution.Types.TestSuiteInterface +import Distribution.Types.TestType +import Distribution.Utils.Path + +-- | An intermediate type just used for parsing the test-suite stanza. +-- After validation it is converted into the proper 'TestSuite' type. +data TestSuiteStanza = TestSuiteStanza + { _testStanzaTestType :: Maybe TestType + , _testStanzaMainIs :: Maybe (RelativePath Source File) + , _testStanzaTestModule :: Maybe ModuleName + , _testStanzaBuildInfo :: BuildInfo + , _testStanzaCodeGenerators :: [String] + } + deriving (Show, Eq, Data, Generic) + +instance Binary TestSuiteStanza +instance Structured TestSuiteStanza +instance NFData TestSuiteStanza where rnf = genericRnf + +instance L.HasBuildInfo TestSuiteStanza where + buildInfo = testStanzaBuildInfo + +validateTestSuite :: Position -> TestSuiteStanza -> ParseResult src () +validateTestSuite pos stanza = case _testStanzaTestType stanza of + Nothing -> pure () + Just (TestTypeUnknown _ _) -> pure () + Just tt | tt `notElem` knownTestTypes -> pure () + Just tt@(TestTypeExe _ver) -> case _testStanzaMainIs stanza of + Nothing -> parseFailure pos (missingField "main-is" tt) + Just _file -> + when (isJust (_testStanzaTestModule stanza)) $ + parseWarning pos PWTExtraBenchmarkModule (extraField "test-module" tt) + Just tt@(TestTypeLib _ver) -> case _testStanzaTestModule stanza of + Nothing -> + parseFailure pos (missingField "test-module" tt) + Just _module -> + when (isJust (_testStanzaMainIs stanza)) $ + parseWarning pos PWTExtraMainIs (extraField "main-is" tt) + where + missingField name tt = + "The '" + ++ name + ++ "' field is required for the " + ++ prettyShow tt + ++ " test suite type." + + extraField name tt = + "The '" + ++ name + ++ "' field is not used for the '" + ++ prettyShow tt + ++ "' test suite type." + +-- | Convert a previously validated 'TestSuiteStanza' to 'GenericPackageDescription''s 'TestSuite' type +-- We do not check the validity here +convertTestSuite :: TestSuiteStanza -> TestSuite +convertTestSuite stanza = case _testStanzaTestType stanza of + Nothing -> basicTestSuite + Just tt@(TestTypeUnknown _ _) -> + basicTestSuite + { testInterface = TestSuiteUnsupported tt + } + Just tt + | tt `notElem` knownTestTypes -> + basicTestSuite + { testInterface = TestSuiteUnsupported tt + } + Just (TestTypeExe ver) -> case _testStanzaMainIs stanza of + Nothing -> failedToConvert + Just file -> + basicTestSuite + { testInterface = TestSuiteExeV10 ver file + } + Just (TestTypeLib ver) -> case _testStanzaTestModule stanza of + Nothing -> failedToConvert + Just module_ -> + basicTestSuite + { testInterface = TestSuiteLibV09 ver module_ + } + where + failedToConvert = + error $ + "Unexpected: the conversion from TestSuiteStanza to TestSuite failed\n" + <> "Did you mess with `GenericPackageDescription`?" + + basicTestSuite = + emptyTestSuite + { testBuildInfo = _testStanzaBuildInfo stanza + , testCodeGenerators = _testStanzaCodeGenerators stanza + } + +unvalidateTestSuite :: TestSuite -> TestSuiteStanza +unvalidateTestSuite t = + TestSuiteStanza + { _testStanzaTestType = ty + , _testStanzaMainIs = ma + , _testStanzaTestModule = mo + , _testStanzaBuildInfo = testBuildInfo t + , _testStanzaCodeGenerators = testCodeGenerators t + } + where + (ty, ma, mo) = case testInterface t of + TestSuiteExeV10 ver file -> (Just $ TestTypeExe ver, Just file, Nothing) + TestSuiteLibV09 ver modu -> (Just $ TestTypeLib ver, Nothing, Just modu) + _ -> (Nothing, Nothing, Nothing) + +-- | We try to guess the TestSuiteType if it's not specified +patchTestSuiteType :: CabalSpecVersion -> TestSuiteStanza -> TestSuiteStanza +patchTestSuiteType cabalSpecVersion stanza = + stanza + { _testStanzaTestType = + _testStanzaTestType stanza + <|> do + guard (cabalSpecVersion >= CabalSpecV3_8) + testTypeExe <$ _testStanzaMainIs stanza + <|> testTypeLib <$ _testStanzaTestModule stanza + } + +testStanzaTestType :: Lens' TestSuiteStanza (Maybe TestType) +testStanzaTestType f s = fmap (\x -> s{_testStanzaTestType = x}) (f (_testStanzaTestType s)) +{-# INLINE testStanzaTestType #-} + +testStanzaMainIs :: Lens' TestSuiteStanza (Maybe (RelativePath Source File)) +testStanzaMainIs f s = fmap (\x -> s{_testStanzaMainIs = x}) (f (_testStanzaMainIs s)) +{-# INLINE testStanzaMainIs #-} + +testStanzaTestModule :: Lens' TestSuiteStanza (Maybe ModuleName) +testStanzaTestModule f s = fmap (\x -> s{_testStanzaTestModule = x}) (f (_testStanzaTestModule s)) +{-# INLINE testStanzaTestModule #-} + +testStanzaBuildInfo :: Lens' TestSuiteStanza BuildInfo +testStanzaBuildInfo f s = fmap (\x -> s{_testStanzaBuildInfo = x}) (f (_testStanzaBuildInfo s)) +{-# INLINE testStanzaBuildInfo #-} + +testStanzaCodeGenerators :: Lens' TestSuiteStanza [String] +testStanzaCodeGenerators f s = fmap (\x -> s{_testStanzaCodeGenerators = x}) (f (_testStanzaCodeGenerators s)) +{-# INLINE testStanzaCodeGenerators #-} diff --git a/Cabal-tests/tests/HackageTests.hs b/Cabal-tests/tests/HackageTests.hs index 1265c6cb13e..66b61990422 100644 --- a/Cabal-tests/tests/HackageTests.hs +++ b/Cabal-tests/tests/HackageTests.hs @@ -5,6 +5,7 @@ #if !MIN_VERSION_deepseq(1,4,0) {-# OPTIONS_GHC -Wno-orphans #-} #endif +{-# OPTIONS_GHC -Wno-unused-pattern-binds #-} -- pattern match to assert field count module Main where @@ -23,6 +24,18 @@ import Data.Monoid (Sum (..)) import Distribution.PackageDescription.Check (PackageCheck (..), checkPackage) import Distribution.PackageDescription.PrettyPrint (showGenericPackageDescription) import Distribution.PackageDescription.Quirks (patchQuirks) +import Distribution.PackageDescription + ( GenericPackageDescription(GenericPackageDescription') + , packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary + , condSubLibraries + , condForeignLibs + , condExecutables + , condTestSuites + , condBenchmarks + ) import Distribution.Simple.Utils (fromUTF8BS, toUTF8BS) import Distribution.Fields.ParseResult import Distribution.Parsec.Source @@ -54,8 +67,8 @@ import qualified Distribution.Types.PackageDescription.Lens as L -- import qualified Distribution.Types.BuildInfo.Lens as L #ifdef MIN_VERSION_tree_diff -import Data.TreeDiff (ediff) -import Data.TreeDiff.Instances.Cabal () +import Data.TreeDiff (ediff, ToExpr) +import Data.TreeDiff.Instances.Cabal (MergedGPD(..)) import Data.TreeDiff.Pretty (ansiWlEditExprCompact) #endif @@ -257,7 +270,21 @@ roundtripTest testFieldsTransform fpath bs = do let y = y0 & L.packageDescription . L.description .~ mempty let x = x0 & L.packageDescription . L.description .~ mempty - assertEqual' bs' x y + -- Note: The pattern matching is to ensure this doesn't go unnoticed when new fields are added. + let checkField :: (Eq a, ToExpr a) => (GenericPackageDescription -> a) -> IO () + checkField field = assertEqual' bs' (field x) (field y) + let (GenericPackageDescription' _ _ _ _ _ _ _ _ _ _) = x0 + sequence_ + [ checkField packageDescription + , checkField gpdScannedVersion + , checkField genPackageFlags + , checkField condLibrary + , checkField condSubLibraries + , checkField condForeignLibs + , checkField condExecutables + , checkField condTestSuites + , checkField condBenchmarks + ] -- fromParsecField, "shallow" parser/pretty roundtrip when testFieldsTransform $ @@ -269,7 +296,7 @@ roundtripTest testFieldsTransform fpath bs = do z0 <- parse "3rd" (toUTF8BS bs'') -- note: we compare "raw" GPDs, on purpose; stricter equality - assertEqual' bs'' x0 z0 + assertEqualWith MergedGPD bs'' x0 z0 else putStrLn $ fpath ++ " : looks like invalid UTF8" @@ -287,11 +314,15 @@ roundtripTest testFieldsTransform fpath bs = do print err exitFailure - assertEqual' bs' x y = unless (x == y || fpath == "ixset/1.0.4/ixset.cabal") $ do + assertEqual' :: (ToExpr a, Eq a) => String -> a -> a -> IO () + assertEqual' = assertEqualWith id + + assertEqualWith :: (ToExpr expr, Eq a) => (a -> expr) -> String -> a -> a -> IO () + assertEqualWith f bs' x y = unless (x == y || fpath == "ixset/1.0.4/ixset.cabal") $ do putStrLn fpath #ifdef MIN_VERSION_tree_diff putStrLn "====== tree-diff:" - print $ ansiWlEditExprCompact $ ediff x y + print $ ansiWlEditExprCompact $ ediff (f x) (f x) #else putStrLn "<<<<<<" print x diff --git a/Cabal-tests/tests/NoThunks.hs b/Cabal-tests/tests/NoThunks.hs index a53d404dd1e..5f461447cfa 100644 --- a/Cabal-tests/tests/NoThunks.hs +++ b/Cabal-tests/tests/NoThunks.hs @@ -61,8 +61,11 @@ noThunksParse = do -- NoThunks instances ------------------------------------------------------------------------------- +instance NoThunks a => NoThunks (WithImports a) + instance NoThunks Arch instance NoThunks Benchmark +instance NoThunks BenchmarkStanza instance NoThunks BenchmarkInterface instance NoThunks BenchmarkType instance NoThunks BuildInfo @@ -112,6 +115,7 @@ instance NoThunks SourceRepo instance NoThunks IncludeRenaming instance NoThunks ModuleRenaming instance NoThunks TestSuite +instance NoThunks TestSuiteStanza instance NoThunks TestSuiteInterface instance NoThunks TestType instance NoThunks UnqualComponentName diff --git a/Cabal-tests/tests/ParserTests.hs b/Cabal-tests/tests/ParserTests.hs index 8368ed19451..4267f59cc63 100644 --- a/Cabal-tests/tests/ParserTests.hs +++ b/Cabal-tests/tests/ParserTests.hs @@ -10,11 +10,22 @@ import Test.Tasty import Test.Tasty.Golden.Advanced (goldenTest) import Test.Tasty.HUnit -import Control.Monad (unless, void) +import Control.Monad (void) import Data.Algorithm.Diff (PolyDiff (..), getGroupedDiff) import Data.Maybe (isNothing) import Distribution.Fields (pwarning) -import Distribution.PackageDescription (GenericPackageDescription) +import Distribution.PackageDescription + ( GenericPackageDescription + , packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary + , condSubLibraries + , condForeignLibs + , condExecutables + , condTestSuites + , condBenchmarks + ) import Distribution.PackageDescription.Parsec (parseGenericPackageDescription) import Distribution.PackageDescription.PrettyPrint (showGenericPackageDescription) import Distribution.Parsec (PWarnType (..), PWarning (..), showPErrorWithSource, showPWarningWithSource) @@ -35,12 +46,13 @@ import qualified Distribution.InstalledPackageInfo as IPI #ifdef MIN_VERSION_tree_diff import Data.TreeDiff (ansiWlEditExpr, ediff, toExpr) import Data.TreeDiff.Golden (ediffGolden) -import Data.TreeDiff.Instances.Cabal () +import Data.TreeDiff.Instances.Cabal (MergedGPD(..), UnmergedGPD(..)) #endif tests :: TestTree tests = testGroup "parsec tests" [ regressionTests + , internalAccessorsTests , warningTests , errorTests , ipiTests @@ -150,13 +162,41 @@ errorTest fp = cabalGoldenTest fp correct $ do input = "tests" "ParserTests" "errors" fp correct = replaceExtension input "errors" +------------------------------------------------------------------------------- +-- Internal accessors tests +------------------------------------------------------------------------------- + +internalAccessorsTests :: TestTree +internalAccessorsTests = testGroup "accessors" + [ +#ifdef MIN_VERSION_tree_diff + internalAccessorsTest "library-merging.cabal" +#endif + ] + +#ifdef MIN_VERSION_tree_diff +-- Here, we test the unmerged internal representation +internalAccessorsTest :: FilePath -> TestTree +internalAccessorsTest fp = ediffGolden goldenTest "expr" exprFile $ do + contents <- BS.readFile input + let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents + let (_, x) = runParseResult res + case x of + Right gpd -> pure (toExpr $ UnmergedGPD gpd) + Left (_, errs) -> fail $ unlines $ "ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE.toList errs) + where + input = "tests" "ParserTests" "accessors" fp + exprFile = replaceExtension input "expr" +#endif + ------------------------------------------------------------------------------- -- Regressions ------------------------------------------------------------------------------- regressionTests :: TestTree regressionTests = testGroup "regressions" - [ regressionTest "encoding-0.8.cabal" + [ regressionTest "supervisors-0.1.cabal" + , regressionTest "encoding-0.8.cabal" , regressionTest "Octree-0.5.cabal" , regressionTest "nothing-unicode.cabal" , regressionTest "multiple-libs-2.cabal" @@ -233,12 +273,12 @@ formatGoldenTest fp = cabalGoldenTest "format" correct $ do #ifdef MIN_VERSION_tree_diff treeDiffGoldenTest :: FilePath -> TestTree treeDiffGoldenTest fp = ediffGolden goldenTest "expr" exprFile $ do - contents <- BS.readFile input - let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents - let (_, x) = runParseResult res - case x of - Right gpd -> pure (toExpr gpd) - Left (_, errs) -> fail $ unlines $ "ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE.toList errs) + contents <- BS.readFile input + let res = withSource (PCabalFile (fp, contents)) $ parseGenericPackageDescription contents + let (_, x) = runParseResult res + case x of + Right gpd -> pure (toExpr $ MergedGPD gpd) + Left (_, errs) -> fail $ unlines $ "ERROR" : map (showPErrorWithSource . fmap renderCabalFileSource) (NE.toList errs) where input = "tests" "ParserTests" "regressions" fp exprFile = replaceExtension input "expr" @@ -250,24 +290,38 @@ formatRoundTripTest fp = testCase "roundtrip" $ do x <- parse contents let contents' = showGenericPackageDescription x y <- parse (toUTF8BS contents') - -- previously we mangled licenses a bit - let y' = y + + let checkField field = + field x == field y @? {- FOURMOLU_DISABLE -} - unless (x == y') $ #ifdef MIN_VERSION_tree_diff - assertFailure $ unlines - [ "re-parsed doesn't match" - , show $ ansiWlEditExpr $ ediff x y - ] + unlines + [ "re-parsed doesn't match" + , show $ ansiWlEditExpr $ ediff (MergedGPD x) (MergedGPD y) + ] #else - assertFailure $ unlines - [ "re-parsed doesn't match" - , "expected" - , show x - , "actual" - , show y - ] + unlines + [ "re-parsed doesn't match" + , "expected" + , show x + , "actual" + , show y + ] #endif + -- Due to the imports being merged, the structural comparison will fail + -- Instead, we check the equality after merging + sequence_ + [ checkField packageDescription + , checkField gpdScannedVersion + , checkField genPackageFlags + , checkField condLibrary + , checkField condSubLibraries + , checkField condForeignLibs + , checkField condExecutables + , checkField condTestSuites + , checkField condBenchmarks + ] + where parse :: BS.ByteString -> IO GenericPackageDescription parse c = do diff --git a/Cabal-tests/tests/ParserTests/accessors/library-merging.cabal b/Cabal-tests/tests/ParserTests/accessors/library-merging.cabal new file mode 100644 index 00000000000..6f8ed6ad6c0 --- /dev/null +++ b/Cabal-tests/tests/ParserTests/accessors/library-merging.cabal @@ -0,0 +1,30 @@ +cabal-version: 3.0 +name: Library-merging +version: 0 +synopsis: Tests the correctness of deferred merging in imports +build-type: Simple + +flag foo + manual: True + default: True + +common windows + if os(windows) + build-depends: Win32 + +common deps + import: windows + buildable: True + build-depends: + base >=4.10 && <4.11, + containers + +library + if flag(foo) + import: deps + + default-language: Haskell2010 + exposed-modules: ElseIf + + build-depends: + ghc-prim diff --git a/Cabal-tests/tests/ParserTests/accessors/library-merging.expr b/Cabal-tests/tests/ParserTests/accessors/library-merging.expr new file mode 100644 index 00000000000..55c1a679353 --- /dev/null +++ b/Cabal-tests/tests/ParserTests/accessors/library-merging.expr @@ -0,0 +1,429 @@ +`GenericPackageDescription (internal, unmerged)` { + packageDescriptionInternal = + PackageDescription { + specVersion = CabalSpecV3_0, + package = PackageIdentifier { + pkgName = PackageName + "Library-merging", + pkgVersion = mkVersion [0]}, + licenseRaw = Left NONE, + licenseFiles = [], + copyright = "", + maintainer = "", + author = "", + stability = "", + testedWith = [], + homepage = "", + pkgUrl = "", + bugReports = "", + sourceRepos = [], + synopsis = + "Tests the correctness of deferred merging in imports", + description = "", + category = "", + customFieldsPD = [], + buildTypeRaw = Just Simple, + setupBuildInfo = Nothing, + library = Nothing, + subLibraries = [], + executables = [], + foreignLibs = [], + testSuites = [], + benchmarks = [], + dataFiles = [], + dataDir = SymbolicPath ".", + extraSrcFiles = [], + extraTmpFiles = [], + extraDocFiles = [], + extraFiles = []}, + gpdScannedVersionInternal = + Nothing, + genPackageFlagsInternal = [ + MkPackageFlag { + flagName = FlagName "foo", + flagDescription = "", + flagDefault = True, + flagManual = True}], + gpdCommonStanzas = Map.fromList + [ + _×_ + "deps" + CondNode { + condTreeData = WithImports { + getImportNames = ["windows"], + unImportNames = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Nothing, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 10])) + (EarlierVersion + (mkVersion [4, 11]))) + mainLibSet, + Dependency + (PackageName "containers") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + mixins = []}}, + condTreeConstraints = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 10])) + (EarlierVersion + (mkVersion [4, 11]))) + mainLibSet, + Dependency + (PackageName "containers") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + condTreeComponents = []}, + _×_ + "windows" + CondNode { + condTreeData = WithImports { + getImportNames = [], + unImportNames = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Nothing, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [], + mixins = []}}, + condTreeConstraints = [], + condTreeComponents = [ + CondBranch { + condBranchCondition = + `Var (OS Windows)`, + condBranchIfTrue = CondNode { + condTreeData = WithImports { + getImportNames = [], + unImportNames = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Nothing, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [ + Dependency + (PackageName "Win32") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + mixins = []}}, + condTreeConstraints = [ + Dependency + (PackageName "Win32") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + condTreeComponents = []}, + condBranchIfFalse = Nothing}]}], + condLibraryUnmerged = Just + CondNode { + condTreeData = WithImports { + getImportNames = [], + unImportNames = Library { + libName = LMainLibName, + exposedModules = [ + ModuleName "ElseIf"], + reexportedModules = [], + signatures = [], + libExposed = True, + libVisibility = + LibraryVisibilityPublic, + libBuildInfo = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Just + Haskell2010, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [ + Dependency + (PackageName "ghc-prim") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + mixins = []}}}, + condTreeConstraints = [ + Dependency + (PackageName "ghc-prim") + (OrLaterVersion (mkVersion [0])) + mainLibSet], + condTreeComponents = [ + CondBranch { + condBranchCondition = + `Var (PackageFlag (FlagName "foo"))`, + condBranchIfTrue = CondNode { + condTreeData = WithImports { + getImportNames = ["deps"], + unImportNames = Library { + libName = LMainLibName, + exposedModules = [], + reexportedModules = [], + signatures = [], + libExposed = True, + libVisibility = + LibraryVisibilityPublic, + libBuildInfo = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Nothing, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [], + mixins = []}}}, + condTreeConstraints = [], + condTreeComponents = []}, + condBranchIfFalse = Nothing}]}, + condSubLibrariesUnmerged = [], + condForeignLibsUnmerged = [], + condExecutablesUnmerged = [], + condTestSuitesUnmerged = [], + condBenchmarksUnmerged = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr index 634b27b8828..39ca62afa5c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr +++ b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_8, @@ -86,11 +86,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -199,11 +199,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -303,11 +303,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/anynone.expr b/Cabal-tests/tests/ParserTests/regressions/anynone.expr index 927605d6058..60cbc7ed3e5 100644 --- a/Cabal-tests/tests/ParserTests/regressions/anynone.expr +++ b/Cabal-tests/tests/ParserTests/regressions/anynone.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -52,11 +52,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/big-version.expr b/Cabal-tests/tests/ParserTests/regressions/big-version.expr index 4d3659e4592..5d1f2a96555 100644 --- a/Cabal-tests/tests/ParserTests/regressions/big-version.expr +++ b/Cabal-tests/tests/ParserTests/regressions/big-version.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -53,11 +53,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr index 41e0fd5377a..10c1d9b3560 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -69,11 +69,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -148,11 +148,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -242,11 +242,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -323,11 +323,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -402,11 +402,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -474,11 +474,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -569,11 +569,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -649,11 +649,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common.expr b/Cabal-tests/tests/ParserTests/regressions/common.expr index e8c766460f2..e3e48a85e05 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_10, @@ -67,11 +67,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -147,11 +147,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common2.expr b/Cabal-tests/tests/ParserTests/regressions/common2.expr index af882207fc4..511068d8dca 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -63,11 +63,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -166,11 +166,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -248,11 +248,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -353,11 +353,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -432,11 +432,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -535,11 +535,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -615,11 +615,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -695,11 +695,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/common3.expr b/Cabal-tests/tests/ParserTests/regressions/common3.expr index be783c4cab6..7f62556ccab 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common3.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -67,11 +67,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -147,11 +147,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/elif.expr b/Cabal-tests/tests/ParserTests/regressions/elif.expr index e04821eaaef..1d9953c1124 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_10, @@ -62,11 +62,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -133,11 +133,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/elif2.expr b/Cabal-tests/tests/ParserTests/regressions/elif2.expr index 88eb02d59d7..5574f3ce6af 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -62,11 +62,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -133,11 +133,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -209,11 +209,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -279,11 +279,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -355,11 +355,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr index 02c4a4222c7..0c927847faa 100644 --- a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr +++ b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_12, @@ -67,11 +67,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr index a7cdf1a4300..9ad31c564ea 100644 --- a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr +++ b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_10, @@ -163,11 +163,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -334,11 +334,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -421,11 +421,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -526,11 +526,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -599,11 +599,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -673,11 +673,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -771,11 +771,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr index 9dfa089a3d5..19f1a11332d 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -268,11 +268,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -603,11 +603,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -848,11 +848,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1051,11 +1051,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1391,11 +1391,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2713,11 +2713,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2805,11 +2805,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -5034,11 +5034,11 @@ GenericPackageDescription { cppOptions = [ "-DCUDA", "-DHASKTORCH_INTERNAL_CUDA"], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -6406,11 +6406,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -6499,11 +6499,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -8169,11 +8169,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -8660,11 +8660,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9426,11 +9426,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9549,11 +9549,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9657,11 +9657,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9765,11 +9765,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9862,11 +9862,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -9960,11 +9960,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr index 553b88dc595..bd1aabaae83 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -54,11 +54,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation.expr b/Cabal-tests/tests/ParserTests/regressions/indentation.expr index f36a8997717..961ad7039c0 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -63,11 +63,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr index 11afbcfd5d3..2fb2d3a29d2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -56,11 +56,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr index 964bad3f924..9b5f32ac67d 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -58,11 +58,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr index 996fa26eece..9a1480dec6e 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_0, @@ -57,11 +57,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -143,11 +143,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -231,11 +231,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr index c3e08359046..7d771c56366 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -51,11 +51,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr index 001d3c86515..62a3b797f25 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_4, @@ -51,11 +51,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -149,11 +149,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -219,11 +219,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -302,11 +302,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr index ca99e3d554f..bbaa551f762 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -51,11 +51,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -149,11 +149,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -219,11 +219,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -312,11 +312,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr index b2f47a1a938..6423d203fe9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_4, @@ -51,11 +51,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -149,11 +149,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr index ce7c453e697..2e5a1f95888 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -51,11 +51,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr index 4aeb65cb960..fd5d9db56a2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_12, @@ -61,11 +61,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr index b6dc81fee1b..e5e2a7360d4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr +++ b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -93,11 +93,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -194,11 +194,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -361,11 +361,11 @@ GenericPackageDescription { (MajorBoundVersion (mkVersion [4, 2, 1]))], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr index 3a1d7d5f075..0003883155b 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -61,11 +61,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr index 230ebf53136..178cbbc4b92 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -54,11 +54,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr index b331abffcca..a94ab8008cd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_8, @@ -144,11 +144,11 @@ GenericPackageDescription { (mkVersion [0]))], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -250,11 +250,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -337,11 +337,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -424,11 +424,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [ @@ -499,11 +499,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -569,11 +569,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -637,11 +637,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -707,11 +707,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr index 9f6a16ada6e..8b0e3b97b8a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -149,11 +149,11 @@ GenericPackageDescription { (OrLaterVersion (mkVersion [0]))], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -255,11 +255,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -342,11 +342,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -429,11 +429,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [ @@ -501,11 +501,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -571,11 +571,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -639,11 +639,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -709,11 +709,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr index 0a137660468..38b758ab957 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_0, @@ -55,11 +55,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr index 6c2239df825..c0c7a1996a7 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -55,11 +55,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr index a4a94aac32c..66b14ffa8fd 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -55,11 +55,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr index db28c928ddb..4fb92e2c6d9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr +++ b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_0, @@ -63,11 +63,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr index d2f1efdd913..3a4f41e4c4a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_0, @@ -54,11 +54,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -135,11 +135,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr index 838f87733eb..4290a5aa6f3 100644 --- a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr +++ b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_22, @@ -54,11 +54,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr index ccfe4421c7b..83431baf6d2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr +++ b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_10, @@ -69,11 +69,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -140,11 +140,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/shake.expr b/Cabal-tests/tests/ParserTests/regressions/shake.expr index 5be08b04064..a03f2ebca23 100644 --- a/Cabal-tests/tests/ParserTests/regressions/shake.expr +++ b/Cabal-tests/tests/ParserTests/regressions/shake.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_18, @@ -189,11 +189,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -480,11 +480,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = ["-DPORTABLE"], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -550,11 +550,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -627,11 +627,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -697,11 +697,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -778,11 +778,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -857,11 +857,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1183,11 +1183,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1253,11 +1253,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = ["-DPORTABLE"], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1320,11 +1320,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1394,11 +1394,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1461,11 +1461,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1539,11 +1539,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1617,11 +1617,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -1992,11 +1992,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2064,11 +2064,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2136,11 +2136,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = ["-DPORTABLE"], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2207,11 +2207,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2285,11 +2285,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2356,11 +2356,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -2438,11 +2438,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr index 88500d2d365..e03bcd3f3f1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_0, @@ -52,11 +52,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr index 9cd00ea1103..0e6076c9ef1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_2, @@ -56,11 +56,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr index e8b2eca8989..23b8aded4ca 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV2_4, @@ -56,11 +56,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.cabal b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.cabal new file mode 100644 index 00000000000..7383cc88244 --- /dev/null +++ b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.cabal @@ -0,0 +1,68 @@ +cabal-version: 2.2 +name: supervisors +version: 0.2.1.0 +stability: Experimental +synopsis: Monitor groups of threads with non-hierarchical lifetimes. +description: + The @supervisors@ package provides a useful abstraction for managing the + groups of Haskell threads, which may not have a strictly hierarchical + structure to their lifetimes. + . + Concretely, the library provides a `Supervisor` construct, which can be + used to safely spawn threads while guaranteeing that: + . + * When the supervisor is killed, all of the threads it supervises will be + killed. + * Child threads can terminate in any order, and memory usage will always + be proportional to the number of *live* supervised threads. + . + One way to think of it is that @supervisors@ is to @async@ as + @resourcet@ is to @bracket@. + . + Note that this package is EXPERIMENTAL; it needs more careful testing before + I can earnestly recommend relying on it. + . + See the README and module documentation for more information. +homepage: https://github.com/zenhack/haskell-supervisors +bug-reports: https://github.com/zenhack/haskell-supervisors/issues +license: MIT +license-file: LICENSE +author: Ian Denhardt +maintainer: ian@zenhack.net +copyright: 2018 Ian Denhardt +category: Concurrency +build-type: Simple +extra-source-files: + CHANGELOG.md + , README.md + , .gitignore + +common shared-opts + build-depends: + base >=4.11 && <5 + +library + import: shared-opts + exposed-modules: Supervisors + hs-source-dirs: src/ + build-depends: + stm ^>=2.5 + , containers >=0.5.9 && <0.7 + , safe-exceptions ^>= 0.1.7 + , async ^>=2.2.1 + default-language: Haskell2010 + +test-suite tests + import: shared-opts + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: tests/ + build-depends: + supervisors + , hspec >=2.6.0 && <2.8 + default-language: Haskell2010 + +source-repository head + type: git + branch: master + location: https://github.com/zenhack/haskell-supervisors.git diff --git a/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.expr b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.expr new file mode 100644 index 00000000000..2e2c3a7f1b5 --- /dev/null +++ b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.expr @@ -0,0 +1,330 @@ +`GenericPackageDescription (merged)` { + packageDescription = + PackageDescription { + specVersion = CabalSpecV2_2, + package = PackageIdentifier { + pkgName = PackageName + "supervisors", + pkgVersion = mkVersion + [0, 2, 1, 0]}, + licenseRaw = Left + (License + (ELicense + (ELicenseId MIT) + Nothing)), + licenseFiles = [ + SymbolicPath "LICENSE"], + copyright = "2018 Ian Denhardt", + maintainer = "ian@zenhack.net", + author = "Ian Denhardt", + stability = "Experimental", + testedWith = [], + homepage = + "https://github.com/zenhack/haskell-supervisors", + pkgUrl = "", + bugReports = + "https://github.com/zenhack/haskell-supervisors/issues", + sourceRepos = [ + SourceRepo { + repoKind = RepoHead, + repoType = Just + (KnownRepoType Git), + repoLocation = Just + "https://github.com/zenhack/haskell-supervisors.git", + repoModule = Nothing, + repoBranch = Just "master", + repoTag = Nothing, + repoSubdir = Nothing}], + synopsis = + "Monitor groups of threads with non-hierarchical lifetimes.", + description = + concat + [ + "The @supervisors@ package provides a useful abstraction for managing the\n", + "groups of Haskell threads, which may not have a strictly hierarchical\n", + "structure to their lifetimes.\n", + "\n", + "Concretely, the library provides a `Supervisor` construct, which can be\n", + "used to safely spawn threads while guaranteeing that:\n", + "\n", + "* When the supervisor is killed, all of the threads it supervises will be\n", + "killed.\n", + "* Child threads can terminate in any order, and memory usage will always\n", + "be proportional to the number of *live* supervised threads.\n", + "\n", + "One way to think of it is that @supervisors@ is to @async@ as\n", + "@resourcet@ is to @bracket@.\n", + "\n", + "Note that this package is EXPERIMENTAL; it needs more careful testing before\n", + "I can earnestly recommend relying on it.\n", + "\n", + "See the README and module documentation for more information."], + category = "Concurrency", + customFieldsPD = [], + buildTypeRaw = Just Simple, + setupBuildInfo = Nothing, + library = Nothing, + subLibraries = [], + executables = [], + foreignLibs = [], + testSuites = [], + benchmarks = [], + dataFiles = [], + dataDir = SymbolicPath ".", + extraSrcFiles = [ + SymbolicPath "CHANGELOG.md", + SymbolicPath "README.md", + SymbolicPath ".gitignore"], + extraTmpFiles = [], + extraDocFiles = [], + extraFiles = []}, + gpdScannedVersion = Nothing, + genPackageFlags = [], + condLibrary = Just + CondNode { + condTreeData = Library { + libName = LMainLibName, + exposedModules = [ + ModuleName "Supervisors"], + reexportedModules = [], + signatures = [], + libExposed = True, + libVisibility = + LibraryVisibilityPublic, + libBuildInfo = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [ + SymbolicPath "src/"], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Just + Haskell2010, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 11])) + (EarlierVersion + (mkVersion [5]))) + mainLibSet, + Dependency + (PackageName "stm") + (MajorBoundVersion + (mkVersion [2, 5])) + mainLibSet, + Dependency + (PackageName "containers") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [0, 5, 9])) + (EarlierVersion + (mkVersion [0, 7]))) + mainLibSet, + Dependency + (PackageName "safe-exceptions") + (MajorBoundVersion + (mkVersion [0, 1, 7])) + mainLibSet, + Dependency + (PackageName "async") + (MajorBoundVersion + (mkVersion [2, 2, 1])) + mainLibSet], + mixins = []}}, + condTreeConstraints = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 11])) + (EarlierVersion + (mkVersion [5]))) + mainLibSet, + Dependency + (PackageName "stm") + (MajorBoundVersion + (mkVersion [2, 5])) + mainLibSet, + Dependency + (PackageName "containers") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [0, 5, 9])) + (EarlierVersion + (mkVersion [0, 7]))) + mainLibSet, + Dependency + (PackageName "safe-exceptions") + (MajorBoundVersion + (mkVersion [0, 1, 7])) + mainLibSet, + Dependency + (PackageName "async") + (MajorBoundVersion + (mkVersion [2, 2, 1])) + mainLibSet], + condTreeComponents = []}, + condSubLibraries = [], + condForeignLibs = [], + condExecutables = [], + condTestSuites = [ + _×_ + (UnqualComponentName "tests") + CondNode { + condTreeData = TestSuite { + testName = UnqualComponentName + "", + testInterface = TestSuiteExeV10 + (mkVersion [1, 0]) + (SymbolicPath "Main.hs"), + testBuildInfo = BuildInfo { + buildable = True, + buildTools = [], + buildToolDepends = [], + cppOptions = [], + asmOptions = [], + cmmOptions = [], + ccOptions = [], + cxxOptions = [], + jsppOptions = [], + ldOptions = [], + hsc2hsOptions = [], + pkgconfigDepends = [], + frameworks = [], + extraFrameworkDirs = [], + asmSources = [], + cmmSources = [], + cSources = [], + cxxSources = [], + jsSources = [], + hsSourceDirs = [ + SymbolicPath "tests/"], + otherModules = [], + virtualModules = [], + autogenModules = [], + defaultLanguage = Just + Haskell2010, + otherLanguages = [], + defaultExtensions = [], + otherExtensions = [], + oldExtensions = [], + extraLibs = [], + extraLibsStatic = [], + extraGHCiLibs = [], + extraBundledLibs = [], + extraLibFlavours = [], + extraDynLibFlavours = [], + extraLibDirs = [], + extraLibDirsStatic = [], + includeDirs = [], + includes = [], + autogenIncludes = [], + installIncludes = [], + options = PerCompilerFlavor + [] + [], + profOptions = PerCompilerFlavor + [] + [], + sharedOptions = + PerCompilerFlavor [] [], + profSharedOptions = + PerCompilerFlavor [] [], + staticOptions = + PerCompilerFlavor [] [], + customFieldsBI = [], + targetBuildDepends = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 11])) + (EarlierVersion + (mkVersion [5]))) + mainLibSet, + Dependency + (PackageName "supervisors") + (OrLaterVersion (mkVersion [0])) + mainLibSet, + Dependency + (PackageName "hspec") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [2, 6, 0])) + (EarlierVersion + (mkVersion [2, 8]))) + mainLibSet], + mixins = []}, + testCodeGenerators = []}, + condTreeConstraints = [ + Dependency + (PackageName "base") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [4, 11])) + (EarlierVersion + (mkVersion [5]))) + mainLibSet, + Dependency + (PackageName "supervisors") + (OrLaterVersion (mkVersion [0])) + mainLibSet, + Dependency + (PackageName "hspec") + (IntersectVersionRanges + (OrLaterVersion + (mkVersion [2, 6, 0])) + (EarlierVersion + (mkVersion [2, 8]))) + mainLibSet], + condTreeComponents = []}], + condBenchmarks = []} diff --git a/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.format b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.format new file mode 100644 index 00000000000..036bc904e3f --- /dev/null +++ b/Cabal-tests/tests/ParserTests/regressions/supervisors-0.1.format @@ -0,0 +1,65 @@ +cabal-version: 2.2 +name: supervisors +version: 0.2.1.0 +license: MIT +license-file: LICENSE +copyright: 2018 Ian Denhardt +maintainer: ian@zenhack.net +author: Ian Denhardt +stability: Experimental +homepage: https://github.com/zenhack/haskell-supervisors +bug-reports: https://github.com/zenhack/haskell-supervisors/issues +synopsis: Monitor groups of threads with non-hierarchical lifetimes. +description: + The @supervisors@ package provides a useful abstraction for managing the + groups of Haskell threads, which may not have a strictly hierarchical + structure to their lifetimes. + . + Concretely, the library provides a `Supervisor` construct, which can be + used to safely spawn threads while guaranteeing that: + . + * When the supervisor is killed, all of the threads it supervises will be + killed. + * Child threads can terminate in any order, and memory usage will always + be proportional to the number of *live* supervised threads. + . + One way to think of it is that @supervisors@ is to @async@ as + @resourcet@ is to @bracket@. + . + Note that this package is EXPERIMENTAL; it needs more careful testing before + I can earnestly recommend relying on it. + . + See the README and module documentation for more information. + +category: Concurrency +build-type: Simple +extra-source-files: + CHANGELOG.md + README.md + .gitignore + +source-repository head + type: git + location: https://github.com/zenhack/haskell-supervisors.git + branch: master + +library + exposed-modules: Supervisors + hs-source-dirs: src/ + default-language: Haskell2010 + build-depends: + base >=4.11 && <5, + stm ^>=2.5, + containers >=0.5.9 && <0.7, + safe-exceptions ^>=0.1.7, + async ^>=2.2.1 + +test-suite tests + type: exitcode-stdio-1.0 + main-is: Main.hs + hs-source-dirs: tests/ + default-language: Haskell2010 + build-depends: + base >=4.11 && <5, + supervisors, + hspec >=2.6.0 && <2.8 diff --git a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr index 2db686aa40f..d95e8e5e8e0 100644 --- a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr +++ b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_10, @@ -81,11 +81,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -254,11 +254,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -435,11 +435,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -544,11 +544,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr index c086ae618aa..f9bf16c77e8 100644 --- a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr +++ b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV3_0, @@ -78,11 +78,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr index e4e6a457a3d..49f849e44ac 100644 --- a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr +++ b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr @@ -1,4 +1,4 @@ -GenericPackageDescription { +`GenericPackageDescription (merged)` { packageDescription = PackageDescription { specVersion = CabalSpecV1_6, @@ -72,11 +72,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], @@ -161,11 +161,11 @@ GenericPackageDescription { buildTools = [], buildToolDepends = [], cppOptions = [], - jsppOptions = [], asmOptions = [], cmmOptions = [], ccOptions = [], cxxOptions = [], + jsppOptions = [], ldOptions = [], hsc2hsOptions = [], pkgconfigDepends = [], diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 129f8d0d85c..6be8ff30239 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -29,7 +29,7 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion md5CheckGenericPackageDescription proxy = md5Check proxy - 0xc039c6741dead5203ad2b33bd3bf4dc8 + 0xf530c0714e09f028a58ab1527d235e0f md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy diff --git a/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs b/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs index fc2268bad56..7f499e3b3aa 100644 --- a/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs +++ b/Cabal-tests/tests/custom-setup/CabalDoctestSetup.hs @@ -143,7 +143,9 @@ import Distribution.Types.UnqualComponentName import Distribution.PackageDescription (CondTree (..)) import Distribution.Types.GenericPackageDescription - (GenericPackageDescription (condTestSuites)) + ( GenericPackageDescription + , condTestSuites + ) import Distribution.Version (mkVersion) diff --git a/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs b/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs index f7e7ca5b7b6..0ac2647ffff 100644 --- a/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs +++ b/Cabal-tree-diff/src/Data/TreeDiff/Instances/Cabal.hs @@ -1,8 +1,15 @@ +{-# LANGUAGE NamedFieldPuns #-} +{-# LANGUAGE ViewPatterns #-} {-# OPTIONS_GHC -freduction-depth=0 #-} {-# OPTIONS_GHC -Wno-orphans #-} -module Data.TreeDiff.Instances.Cabal () where +module Data.TreeDiff.Instances.Cabal + ( UnmergedGPD(..) + , MergedGPD(..) + ) + where import Data.TreeDiff +import qualified Data.TreeDiff.OMap as OMap import Data.TreeDiff.Instances.CabalLanguage () import Data.TreeDiff.Instances.CabalSPDX () @@ -56,10 +63,76 @@ instance ToExpr (SymbolicPathX allowAbs from to) instance ToExpr a => ToExpr (InstallDirs a) +instance ToExpr a => ToExpr (WithImports a) + +newtype MergedGPD = MergedGPD { getMergedGPD :: GenericPackageDescription } +newtype UnmergedGPD = UnmergedGPD { getUnmergedGPD :: GenericPackageDescription } + +-- Note: The pattern matching is to ensure this doesn't go unnoticed when new fields are added. +instance ToExpr UnmergedGPD where + toExpr + ( getUnmergedGPD -> GenericPackageDescription' + { packageDescriptionInternal + , gpdScannedVersionInternal + , genPackageFlagsInternal + , gpdCommonStanzas + , condLibraryUnmerged + , condSubLibrariesUnmerged + , condForeignLibsUnmerged + , condExecutablesUnmerged + , condTestSuitesUnmerged + , condBenchmarksUnmerged + } + ) = Rec + "GenericPackageDescription (internal, unmerged)" + ( OMap.fromList + [ ("packageDescriptionInternal", toExpr packageDescriptionInternal) + , ("gpdScannedVersionInternal", toExpr gpdScannedVersionInternal) + , ("genPackageFlagsInternal", toExpr genPackageFlagsInternal) + , ("gpdCommonStanzas", toExpr gpdCommonStanzas) + , ("condLibraryUnmerged", toExpr condLibraryUnmerged) + , ("condSubLibrariesUnmerged", toExpr condSubLibrariesUnmerged) + , ("condForeignLibsUnmerged", toExpr condForeignLibsUnmerged) + , ("condExecutablesUnmerged", toExpr condExecutablesUnmerged) + , ("condTestSuitesUnmerged", toExpr condTestSuitesUnmerged) + , ("condBenchmarksUnmerged", toExpr condBenchmarksUnmerged) + ] + ) + + +instance ToExpr MergedGPD where + toExpr + ( getMergedGPD -> GenericPackageDescription + { packageDescription + , gpdScannedVersion + , genPackageFlags + , condLibrary + , condSubLibraries + , condForeignLibs + , condExecutables + , condTestSuites + , condBenchmarks + } + ) = Rec + "GenericPackageDescription (merged)" + ( OMap.fromList + [ ("packageDescription", toExpr packageDescription) + , ("gpdScannedVersion", toExpr gpdScannedVersion) + , ("genPackageFlags", toExpr genPackageFlags) + , ("condLibrary", toExpr condLibrary) + , ("condSubLibraries", toExpr condSubLibraries) + , ("condForeignLibs", toExpr condForeignLibs) + , ("condExecutables", toExpr condExecutables) + , ("condTestSuites", toExpr condTestSuites) + , ("condBenchmarks", toExpr condBenchmarks) + ] + ) + instance ToExpr AbiDependency instance ToExpr AbiHash instance ToExpr Arch instance ToExpr Benchmark +instance ToExpr BenchmarkStanza instance ToExpr BenchmarkInterface instance ToExpr BenchmarkType instance ToExpr BuildInfo @@ -80,7 +153,6 @@ instance ToExpr FlagName instance ToExpr ForeignLib instance ToExpr ForeignLibOption instance ToExpr ForeignLibType -instance ToExpr GenericPackageDescription instance ToExpr HaddockTarget instance ToExpr IncludeRenaming instance ToExpr InstalledPackageInfo @@ -117,6 +189,7 @@ instance ToExpr SetupBuildInfo instance ToExpr SourceRepo instance ToExpr TestShowDetails instance ToExpr TestSuite +instance ToExpr TestSuiteStanza instance ToExpr TestSuiteInterface instance ToExpr TestType instance ToExpr UnitId diff --git a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs index 72d0b8193e3..38dc41e0885 100644 --- a/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs +++ b/cabal-install-solver/src/Distribution/Solver/Modular/IndexConversion.hs @@ -218,7 +218,7 @@ convGPD os arch cinfo constraints strfl solveExes pn libComps = [ (ExposedLib LMainLibName, libToComponentInfo lib) | lib <- maybeToList mlib ] subLibComps = [ (ExposedLib (LSubLibName name), libToComponentInfo lib) - | (name, lib) <- sub_libs ] + | (name, lib) <- sub_libs ] exeComps = [ ( ExposedExe name , ComponentInfo { compIsVisible = IsVisible True diff --git a/cabal-install/src/Distribution/Client/IndexUtils.hs b/cabal-install/src/Distribution/Client/IndexUtils.hs index f85db2b74c1..8d30ac06c73 100644 --- a/cabal-install/src/Distribution/Client/IndexUtils.hs +++ b/cabal-install/src/Distribution/Client/IndexUtils.hs @@ -4,6 +4,7 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TupleSections #-} @@ -80,7 +81,17 @@ import Distribution.Package import Distribution.PackageDescription ( GenericPackageDescription (..) , PackageDescription (..) + , condBenchmarks + , condExecutables + , condForeignLibs + , condLibrary + , condSubLibraries + , condTestSuites , emptyPackageDescription + , genPackageFlags + , gpdScannedVersion + , packageDescription + , pattern GenericPackageDescription ) import Distribution.Simple.Compiler import qualified Distribution.Simple.Configure as Configure diff --git a/cabal-install/src/Distribution/Client/Install.hs b/cabal-install/src/Distribution/Client/Install.hs index bd28046db6e..fb779cc1029 100644 --- a/cabal-install/src/Distribution/Client/Install.hs +++ b/cabal-install/src/Distribution/Client/Install.hs @@ -163,8 +163,8 @@ import Distribution.Package , packageVersion ) import Distribution.PackageDescription - ( GenericPackageDescription (..) - , PackageDescription + ( PackageDescription + , genPackageFlags ) import qualified Distribution.PackageDescription as PackageDescription import Distribution.PackageDescription.Configuration diff --git a/cabal-install/src/Distribution/Client/ScriptUtils.hs b/cabal-install/src/Distribution/Client/ScriptUtils.hs index 1c78d537c19..4e437d28766 100644 --- a/cabal-install/src/Distribution/Client/ScriptUtils.hs +++ b/cabal-install/src/Distribution/Client/ScriptUtils.hs @@ -157,6 +157,7 @@ import Distribution.Types.Executable import Distribution.Types.GenericPackageDescription as GPD ( GenericPackageDescription (..) , emptyGenericPackageDescription + , packageDescription ) import Distribution.Types.PackageDescription ( PackageDescription (..) diff --git a/cabal-install/src/Distribution/Client/SetupWrapper.hs b/cabal-install/src/Distribution/Client/SetupWrapper.hs index 69c8f888698..f11790c7441 100644 --- a/cabal-install/src/Distribution/Client/SetupWrapper.hs +++ b/cabal-install/src/Distribution/Client/SetupWrapper.hs @@ -48,7 +48,7 @@ import Distribution.Package ) import Distribution.PackageDescription ( BuildType (..) - , GenericPackageDescription (packageDescription) + , packageDescription , PackageDescription (..) , buildType , specVersion