Skip to content

Commit

Permalink
Add more to the autogened module PackageInfo_<pkgname>
Browse files Browse the repository at this point in the history
  • Loading branch information
L-TChen committed Aug 18, 2023
1 parent 006b8f3 commit 9964b51
Show file tree
Hide file tree
Showing 4 changed files with 110 additions and 21 deletions.
13 changes: 10 additions & 3 deletions Cabal/src/Distribution/Simple/Build/PackageInfoModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,17 @@ generatePackageInfoModule pkg_descr lbi =
Z.Z
{ Z.zPackageName = packageName pkg_descr
, Z.zVersionDigits = show $ versionNumbers $ packageVersion pkg_descr
, Z.zSynopsis = show $ fromShortText $ synopsis pkg_descr
, Z.zCopyright = show $ fromShortText $ copyright pkg_descr
, Z.zLicense = show $ prettyShow $ license pkg_descr
, Z.zHomepage = show $ fromShortText $ homepage pkg_descr
, Z.zCopyright = show $ fromShortText $ copyright pkg_descr
, Z.zMaintainer = show $ fromShortText $ maintainer pkg_descr
, Z.zAuthor = show $ fromShortText $ author pkg_descr
, Z.zStability = show $ fromShortText $ stability pkg_descr
, Z.zHomepage = show $ fromShortText $ homepage pkg_descr
, Z.zPkgUrl = show $ fromShortText $ pkgUrl pkg_descr
, Z.zBugReports = show $ fromShortText $ bugReports pkg_descr
, Z.zSynopsis = show $ fromShortText $ synopsis pkg_descr
, Z.zDescription = show $ fromShortText $ description pkg_descr
, Z.zCategory = show $ fromShortText $ category pkg_descr
, Z.zSupportsNoRebindableSyntax = supports_rebindable_syntax
, Z.zManglePkgName = showPkgName
, Z.zShow = show
Expand Down
68 changes: 58 additions & 10 deletions Cabal/src/Distribution/Simple/Build/PackageInfoModule/Z.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,17 @@ import Distribution.ZinzaPrelude
data Z
= Z {zPackageName :: PackageName,
zVersionDigits :: String,
zSynopsis :: String,
zCopyright :: String,
zLicense :: String,
zCopyright :: String,
zMaintainer :: String,
zAuthor :: String,
zStability :: String,
zHomepage :: String,
zPkgUrl :: String,
zBugReports :: String,
zSynopsis :: String,
zDescription :: String,
zCategory :: String,
zSupportsNoRebindableSyntax :: Bool,
zManglePkgName :: (PackageName -> String),
zShow :: (String -> String)}
Expand All @@ -28,10 +35,17 @@ render z_root = execWriter $ do
tell "\n"
tell " ( name\n"
tell " , version\n"
tell " , synopsis\n"
tell " , copyright\n"
tell " , license\n"
tell " , copyright\n"
tell " , maintainer\n"
tell " , author\n"
tell " , stability\n"
tell " , homepage\n"
tell " , pkgUrl\n"
tell " , bugReports\n"
tell " , synopsis\n"
tell " , description\n"
tell " , category\n"
tell " ) where\n"
tell "\n"
tell "import Data.Version (Version(..))\n"
Expand All @@ -47,23 +61,57 @@ render z_root = execWriter $ do
tell (zVersionDigits z_root)
tell " []\n"
tell "\n"
tell "synopsis :: String\n"
tell "synopsis = "
tell (zSynopsis z_root)
tell "license :: String\n"
tell "license = "
tell (zLicense z_root)
tell "\n"
tell "\n"
tell "copyright :: String\n"
tell "copyright = "
tell (zCopyright z_root)
tell "\n"
tell "\n"
tell "license :: String\n"
tell "license = "
tell (zLicense z_root)
tell "maintainer :: String\n"
tell "maintainer = "
tell (zMaintainer z_root)
tell "\n"
tell "\n"
tell "author :: String\n"
tell "author = "
tell (zAuthor z_root)
tell "\n"
tell "\n"
tell "stability :: String\n"
tell "stability = "
tell (zStability z_root)
tell "\n"
tell "\n"
tell "homepage :: String\n"
tell "homepage = "
tell (zHomepage z_root)
tell "\n"
tell "\n"
tell "pkgUrl :: String\n"
tell "pkgUrl = "
tell (zPkgUrl z_root)
tell "\n"
tell "\n"
tell "bugReports :: String\n"
tell "bugReports = "
tell (zBugReports z_root)
tell "\n"
tell "\n"
tell "synopsis :: String\n"
tell "synopsis = "
tell (zSynopsis z_root)
tell "\n"
tell "\n"
tell "description :: String\n"
tell "description = "
tell (zDescription z_root)
tell "\n"
tell "\n"
tell "category :: String\n"
tell "category = "
tell (zCategory z_root)
tell "\n"
11 changes: 9 additions & 2 deletions cabal-dev-scripts/src/GenPackageInfoModule.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,17 @@ $(capture "decls" [d|
data Z = Z
{ zPackageName :: PackageName
, zVersionDigits :: String
, zSynopsis :: String
, zCopyright :: String
, zLicense :: String
, zCopyright :: String
, zMaintainer :: String
, zAuthor :: String
, zStability :: String
, zHomepage :: String
, zPkgUrl :: String
, zBugReports :: String
, zSynopsis :: String
, zDescription :: String
, zCategory :: String

, zSupportsNoRebindableSyntax :: Bool

Expand Down
39 changes: 33 additions & 6 deletions templates/PackageInfo_pkg.template.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,17 @@
module PackageInfo_{{ manglePkgName packageName }}
( name
, version
, synopsis
, copyright
, license
, copyright
, maintainer
, author
, stability
, homepage
, pkgUrl
, bugReports
, synopsis
, description
, category
) where

import Data.Version (Version(..))
Expand All @@ -21,15 +28,35 @@ name = {{ show (manglePkgName packageName) }}
version :: Version
version = Version {{ versionDigits }} []

synopsis :: String
synopsis = {{ synopsis }}
license :: String
license = {{ license }}

copyright :: String
copyright = {{ copyright }}

license :: String
license = {{ license }}
maintainer :: String
maintainer = {{ maintainer }}

author :: String
author = {{ author }}

stability :: String
stability = {{ stability }}

homepage :: String
homepage = {{ homepage }}

pkgUrl :: String
pkgUrl = {{ pkgUrl }}

bugReports :: String
bugReports = {{ bugReports }}

synopsis :: String
synopsis = {{ synopsis }}

description :: String
description = {{ description }}

category :: String
category = {{ category }}

0 comments on commit 9964b51

Please sign in to comment.