From 8d06c3087b7dfee1b93ec89c021e3090338595e5 Mon Sep 17 00:00:00 2001 From: Tommy Bidne Date: Tue, 9 Jul 2024 10:01:24 +1200 Subject: [PATCH] New `extra-files` field for neutral sdist files The new `extra-files` field provides a way to specify extra files that should be included in sdist, without adding any other semantics (cf. `extra-source-files` are tracked by `cabal build`). Resolves #8817. --- .../PackageDescription/FieldGrammar.hs | 2 ++ .../Distribution/Types/PackageDescription.hs | 4 ++++ .../Types/PackageDescription/Lens.hs | 4 ++++ .../ParserTests/regressions/Octree-0.5.expr | 3 ++- .../tests/ParserTests/regressions/anynone.expr | 3 ++- .../ParserTests/regressions/big-version.expr | 3 ++- .../regressions/common-conditional.expr | 3 ++- .../tests/ParserTests/regressions/common.expr | 3 ++- .../tests/ParserTests/regressions/common2.expr | 3 ++- .../tests/ParserTests/regressions/common3.expr | 3 ++- .../tests/ParserTests/regressions/elif.expr | 3 ++- .../tests/ParserTests/regressions/elif2.expr | 3 ++- .../ParserTests/regressions/encoding-0.8.expr | 3 ++- .../ParserTests/regressions/generics-sop.expr | 3 ++- .../ParserTests/regressions/hasktorch.expr | 3 ++- .../regressions/hidden-main-lib.expr | 3 ++- .../ParserTests/regressions/indentation.expr | 3 ++- .../ParserTests/regressions/indentation2.expr | 3 ++- .../ParserTests/regressions/indentation3.expr | 3 ++- .../ParserTests/regressions/issue-5055.expr | 3 ++- .../ParserTests/regressions/issue-5846.expr | 3 ++- .../ParserTests/regressions/issue-6083-a.expr | 3 ++- .../ParserTests/regressions/issue-6083-b.expr | 3 ++- .../ParserTests/regressions/issue-6083-c.expr | 3 ++- .../regressions/issue-6083-pkg-pkg.expr | 3 ++- .../ParserTests/regressions/issue-774.expr | 3 ++- .../regressions/jaeger-flamegraph.expr | 3 ++- .../regressions/leading-comma-2.expr | 3 ++- .../ParserTests/regressions/leading-comma.expr | 3 ++- .../tests/ParserTests/regressions/libpq1.expr | 3 ++- .../tests/ParserTests/regressions/libpq2.expr | 3 ++- .../tests/ParserTests/regressions/mixin-1.expr | 3 ++- .../tests/ParserTests/regressions/mixin-2.expr | 3 ++- .../tests/ParserTests/regressions/mixin-3.expr | 3 ++- .../ParserTests/regressions/monad-param.expr | 3 ++- .../regressions/multiple-libs-2.expr | 3 ++- .../ParserTests/regressions/noVersion.expr | 3 ++- .../regressions/nothing-unicode.expr | 3 ++- .../tests/ParserTests/regressions/shake.expr | 3 ++- .../tests/ParserTests/regressions/spdx-1.expr | 3 ++- .../tests/ParserTests/regressions/spdx-2.expr | 3 ++- .../tests/ParserTests/regressions/spdx-3.expr | 3 ++- .../regressions/th-lift-instances.expr | 3 ++- .../ParserTests/regressions/version-sets.expr | 3 ++- .../regressions/wl-pprint-indef.expr | 3 ++- .../UnitTests/Distribution/Utils/Structured.hs | 8 ++++---- .../Distribution/PackageDescription/Check.hs | 15 +++++++++++---- Cabal/src/Distribution/Simple/SrcDist.hs | 4 ++++ .../PackageTests/SDist/T8817/cabal.out | 2 ++ .../PackageTests/SDist/T8817/cabal.project | 1 + .../PackageTests/SDist/T8817/cabal.test.hs | 17 +++++++++++++++++ .../PackageTests/SDist/T8817/pkg/Main.hs | 1 + .../PackageTests/SDist/T8817/pkg/d1/f2.txt | 1 + .../PackageTests/SDist/T8817/pkg/d1/f3.txt | 1 + cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 | 1 + .../PackageTests/SDist/T8817/pkg/t8817.cabal | 11 +++++++++++ changelog.d/issue-8817 | 17 +++++++++++++++++ doc/buildinfo-fields-reference.rst | 8 ++++++++ doc/cabal-package-description-file.rst | 5 +++++ doc/file-format-changelog.rst | 7 +++++++ doc/setup-commands.rst | 3 ++- editors/vim/syntax/cabal.vim | 1 + 62 files changed, 188 insertions(+), 51 deletions(-) create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/cabal.out create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/cabal.project create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 create mode 100644 cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal create mode 100644 changelog.d/issue-8817 diff --git a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs index 4d9ada935af..49db03ee3c1 100644 --- a/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs +++ b/Cabal-syntax/src/Distribution/PackageDescription/FieldGrammar.hs @@ -143,6 +143,8 @@ packageDescriptionFieldGrammar = <*> monoidalFieldAla "extra-source-files" formatExtraSourceFiles L.extraSrcFiles <*> monoidalFieldAla "extra-tmp-files" (alaList' VCat RelativePathNT) L.extraTmpFiles <*> monoidalFieldAla "extra-doc-files" formatExtraSourceFiles L.extraDocFiles + <*> monoidalFieldAla "extra-files" formatExtraSourceFiles L.extraFiles + ^^^ availableSince CabalSpecV3_14 [] where packageIdentifierGrammar = PackageIdentifier diff --git a/Cabal-syntax/src/Distribution/Types/PackageDescription.hs b/Cabal-syntax/src/Distribution/Types/PackageDescription.hs index a3f1d0c33da..5e64694ac1f 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageDescription.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageDescription.hs @@ -149,6 +149,7 @@ data PackageDescription = PackageDescription , extraSrcFiles :: [RelativePath Pkg File] , extraTmpFiles :: [RelativePath Pkg File] , extraDocFiles :: [RelativePath Pkg File] + , extraFiles :: [RelativePath Pkg File] } deriving (Generic, Show, Read, Eq, Ord, Typeable, Data) @@ -235,6 +236,7 @@ emptyPackageDescription = , extraSrcFiles = [] , extraTmpFiles = [] , extraDocFiles = [] + , extraFiles = [] } -- --------------------------------------------------------------------------- @@ -491,6 +493,7 @@ instance L.HasBuildInfos PackageDescription where a22 a23 a24 + a25 ) = PackageDescription a1 a2 a3 a4 a5 a6 a7 a8 a9 a10 a11 a12 a13 a14 a15 a16 a17 a18 a19 <$> (traverse . L.buildInfo) f x1 -- library @@ -504,3 +507,4 @@ instance L.HasBuildInfos PackageDescription where <*> pure a22 -- extra src files <*> pure a23 -- extra temp files <*> pure a24 -- extra doc files + <*> pure a25 -- extra files diff --git a/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs b/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs index 201b10d859f..5d91e32492c 100644 --- a/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs +++ b/Cabal-syntax/src/Distribution/Types/PackageDescription/Lens.hs @@ -159,6 +159,10 @@ extraDocFiles :: Lens' PackageDescription [RelativePath Pkg File] extraDocFiles f s = fmap (\x -> s{T.extraDocFiles = x}) (f (T.extraDocFiles s)) {-# INLINE extraDocFiles #-} +extraFiles :: Lens' PackageDescription [RelativePath Pkg File] +extraFiles f s = fmap (\x -> s{T.extraFiles = x}) (f (T.extraFiles s)) +{-# INLINE extraFiles #-} + -- | @since 3.0.0.0 allLibraries :: Traversal' PackageDescription Library allLibraries f pd = mk <$> traverse f (T.library pd) <*> traverse f (T.subLibraries pd) diff --git a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr index b3494104aed..04f54ea5d93 100644 --- a/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr +++ b/Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr @@ -66,7 +66,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/anynone.expr b/Cabal-tests/tests/ParserTests/regressions/anynone.expr index 8c9c8879ab4..919f554180a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/anynone.expr +++ b/Cabal-tests/tests/ParserTests/regressions/anynone.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/big-version.expr b/Cabal-tests/tests/ParserTests/regressions/big-version.expr index d4ef82adf52..c219ac95241 100644 --- a/Cabal-tests/tests/ParserTests/regressions/big-version.expr +++ b/Cabal-tests/tests/ParserTests/regressions/big-version.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr index 9cacba2b770..8969ff6f5fa 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common-conditional.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/common.expr b/Cabal-tests/tests/ParserTests/regressions/common.expr index 25abadef9e7..e39820ec833 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common.expr @@ -47,7 +47,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/common2.expr b/Cabal-tests/tests/ParserTests/regressions/common2.expr index cd501d11cf2..ae85c83ea2b 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common2.expr @@ -43,7 +43,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/common3.expr b/Cabal-tests/tests/ParserTests/regressions/common3.expr index fc1fc155c09..5436936b3a2 100644 --- a/Cabal-tests/tests/ParserTests/regressions/common3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/common3.expr @@ -47,7 +47,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/elif.expr b/Cabal-tests/tests/ParserTests/regressions/elif.expr index f17c1e17b88..5bf616b7c15 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/elif2.expr b/Cabal-tests/tests/ParserTests/regressions/elif2.expr index ec01a92a79d..f0ecd6bb111 100644 --- a/Cabal-tests/tests/ParserTests/regressions/elif2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/elif2.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr index 0d248029a31..4e45a86b8c4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr +++ b/Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr @@ -47,7 +47,8 @@ GenericPackageDescription { SymbolicPath "--", SymbolicPath "--"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr index 25786cdfad5..60be619bd16 100644 --- a/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr +++ b/Cabal-tests/tests/ParserTests/regressions/generics-sop.expr @@ -123,7 +123,8 @@ GenericPackageDescription { extraSrcFiles = [ SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr index c68fac467e1..7eea76ce8c1 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hasktorch.expr @@ -54,7 +54,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr index b51b4adacb2..3e67f519199 100644 --- a/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr +++ b/Cabal-tests/tests/ParserTests/regressions/hidden-main-lib.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation.expr b/Cabal-tests/tests/ParserTests/regressions/indentation.expr index c97630ddb00..ea8c219ca0a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr index 605cba525d1..f26c9a4e005 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation2.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr index 55d0533c3fe..08db6b1fec6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/indentation3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/indentation3.expr @@ -39,7 +39,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr index 3b5092639e4..03fab0246e4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5055.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr index 61a7b7d2ca1..0d031503a53 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-5846.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr index c9c57785ac6..bbe56f81a5c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr index b0ed19062fc..17b9f8319bb 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr index c901eebc8ce..8db694b7389 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just 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 62ed5fd2fb9..26a3c260959 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-6083-pkg-pkg.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr index 2f58de4eb00..a9b2fc7bcc3 100644 --- a/Cabal-tests/tests/ParserTests/regressions/issue-774.expr +++ b/Cabal-tests/tests/ParserTests/regressions/issue-774.expr @@ -41,7 +41,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr index 9994c9b72c1..fd9b1fa3a28 100644 --- a/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr +++ b/Cabal-tests/tests/ParserTests/regressions/jaeger-flamegraph.expr @@ -73,7 +73,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr index 99f7cddf881..37bb5adfea5 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma-2.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr index 441fe75261d..6b31a91ecc4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr +++ b/Cabal-tests/tests/ParserTests/regressions/leading-comma.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr index 2e0bc309f9f..db39305d20f 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq1.expr @@ -111,7 +111,8 @@ GenericPackageDescription { "cbits/noticehandlers.h", SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr index b74143af0b9..80b558d0b91 100644 --- a/Cabal-tests/tests/ParserTests/regressions/libpq2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/libpq2.expr @@ -115,7 +115,8 @@ GenericPackageDescription { "cbits/noticehandlers.h", SymbolicPath "CHANGELOG.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr index 77821302ddf..b8372437dd6 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-1.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr index d8b58ff5a0b..a4d3459be3d 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-2.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, diff --git a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr index c0cbfe921ad..2b1d37c79e9 100644 --- a/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/mixin-3.expr @@ -32,7 +32,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Nothing, diff --git a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr index e450672e868..aaeb1af1044 100644 --- a/Cabal-tests/tests/ParserTests/regressions/monad-param.expr +++ b/Cabal-tests/tests/ParserTests/regressions/monad-param.expr @@ -42,7 +42,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr index aa7d6954637..dc6371bc75c 100644 --- a/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/multiple-libs-2.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr index dfe79d768fb..0d5bf636569 100644 --- a/Cabal-tests/tests/ParserTests/regressions/noVersion.expr +++ b/Cabal-tests/tests/ParserTests/regressions/noVersion.expr @@ -34,7 +34,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr index 2ed17f6d557..f6a8c64a566 100644 --- a/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr +++ b/Cabal-tests/tests/ParserTests/regressions/nothing-unicode.expr @@ -44,7 +44,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/shake.expr b/Cabal-tests/tests/ParserTests/regressions/shake.expr index 4dd37e84de0..560c38e1dc4 100644 --- a/Cabal-tests/tests/ParserTests/regressions/shake.expr +++ b/Cabal-tests/tests/ParserTests/regressions/shake.expr @@ -149,7 +149,8 @@ GenericPackageDescription { extraTmpFiles = [], extraDocFiles = [ SymbolicPath "CHANGES.txt", - SymbolicPath "README.md"]}, + SymbolicPath "README.md"], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [ MkPackageFlag { diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr index ddeaf37cbe4..24f0aff227a 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-1.expr @@ -33,7 +33,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr index b865b1f31db..992486c3be5 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-2.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr index dc8f3f922b9..f38e0b24b30 100644 --- a/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr +++ b/Cabal-tests/tests/ParserTests/regressions/spdx-3.expr @@ -37,7 +37,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr index 5e781597f30..fa6fd5ee308 100644 --- a/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr +++ b/Cabal-tests/tests/ParserTests/regressions/th-lift-instances.expr @@ -61,7 +61,8 @@ GenericPackageDescription { SymbolicPath ".vim.custom", SymbolicPath "README.md"], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr index 3244bc1cc45..8983fa4ea73 100644 --- a/Cabal-tests/tests/ParserTests/regressions/version-sets.expr +++ b/Cabal-tests/tests/ParserTests/regressions/version-sets.expr @@ -59,7 +59,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr index 6e718e3e685..a8b4fa3c604 100644 --- a/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr +++ b/Cabal-tests/tests/ParserTests/regressions/wl-pprint-indef.expr @@ -51,7 +51,8 @@ GenericPackageDescription { dataDir = SymbolicPath ".", extraSrcFiles = [], extraTmpFiles = [], - extraDocFiles = []}, + extraDocFiles = [], + extraFiles = []}, gpdScannedVersion = Nothing, genPackageFlags = [], condLibrary = Just diff --git a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs index 0db6844928a..40770290073 100644 --- a/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs +++ b/Cabal-tests/tests/UnitTests/Distribution/Utils/Structured.hs @@ -31,15 +31,15 @@ md5Check proxy md5Int = structureHash proxy @?= md5FromInteger md5Int md5CheckGenericPackageDescription :: Proxy GenericPackageDescription -> Assertion md5CheckGenericPackageDescription proxy = md5Check proxy #if MIN_VERSION_base(4,19,0) - 0xe28f08e7ac644f836d8b3fe7f9428dcf + 0x3da8883a286b8fbfd9f94790d57cc06e #else - 0x3442058190aa48c2f795b83ee995f702 + 0x245e544da05f50f9dd0339a96ac99860 #endif md5CheckLocalBuildInfo :: Proxy LocalBuildInfo -> Assertion md5CheckLocalBuildInfo proxy = md5Check proxy #if MIN_VERSION_base(4,19,0) - 0x6809d4d86ae1810f2a032bc90c952b76 + 0x7683c2daece12ba7982e80f860454f47 #else - 0x9409dca80a2e1522b1c3a39356e9aaef + 0xe694b39b10bc861f47ea9c7b926a422a #endif diff --git a/Cabal/src/Distribution/PackageDescription/Check.hs b/Cabal/src/Distribution/PackageDescription/Check.hs index ef97b0d23be..5787dec3b77 100644 --- a/Cabal/src/Distribution/PackageDescription/Check.hs +++ b/Cabal/src/Distribution/PackageDescription/Check.hs @@ -409,6 +409,7 @@ checkPackageDescription extraSrcFiles_ extraTmpFiles_ extraDocFiles_ + extraFiles_ ) = do -- § Sanity checks. checkPackageId package_ @@ -456,6 +457,7 @@ checkPackageDescription mapM_ (checkPath False "extra-source-files" PathKindGlob . getSymbolicPath) extraSrcFiles_ mapM_ (checkPath False "extra-tmp-files" PathKindFile . getSymbolicPath) extraTmpFiles_ mapM_ (checkPath False "extra-doc-files" PathKindGlob . getSymbolicPath) extraDocFiles_ + mapM_ (checkPath False "extra-files" PathKindGlob . getSymbolicPath) extraFiles_ mapM_ (checkPath False "data-files" PathKindGlob . getSymbolicPath) dataFiles_ let rawDataDir = getSymbolicPath dataDir_ checkPath True "data-dir" PathKindDirectory rawDataDir @@ -465,15 +467,17 @@ checkPackageDescription -- § Globs. dataGlobs <- mapM (checkGlob "data-files" . getSymbolicPath) dataFiles_ - extraGlobs <- mapM (checkGlob "extra-source-files" . getSymbolicPath) extraSrcFiles_ + extraSrcGlobs <- mapM (checkGlob "extra-source-files" . getSymbolicPath) extraSrcFiles_ docGlobs <- mapM (checkGlob "extra-doc-files" . getSymbolicPath) extraDocFiles_ + extraGlobs <- mapM (checkGlob "extra-files" . getSymbolicPath) extraFiles_ -- We collect globs to feed them to checkMissingDocs. -- § Missing documentation. checkMissingDocs (catMaybes dataGlobs) - (catMaybes extraGlobs) + (catMaybes extraSrcGlobs) (catMaybes docGlobs) + (catMaybes extraGlobs) -- § Datafield checks. checkSetupBuildInfo setupBuildInfo_ @@ -519,6 +523,7 @@ checkPackageDescription checkCabalFile (packageName pkg) mapM_ (checkGlobFile specVersion_ "." "extra-source-files" . getSymbolicPath) extraSrcFiles_ mapM_ (checkGlobFile specVersion_ "." "extra-doc-files" . getSymbolicPath) extraDocFiles_ + mapM_ (checkGlobFile specVersion_ "." "extra-files" . getSymbolicPath) extraFiles_ mapM_ (checkGlobFile specVersion_ rawDataDir "data-files" . getSymbolicPath) dataFiles_ where checkNull @@ -985,8 +990,9 @@ checkMissingDocs => [Glob] -- data-files globs. -> [Glob] -- extra-source-files globs. -> [Glob] -- extra-doc-files globs. + -> [Glob] -- extra-files globs. -> CheckM m () -checkMissingDocs dgs esgs edgs = do +checkMissingDocs dgs esgs edgs efgs = do extraDocSupport <- (>= CabalSpecV1_18) <$> asksCM ccSpecVersion -- Everything in this block uses CheckPreDistributionOps interface. @@ -1005,9 +1011,10 @@ checkMissingDocs dgs esgs edgs = do rgs <- realGlob dgs res <- realGlob esgs red <- realGlob edgs + ref <- realGlob efgs -- 3. Check if anything in 1. is missing in 2. - let mcs = checkDoc extraDocSupport des (rgs ++ res ++ red) + let mcs = checkDoc extraDocSupport des (rgs ++ res ++ red ++ ref) -- 4. Check if files are present but in the wrong field. let pcsData = checkDocMove extraDocSupport "data-files" des rgs diff --git a/Cabal/src/Distribution/Simple/SrcDist.hs b/Cabal/src/Distribution/Simple/SrcDist.hs index eb9096271ef..67f901bf7fb 100644 --- a/Cabal/src/Distribution/Simple/SrcDist.hs +++ b/Cabal/src/Distribution/Simple/SrcDist.hs @@ -264,6 +264,10 @@ listPackageSources' verbosity rip mbWorkDir pkg_descr pps = $ \filename -> fmap (coerceSymbolicPath . relativeSymbolicPath) <$> matchDirFileGlobWithDie verbosity rip (specVersion pkg_descr) mbWorkDir filename + , -- Extra files. + fmap concat . for (extraFiles pkg_descr) $ \fpath -> + fmap relativeSymbolicPath + <$> matchDirFileGlobWithDie verbosity rip (specVersion pkg_descr) mbWorkDir fpath , -- License file(s). return (map (relativeSymbolicPath . coerceSymbolicPath) $ licenseFiles pkg_descr) , -- Install-include files, without autogen-include files diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.out b/cabal-testsuite/PackageTests/SDist/T8817/cabal.out new file mode 100644 index 00000000000..c99d15276fe --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.out @@ -0,0 +1,2 @@ +# cabal v2-sdist +Wrote tarball sdist to /t8817-0.tar.gz diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.project b/cabal-testsuite/PackageTests/SDist/T8817/cabal.project new file mode 100644 index 00000000000..f69442ca765 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.project @@ -0,0 +1 @@ +packages: pkg/*.cabal diff --git a/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs b/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs new file mode 100644 index 00000000000..1fca4955b48 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/cabal.test.hs @@ -0,0 +1,17 @@ +import Test.Cabal.Prelude + +main = cabalTest $ do + tmpdir <- fmap testTmpDir getTestEnv + + cabal "v2-sdist" ["--output-directory", tmpdir, "all"] + + let distTarPath = tmpdir "t8817-0.tar.gz" + distExtractedPath = tmpdir "t8817-0" + + shouldExist distTarPath + + tar ["-xzf", distTarPath] + + shouldExist (distExtractedPath "f1") + shouldExist (distExtractedPath "d1" "f2.txt") + shouldExist (distExtractedPath "d1" "f3.txt") diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs b/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs new file mode 100644 index 00000000000..4233a67ecdd --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/Main.hs @@ -0,0 +1 @@ +main = putStrLn "hi" diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt new file mode 100644 index 00000000000..9de77c18733 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f2.txt @@ -0,0 +1 @@ +f2 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt new file mode 100644 index 00000000000..45d9e0e9fc8 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/d1/f3.txt @@ -0,0 +1 @@ +f3 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 b/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 new file mode 100644 index 00000000000..8e1e71d5ce3 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/f1 @@ -0,0 +1 @@ +f1 diff --git a/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal b/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal new file mode 100644 index 00000000000..899eb191b84 --- /dev/null +++ b/cabal-testsuite/PackageTests/SDist/T8817/pkg/t8817.cabal @@ -0,0 +1,11 @@ +cabal-version: 3.14 +name: t8817 +version: 0 + +extra-files: + d1/*.txt + f1 + +executable foo + default-language: Haskell2010 + main-is: Main.hs diff --git a/changelog.d/issue-8817 b/changelog.d/issue-8817 new file mode 100644 index 00000000000..0743671fa0d --- /dev/null +++ b/changelog.d/issue-8817 @@ -0,0 +1,17 @@ +synopsis: Neutral field to add files to sdist +packages: Cabal Cabal-syntax +prs: #10107 +issues: #8817 +significance: significant + +description: { + +Adds the `extra-files` field to the cabal file specification. This is like +the other `extra-*` fields in that it is copied with the `sdist` command, +except there are no other semantics. Compare to: + +* `extra-source-files`: Tracked by `cabal build`. + +* `extra-doc-files`: Copied by Haddock to the html directory. + +} diff --git a/doc/buildinfo-fields-reference.rst b/doc/buildinfo-fields-reference.rst index cfabe5ee448..a289292945a 100644 --- a/doc/buildinfo-fields-reference.rst +++ b/doc/buildinfo-fields-reference.rst @@ -595,6 +595,14 @@ extra-doc-files .. math:: \mathrm{commalist}\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}\mathop{\mathord{``}\mathtt{\text{,}}\mathord{"}}]^c}}^+_{} \right\} +extra-files + * Monoidal field + * Available since ``cabal-version: 3.14``. + * Documentation of :pkg-field:`extra-files` + + .. math:: + \mathrm{commalist}\left\{ \mathop{\mathit{hs\text{-}string}}\mid{{[\mathop{\mathord{``}\mathtt{\ }\mathord{"}}\mathop{\mathord{``}\mathtt{\text{,}}\mathord{"}}]^c}}^+_{} \right\} + extra-source-files * Monoidal field * Documentation of :pkg-field:`extra-source-files` diff --git a/doc/cabal-package-description-file.rst b/doc/cabal-package-description-file.rst index 416aa3df76c..e5e170f3984 100644 --- a/doc/cabal-package-description-file.rst +++ b/doc/cabal-package-description-file.rst @@ -773,6 +773,11 @@ describe the package as a whole: additional hooks, such as the scheme described in the section on `system-dependent parameters`_. +.. pkg-field:: extra-files: filename list + + A list of additional files to be included in source distributions built with :ref:`setup-sdist`. + As with :pkg-field:`data-files` it can use a limited form of ``*`` wildcards in file names. + Library ^^^^^^^ diff --git a/doc/file-format-changelog.rst b/doc/file-format-changelog.rst index 854f949b301..e57eb2508fc 100644 --- a/doc/file-format-changelog.rst +++ b/doc/file-format-changelog.rst @@ -19,6 +19,13 @@ relative to the respective preceding *published* version. versions of the ``Cabal`` library denote unreleased development branches which have no stability guarantee. +``cabal-version: 3.14`` +----------------------- + +* Added field ``extra-files`` for specifying extra files to be included in + ``sdist`` without adding any other semantics (cf. ``extra-source-files`` + is tracked by ``cabal build``). + ``cabal-version: 3.12`` ----------------------- diff --git a/doc/setup-commands.rst b/doc/setup-commands.rst index 5ed8077f46b..4babff6f40c 100644 --- a/doc/setup-commands.rst +++ b/doc/setup-commands.rst @@ -1385,7 +1385,8 @@ The files placed in this distribution are the package description file, the setup script, the sources of the modules named in the package description file, and files named in the ``license-file``, ``main-is``, ``c-sources``, ``asm-sources``, ``cmm-sources``, ``js-sources``, -``data-files``, ``extra-source-files`` and ``extra-doc-files`` fields. +``data-files``, ``extra-source-files``, ``extra-doc-files``, and +``extra-files`` fields. This command takes the following option: diff --git a/editors/vim/syntax/cabal.vim b/editors/vim/syntax/cabal.vim index 119a5ccb767..d3374dbd27f 100644 --- a/editors/vim/syntax/cabal.vim +++ b/editors/vim/syntax/cabal.vim @@ -80,6 +80,7 @@ syn keyword cabalFieldName contained \ extra-bundled-libraries \ extra-doc-files \ extra-dynamic-library-flavours + \ extra-files \ extra-framework-dirs \ extra-ghci-libraries \ extra-lib-dirs