Skip to content
Snippets Groups Projects
Unverified Commit 09dd45e2 authored by Moritz Angermann's avatar Moritz Angermann Committed by GitHub
Browse files

Merge pull request #4875 from zw3rk/feature/ghc-prim

Adds `virtual-modules` to handle cases like `GHC.Prim` from `ghc-prim`.
parents 6e25df31 62bc64dd
No related branches found
No related tags found
No related merge requests found
......@@ -375,6 +375,7 @@ buildInfoFieldGrammar = BuildInfo
<*> monoidalFieldAla "js-sources" (alaList' VCat FilePathNT) L.jsSources
<*> hsSourceDirsGrammar
<*> monoidalFieldAla "other-modules" (alaList' VCat MQuoted) L.otherModules
<*> monoidalFieldAla "virtual-modules" (alaList' VCat MQuoted) L.virtualModules
<*> monoidalFieldAla "autogen-modules" (alaList' VCat MQuoted) L.autogenModules
<*> optionalFieldAla "default-language" MQuoted L.defaultLanguage
<*> monoidalFieldAla "other-languages" (alaList' FSep MQuoted) L.otherLanguages
......
......@@ -523,6 +523,9 @@ binfoFieldDescrs =
, listFieldWithSep vcat "other-modules"
disp parseModuleNameQ
otherModules (\val binfo -> binfo{otherModules=val})
, listFieldWithSep vcat "virtual-modules"
disp parseModuleNameQ
virtualModules (\val binfo -> binfo{virtualModules=val})
, listFieldWithSep vcat "autogen-modules"
disp parseModuleNameQ
autogenModules (\val binfo -> binfo{autogenModules=val})
......
......@@ -420,7 +420,10 @@ generalInstalledPackageInfo adjustRelIncDirs pkg abi_hash lib lbi clbi installDi
IPI.abiHash = abi_hash,
IPI.indefinite = componentIsIndefinite clbi,
IPI.exposed = libExposed lib,
IPI.exposedModules = componentExposedModules clbi,
IPI.exposedModules = componentExposedModules clbi
-- add virtual modules into the list of exposed modules for the
-- package database as well.
++ map (\name -> IPI.ExposedModule name Nothing) (virtualModules bi),
IPI.hiddenModules = otherModules bi,
IPI.trusted = IPI.trusted IPI.emptyInstalledPackageInfo,
IPI.importDirs = [ libdir installDirs | hasModules ],
......
......@@ -66,6 +66,7 @@ data BuildInfo = BuildInfo {
jsSources :: [FilePath],
hsSourceDirs :: [FilePath], -- ^ where to look for the Haskell module hierarchy
otherModules :: [ModuleName], -- ^ non-exposed or non-main modules
virtualModules :: [ModuleName], -- ^ exposed modules that do not have a source file (e.g. @GHC.Prim@ from @ghc-prim@ package)
autogenModules :: [ModuleName], -- ^ not present on sdist, Paths_* or user-generated with a custom Setup.hs
defaultLanguage :: Maybe Language,-- ^ language used when not explicitly specified
......@@ -126,6 +127,7 @@ instance Monoid BuildInfo where
jsSources = [],
hsSourceDirs = [],
otherModules = [],
virtualModules = [],
autogenModules = [],
defaultLanguage = Nothing,
otherLanguages = [],
......@@ -171,6 +173,7 @@ instance Semigroup BuildInfo where
jsSources = combineNub jsSources,
hsSourceDirs = combineNub hsSourceDirs,
otherModules = combineNub otherModules,
virtualModules = combineNub virtualModules,
autogenModules = combineNub autogenModules,
defaultLanguage = combineMby defaultLanguage,
otherLanguages = combineNub otherLanguages,
......
......@@ -99,6 +99,10 @@ class HasBuildInfo a where
otherModules = buildInfo . otherModules
{-# INLINE otherModules #-}
virtualModules :: Lens' a [ModuleName]
virtualModules = buildInfo . virtualModules
{-# INLINE virtualModules #-}
autogenModules :: Lens' a [ModuleName]
autogenModules = buildInfo . autogenModules
{-# INLINE autogenModules #-}
......@@ -245,6 +249,9 @@ instance HasBuildInfo BuildInfo where
otherModules f s = fmap (\x -> s { T.otherModules = x }) (f (T.otherModules s))
{-# INLINE otherModules #-}
virtualModules f s = fmap (\x -> s { T.virtualModules = x }) (f (T.virtualModules s))
{-# INLINE virtualModules #-}
autogenModules f s = fmap (\x -> s { T.autogenModules = x }) (f (T.autogenModules s))
{-# INLINE autogenModules #-}
......
-*-change-log-*-
2.2.0.0 (current development version)
* Added `virtual-module` field, to allow modules that are not built
but registered (#4875).
* `copyComponent` and `installIncludeFiles` will look for include
headers in the build directory ('dist/build/...' by default)
as well (#4866).
......
......@@ -1010,6 +1010,15 @@ The library section should contain the following fields:
A list of modules added by this package.
.. pkg-field:: virtual-modules: identifier list
A list of virtual modules provided by this package. Virtual modules
are modules without a source file. See for example the ``GHC.Prim``
module from the ``ghc-prim`` package. Modules listed here will not be
built, but still end up in the list of ``exposed-modules`` in the
installed package info when the package is registered in the package
database.
.. pkg-field:: exposed: boolean
:default: ``True``
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment