File tree 5 files changed +15
-7
lines changed
Cabal/src/Distribution/Simple
Cabal-syntax/src/Distribution 5 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -152,14 +152,11 @@ packageDescriptionFieldGrammar =
152
152
<$> uniqueField " name" L. pkgName
153
153
<*> uniqueField " version" L. pkgVersion
154
154
155
- licenseFilesGrammar =
156
- (++)
157
- -- TODO: neither field is deprecated
158
- -- should we pretty print license-file if there's single license file
159
- -- and license-files when more
160
- <$> monoidalFieldAla " license-file" CompatLicenseFile L. licenseFiles
155
+ licenseFilesGrammar = (++)
156
+ -- Always pretty print license-files
157
+ <$> (monoidalFieldAla " license-file" CompatLicenseFile L. licenseFiles
158
+ ^^^ hiddenField)
161
159
<*> monoidalFieldAla " license-files" (alaList FSep ) L. licenseFiles
162
- ^^^ hiddenField
163
160
164
161
-------------------------------------------------------------------------------
165
162
-- Library
Original file line number Diff line number Diff line change @@ -52,6 +52,7 @@ data InstalledPackageInfo = InstalledPackageInfo
52
52
instantiatedWith :: [(ModuleName , OpenModule )]
53
53
, compatPackageKey :: String
54
54
, license :: Either SPDX. License License
55
+ , licenseFiles :: [FilePath ]
55
56
, copyright :: ! ShortText
56
57
, maintainer :: ! ShortText
57
58
, author :: ! ShortText
@@ -138,6 +139,7 @@ emptyInstalledPackageInfo =
138
139
, instantiatedWith = []
139
140
, compatPackageKey = " "
140
141
, license = Left SPDX. NONE
142
+ , licenseFiles = []
141
143
, copyright = " "
142
144
, maintainer = " "
143
145
, author = " "
Original file line number Diff line number Diff line change @@ -88,6 +88,7 @@ ipiFieldGrammar =
88
88
<@> optionalFieldDefAla " instantiated-with" InstWith L. instantiatedWith []
89
89
<@> optionalFieldDefAla " key" CompatPackageKey L. compatPackageKey " "
90
90
<@> optionalFieldDefAla " license" SpecLicenseLenient L. license (Left SPDX. NONE )
91
+ <@> monoidalFieldAla " license-files" (alaList' FSep FilePathNT ) L. licenseFiles
91
92
<@> freeTextFieldDefST " copyright" L. copyright
92
93
<@> freeTextFieldDefST " maintainer" L. maintainer
93
94
<@> freeTextFieldDefST " author" L. author
Original file line number Diff line number Diff line change @@ -47,6 +47,10 @@ license :: Lens' InstalledPackageInfo (Either SPDX.License License)
47
47
license f s = fmap (\ x -> s{T. license = x}) (f (T. license s))
48
48
{-# INLINE license #-}
49
49
50
+ licenseFiles :: Lens' InstalledPackageInfo [FilePath ]
51
+ licenseFiles f s = fmap (\ x -> s{T. licenseFiles = x}) (f (T. licenseFiles s))
52
+ {-# INLINE licenseFiles #-}
53
+
50
54
copyright :: Lens' InstalledPackageInfo ShortText
51
55
copyright f s = fmap (\ x -> s{T. copyright = x}) (f (T. copyright s))
52
56
{-# INLINE copyright #-}
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ import Distribution.Simple.Setup.Register
79
79
import Distribution.Simple.Utils
80
80
import Distribution.System
81
81
import Distribution.Utils.MapAccum
82
+ import Distribution.Utils.Path
82
83
import Distribution.Verbosity as Verbosity
83
84
import Distribution.Version
84
85
@@ -511,6 +512,9 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
511
512
if ghc84
512
513
then Left $ either id licenseToSPDX $ licenseRaw pkg
513
514
else Right $ either licenseFromSPDX id $ licenseRaw pkg
515
+ , IPI. licenseFiles =
516
+ let doc = docdir installDirs
517
+ in map ((doc </> ) . getSymbolicPath) $ licenseFiles pkg
514
518
, IPI. copyright = copyright pkg
515
519
, IPI. maintainer = maintainer pkg
516
520
, IPI. author = author pkg
You can’t perform that action at this time.
0 commit comments