From 41a611eb5a62813b87cfcb4a9bc448535a761fee Mon Sep 17 00:00:00 2001 From: jgotoh <18658140+jgotoh@users.noreply.github.com> Date: Sun, 11 Aug 2024 23:43:53 +0200 Subject: [PATCH] Add parsing of profiling-shared and use-unicode --- .../src/Distribution/Client/ProjectConfig/FieldGrammar.hs | 2 ++ .../src/Distribution/Client/ProjectConfig/Lens.hs | 8 ++++++++ .../PackageTests/ProjectConfig/Parsec/cabal.test.hs | 2 ++ .../tests/project-config-local-packages/cabal.project | 2 ++ 4 files changed, 14 insertions(+) diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/FieldGrammar.hs b/cabal-install/src/Distribution/Client/ProjectConfig/FieldGrammar.hs index dcc888037f3..ab30818d2cf 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/FieldGrammar.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/FieldGrammar.hs @@ -121,6 +121,7 @@ packageConfigFieldGrammar knownPrograms = <*> optionalFieldDef "executable-static" L.packageConfigFullyStaticExe mempty <*> optionalFieldDef "profiling" L.packageConfigProf mempty <*> optionalFieldDef "library-profiling" L.packageConfigProfLib mempty + <*> optionalFieldDef "profiling-shared" L.packageConfigProfShared mempty <*> optionalFieldDef "executable-profiling" L.packageConfigProfExe mempty <*> optionalFieldDef "profiling-detail" L.packageConfigProfDetail mempty <*> optionalFieldDef "library-profiling-detail" L.packageConfigProfLibDetail mempty @@ -162,6 +163,7 @@ packageConfigFieldGrammar knownPrograms = <*> optionalFieldDefAla "haddock-base-url" (alaFlag Token) L.packageConfigHaddockBaseUrl mempty <*> optionalFieldDefAla "haddock-resources-dir" (alaFlag Token) L.packageConfigHaddockResourcesDir mempty <*> optionalFieldDefAla "haddock-output-dir" (alaFlag FilePathNT) L.packageConfigHaddockOutputDir mempty + <*> optionalFieldDef "haddock-use-unicode" L.packageConfigHaddockUseUnicode mempty <*> optionalFieldDef "haddock-for-hackage" L.packageConfigHaddockForHackage mempty <*> optionalFieldDef "test-log" L.packageConfigTestHumanLog mempty <*> optionalFieldDef "test-machine-log" L.packageConfigTestMachineLog mempty diff --git a/cabal-install/src/Distribution/Client/ProjectConfig/Lens.hs b/cabal-install/src/Distribution/Client/ProjectConfig/Lens.hs index cebf2993ea2..cb6c2c60fa9 100644 --- a/cabal-install/src/Distribution/Client/ProjectConfig/Lens.hs +++ b/cabal-install/src/Distribution/Client/ProjectConfig/Lens.hs @@ -348,6 +348,10 @@ packageConfigProfLib :: Lens' PackageConfig (Flag Bool) packageConfigProfLib f s = fmap (\x -> s{T.packageConfigProfLib = x}) (f (T.packageConfigProfLib s)) {-# INLINEABLE packageConfigProfLib #-} +packageConfigProfShared :: Lens' PackageConfig (Flag Bool) +packageConfigProfShared f s = fmap (\x -> s{T.packageConfigProfShared = x}) (f (T.packageConfigProfShared s)) +{-# INLINEABLE packageConfigProfShared #-} + packageConfigProfExe :: Lens' PackageConfig (Flag Bool) packageConfigProfExe f s = fmap (\x -> s{T.packageConfigProfExe = x}) (f (T.packageConfigProfExe s)) {-# INLINEABLE packageConfigProfExe #-} @@ -512,6 +516,10 @@ packageConfigHaddockOutputDir :: Lens' PackageConfig (Flag FilePath) packageConfigHaddockOutputDir f s = fmap (\x -> s{T.packageConfigHaddockOutputDir = x}) (f (T.packageConfigHaddockOutputDir s)) {-# INLINEABLE packageConfigHaddockOutputDir #-} +packageConfigHaddockUseUnicode :: Lens' PackageConfig (Flag Bool) +packageConfigHaddockUseUnicode f s = fmap (\x -> s{T.packageConfigHaddockUseUnicode = x}) (f (T.packageConfigHaddockUseUnicode s)) +{-# INLINEABLE packageConfigHaddockUseUnicode #-} + packageConfigHaddockForHackage :: Lens' PackageConfig (Flag HaddockTarget) packageConfigHaddockForHackage f s = fmap (\x -> s{T.packageConfigHaddockForHackage = x}) (f (T.packageConfigHaddockForHackage s)) {-# INLINEABLE packageConfigHaddockForHackage #-} diff --git a/cabal-testsuite/PackageTests/ProjectConfig/Parsec/cabal.test.hs b/cabal-testsuite/PackageTests/ProjectConfig/Parsec/cabal.test.hs index dd3ac2c9899..bf1f562e597 100644 --- a/cabal-testsuite/PackageTests/ProjectConfig/Parsec/cabal.test.hs +++ b/cabal-testsuite/PackageTests/ProjectConfig/Parsec/cabal.test.hs @@ -344,6 +344,7 @@ testProjectConfigLocalPackages = do packageConfigFullyStaticExe = Flag True packageConfigProf = Flag True packageConfigProfLib = Flag True + packageConfigProfShared = Flag False packageConfigProfExe = Flag True packageConfigProfDetail = Flag ProfDetailAllFunctions packageConfigProfLibDetail = Flag ProfDetailExportedFunctions @@ -386,6 +387,7 @@ testProjectConfigLocalPackages = do packageConfigHaddockBaseUrl = Flag "https://example.com/haddock-base-url" packageConfigHaddockResourcesDir = Flag "/haddock/static" packageConfigHaddockOutputDir = Flag "/haddock/output" + packageConfigHaddockUseUnicode = Flag False packageConfigHaddockForHackage = Flag ForHackage packageConfigTestHumanLog = Flag $ toPathTemplate "human-log.log" packageConfigTestMachineLog = Flag $ toPathTemplate "machine.log" diff --git a/cabal-testsuite/PackageTests/ProjectConfig/Parsec/tests/project-config-local-packages/cabal.project b/cabal-testsuite/PackageTests/ProjectConfig/Parsec/tests/project-config-local-packages/cabal.project index b173b3dc45e..77ffb93ff00 100644 --- a/cabal-testsuite/PackageTests/ProjectConfig/Parsec/tests/project-config-local-packages/cabal.project +++ b/cabal-testsuite/PackageTests/ProjectConfig/Parsec/tests/project-config-local-packages/cabal.project @@ -15,6 +15,7 @@ executable-dynamic: True executable-static: True profiling: True library-profiling: True +profiling-shared: False executable-profiling: True profiling-detail: all-functions library-profiling-detail: exported-functions @@ -56,6 +57,7 @@ haddock-index-location: separately-generated/HTML/index haddock-base-url: https://example.com/haddock-base-url haddock-resources-dir: /haddock/static haddock-output-dir: /haddock/output +haddock-use-unicode: False haddock-for-hackage: for-hackage test-log: human-log.log