Skip to content

Commit

Permalink
New extra-files field for neutral sdist files
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
tbidne authored and ulysses4ever committed Jul 30, 2024
1 parent ee1fd52 commit b791290
Show file tree
Hide file tree
Showing 62 changed files with 183 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions Cabal-syntax/src/Distribution/Types/PackageDescription.hs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -235,6 +236,7 @@ emptyPackageDescription =
, extraSrcFiles = []
, extraTmpFiles = []
, extraDocFiles = []
, extraFiles = []
}

-- ---------------------------------------------------------------------------
Expand Down Expand Up @@ -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
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/Octree-0.5.expr
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/anynone.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/big-version.expr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [
MkPackageFlag {
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/common.expr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/common2.expr
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/common3.expr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/elif.expr
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/elif2.expr
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/encoding-0.8.expr
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ GenericPackageDescription {
SymbolicPath "--",
SymbolicPath "--"],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/generics-sop.expr
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,8 @@ GenericPackageDescription {
extraSrcFiles = [
SymbolicPath "CHANGELOG.md"],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/hasktorch.expr
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [
MkPackageFlag {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/indentation.expr
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/indentation2.expr
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/indentation3.expr
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-5055.expr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Nothing,
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-5846.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-6083-a.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-6083-b.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-6083-c.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/issue-774.expr
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/leading-comma.expr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/libpq1.expr
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,8 @@ GenericPackageDescription {
"cbits/noticehandlers.h",
SymbolicPath "CHANGELOG.md"],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [
MkPackageFlag {
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/libpq2.expr
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ GenericPackageDescription {
"cbits/noticehandlers.h",
SymbolicPath "CHANGELOG.md"],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [
MkPackageFlag {
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/mixin-1.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Nothing,
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/mixin-2.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Nothing,
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/mixin-3.expr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Nothing,
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/monad-param.expr
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
3 changes: 2 additions & 1 deletion Cabal-tests/tests/ParserTests/regressions/noVersion.expr
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [],
condLibrary = Just
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ GenericPackageDescription {
dataDir = SymbolicPath ".",
extraSrcFiles = [],
extraTmpFiles = [],
extraDocFiles = []},
extraDocFiles = [],
extraFiles = []},
gpdScannedVersion = Nothing,
genPackageFlags = [
MkPackageFlag {
Expand Down
Loading

0 comments on commit b791290

Please sign in to comment.