[Git][ghc/ghc][master] haddock: Build haddock-api and haddock-library using hadrian
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Aug 13 17:37:23 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
6ae4b76a by Zubin Duggal at 2024-08-13T13:36:57-04:00
haddock: Build haddock-api and haddock-library using hadrian
We build these two packages as regular boot library dependencies rather
than using the `in-ghc-tree` flag to include the source files into the haddock
executable.
The `in-ghc-tree` flag is moved into haddock-api to ensure that haddock built
from hackage can still find the location of the GHC bindist using `ghc-paths`.
Addresses #24834
This causes a metric decrease under non-release flavours because under these
flavours libraries are compiled with optimisation but executables are not.
Since we move the bulk of the code from the haddock executable to the
haddock-api library, we see a metric decrease on the validate flavours.
Metric Decrease:
haddock.Cabal
haddock.base
haddock.compiler
- - - - -
9 changed files:
- docs/users_guide/9.12.1-notes.rst
- hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
- hadrian/src/Packages.hs
- hadrian/src/Settings/Default.hs
- hadrian/src/Settings/Packages.hs
- hadrian/src/Settings/Warnings.hs
- utils/haddock/haddock-api/haddock-api.cabal
- utils/haddock/haddock-api/src/Haddock/Version.hs
- utils/haddock/haddock.cabal
Changes:
=====================================
docs/users_guide/9.12.1-notes.rst
=====================================
@@ -179,38 +179,40 @@ for further change information.
.. ghc-package-list::
- libraries/array/array.cabal: Dependency of ``ghc`` library
- libraries/base/base.cabal: Core library
- libraries/binary/binary.cabal: Dependency of ``ghc`` library
- libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library
- libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility
- libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal: Dependency of ``ghc-pkg`` utility
- libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library
- libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library
- libraries/directory/directory.cabal: Dependency of ``ghc`` library
- libraries/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` library
- libraries/filepath/filepath.cabal: Dependency of ``ghc`` library
- compiler/ghc.cabal: The compiler itself
- libraries/ghci/ghci.cabal: The REPL interface
- libraries/ghc-boot/ghc-boot.cabal: Internal compiler library
- libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
- libraries/ghc-compact/ghc-compact.cabal: Core library
- libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library
- libraries/ghc-prim/ghc-prim.cabal: Core library
- libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable
- libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable
- libraries/integer-gmp/integer-gmp.cabal: Core library
- libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library
- libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library
- libraries/pretty/pretty.cabal: Dependency of ``ghc`` library
- libraries/process/process.cabal: Dependency of ``ghc`` library
- libraries/stm/stm.cabal: Dependency of ``haskeline`` library
- libraries/template-haskell/template-haskell.cabal: Core library
- libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library
- libraries/text/text.cabal: Dependency of ``Cabal`` library
- libraries/time/time.cabal: Dependency of ``ghc`` library
- libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
- libraries/unix/unix.cabal: Dependency of ``ghc`` library
- libraries/Win32/Win32.cabal: Dependency of ``ghc`` library
- libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable
- libraries/os-string/os-string.cabal: Dependency of ``filepath`` library
+ libraries/array/array.cabal: Dependency of ``ghc`` library
+ libraries/base/base.cabal: Core library
+ libraries/binary/binary.cabal: Dependency of ``ghc`` library
+ libraries/bytestring/bytestring.cabal: Dependency of ``ghc`` library
+ libraries/Cabal/Cabal/Cabal.cabal: Dependency of ``ghc-pkg`` utility
+ libraries/Cabal/Cabal-syntax/Cabal-syntax.cabal: Dependency of ``ghc-pkg`` utility
+ libraries/containers/containers/containers.cabal: Dependency of ``ghc`` library
+ libraries/deepseq/deepseq.cabal: Dependency of ``ghc`` library
+ libraries/directory/directory.cabal: Dependency of ``ghc`` library
+ libraries/exceptions/exceptions.cabal: Dependency of ``ghc`` and ``haskeline`` library
+ libraries/filepath/filepath.cabal: Dependency of ``ghc`` library
+ compiler/ghc.cabal: The compiler itself
+ libraries/ghci/ghci.cabal: The REPL interface
+ libraries/ghc-boot/ghc-boot.cabal: Internal compiler library
+ libraries/ghc-boot-th/ghc-boot-th.cabal: Internal compiler library
+ libraries/ghc-compact/ghc-compact.cabal: Core library
+ libraries/ghc-heap/ghc-heap.cabal: GHC heap-walking library
+ libraries/ghc-prim/ghc-prim.cabal: Core library
+ utils/haddock/haddock-api/haddock-api.cabal: Dependency of ``haddock`` executable
+ utils/haddock/haddock-library/haddock-library.cabal: Dependency of ``haddock`` executable
+ libraries/haskeline/haskeline.cabal: Dependency of ``ghci`` executable
+ libraries/hpc/hpc.cabal: Dependency of ``hpc`` executable
+ libraries/integer-gmp/integer-gmp.cabal: Core library
+ libraries/mtl/mtl.cabal: Dependency of ``Cabal`` library
+ libraries/parsec/parsec.cabal: Dependency of ``Cabal`` library
+ libraries/pretty/pretty.cabal: Dependency of ``ghc`` library
+ libraries/process/process.cabal: Dependency of ``ghc`` library
+ libraries/stm/stm.cabal: Dependency of ``haskeline`` library
+ libraries/template-haskell/template-haskell.cabal: Core library
+ libraries/terminfo/terminfo.cabal: Dependency of ``haskeline`` library
+ libraries/text/text.cabal: Dependency of ``Cabal`` library
+ libraries/time/time.cabal: Dependency of ``ghc`` library
+ libraries/transformers/transformers.cabal: Dependency of ``ghc`` library
+ libraries/unix/unix.cabal: Dependency of ``ghc`` library
+ libraries/Win32/Win32.cabal: Dependency of ``ghc`` library
+ libraries/xhtml/xhtml.cabal: Dependency of ``haddock`` executable
+ libraries/os-string/os-string.cabal: Dependency of ``filepath`` library
=====================================
hadrian/src/Hadrian/Haskell/Cabal/Parse.hs
=====================================
@@ -80,8 +80,10 @@ import Packages
-- "Hadrian.Oracles.TextFile.readPackageData" oracle.
parsePackageData :: Package -> Action PackageData
parsePackageData pkg = do
- gpd <- traced "cabal-read" $
+ gpd' <- traced "cabal-read" $
C.readGenericPackageDescription C.verbose Nothing (C.makeSymbolicPath (pkgCabalFile pkg))
+ -- We need to make the data dir relative to the package path so that cabal can actually find it
+ let gpd = gpd' { C.packageDescription = (C.packageDescription gpd') { C.dataDir = C.makeSymbolicPath (pkgPath pkg) C.</> C.makeRelativePathEx (C.interpretSymbolicPathCWD (C.dataDir (C.packageDescription gpd'))) } }
let pd = C.packageDescription gpd
pkgId = C.package pd
name = C.unPackageName (C.pkgName pkgId)
=====================================
hadrian/src/Packages.hs
=====================================
@@ -6,7 +6,7 @@ module Packages (
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform,
ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghcInternal, ghci, ghciWrapper, ghcPkg, ghcPrim,
- ghcToolchain, ghcToolchainBin, haddock, haskeline,
+ ghcToolchain, ghcToolchainBin, haddockApi, haddockLibrary, haddock, haskeline,
hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy,
libffi, mtl, osString, parsec, pretty, primitive, process, remoteIserv, rts,
runGhc, semaphoreCompat, stm, templateHaskell, terminfo, text, time, timeout,
@@ -37,7 +37,7 @@ ghcPackages =
, compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls
, exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform
, ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghcInternal, ghci, ghciWrapper, ghcPkg, ghcPrim
- , ghcToolchain, ghcToolchainBin, haddock, haskeline, hsc2hs
+ , ghcToolchain, ghcToolchainBin, haddockApi, haddockLibrary, haddock, haskeline, hsc2hs
, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, libffi, mtl, osString
, parsec, pretty, process, rts, runGhc, stm, semaphoreCompat, templateHaskell
, terminfo, text, time, transformers, unlit, unix, win32, xhtml
@@ -54,7 +54,7 @@ array, base, binary, bytestring, cabalSyntax, cabal, checkPpr, checkExact, count
compareSizes, compiler, containers, deepseq, deriveConstants, directory, dumpDecls,
exceptions, filepath, genapply, genprimopcode, ghc, ghcBignum, ghcBoot, ghcBootTh, ghcBootThNext, ghcPlatform,
ghcCompact, ghcConfig, ghcExperimental, ghcHeap, ghci, ghcInternal, ghciWrapper, ghcPkg, ghcPrim,
- ghcToolchain, ghcToolchainBin, haddock, haskeline, hsc2hs,
+ ghcToolchain, ghcToolchainBin, haddockLibrary, haddockApi, haddock, haskeline, hsc2hs,
hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, iservProxy, remoteIserv, libffi, mtl,
osString, parsec, pretty, primitive, process, rts, runGhc, semaphoreCompat, stm, templateHaskell,
terminfo, text, time, transformers, unlit, unix, win32, xhtml,
@@ -99,6 +99,8 @@ ghcPkg = util "ghc-pkg"
ghcPrim = lib "ghc-prim"
ghcToolchain = lib "ghc-toolchain" `setPath` "utils/ghc-toolchain"
ghcToolchainBin = prg "ghc-toolchain-bin" `setPath` "utils/ghc-toolchain/exe" -- workaround for #23690
+haddockLibrary = lib "haddock-library" `setPath` "utils/haddock/haddock-library"
+haddockApi = lib "haddock-api" `setPath` "utils/haddock/haddock-api"
haddock = util "haddock"
haskeline = lib "haskeline"
hsc2hs = util "hsc2hs"
=====================================
hadrian/src/Settings/Default.hs
=====================================
@@ -93,6 +93,8 @@ stage0Packages = do
, ghcPlatform
, ghcToolchain
, ghci
+ , haddockApi
+ , haddockLibrary
, haddock
, hp2ps
, hpc
=====================================
hadrian/src/Settings/Packages.hs
=====================================
@@ -183,7 +183,7 @@ packageArgs = do
[ builder (Ghc LinkHs) ? arg "-optl-Wl,--export-dynamic" ]
-------------------------------- haddock -------------------------------
- , package haddock ?
+ , package haddockApi ?
builder (Cabal Flags) ? arg "in-ghc-tree"
---------------------------- ghc-boot-th-next --------------------------
=====================================
hadrian/src/Settings/Warnings.hs
=====================================
@@ -52,9 +52,10 @@ ghcWarningsArgs = do
, "-Wincomplete-record-updates"
]
, package ghcPrim ? pure [ "-Wno-trustworthy-safe" ]
- , package haddock ? pure [ "-Wno-unused-imports"
- , "-Wno-deprecations"
- , "-Wno-x-partial" ]
+ , package haddockLibrary ? pure [ "-Wno-unused-imports" ]
+ , package haddockApi ? pure [ "-Wno-unused-imports"
+ , "-Wno-deprecations"
+ , "-Wno-x-partial" ]
, package haskeline ? pure [ "-Wno-deprecations"
, "-Wno-x-partial"
, "-Wno-unused-imports"
=====================================
utils/haddock/haddock-api/haddock-api.cabal
=====================================
@@ -63,14 +63,23 @@ common ghc-options
-fdicts-strict -Wunused-packages -funbox-strict-fields
-Wnoncanonical-monad-instances -Wmissing-home-modules
+flag in-ghc-tree
+ description: Are we in a GHC tree?
+ default: False
+ manual: True
+
library
import: extensions
import: ghc-options
+ if flag(in-ghc-tree)
+ cpp-options: -DIN_GHC_TREE
+ else
+ build-depends: ghc-paths ^>= 0.1.0.12
+
-- this package typically supports only single major versions
build-depends: base >= 4.16 && < 4.21
, ghc ^>= 9.11
- , ghc-paths ^>= 0.1.0.12
, haddock-library ^>= 1.11
, xhtml ^>= 3000.2.2
, parsec ^>= 3.1.13.0
=====================================
utils/haddock/haddock-api/src/Haddock/Version.hs
=====================================
@@ -20,11 +20,7 @@ module Haddock.Version
import Data.Version (showVersion)
-#ifdef IN_GHC_TREE
-import Paths_haddock ( version )
-#else
import Paths_haddock_api ( version )
-#endif
projectName :: String
projectName = "Haddock"
=====================================
utils/haddock/haddock.cabal
=====================================
@@ -54,11 +54,6 @@ extra-source-files:
hoogle-test/src/**/*.hs
hoogle-test/ref/**/*.txt
-flag in-ghc-tree
- description: Are we in a GHC tree?
- default: False
- manual: True
-
flag threaded
description: Build haddock with the threaded RTS
default: True
@@ -96,86 +91,10 @@ executable haddock
-- haddock typically only supports a single GHC major version
build-depends:
- base >= 4.13.0.0 && <4.21
-
- if flag(in-ghc-tree)
- hs-source-dirs: haddock-api/src, haddock-library/src
- cpp-options: -DIN_GHC_TREE
- build-depends:
- filepath,
- directory,
- containers,
- deepseq,
- exceptions,
- array,
- xhtml >= 3000.2 && < 3000.3,
- ghc-boot,
- ghc == 9.11.*,
- bytestring,
- parsec,
- text,
- transformers,
- mtl
-
- other-modules:
- Documentation.Haddock.Parser
- Documentation.Haddock.Parser.Monad
- Documentation.Haddock.Parser.Identifier
- Documentation.Haddock.Types
- Documentation.Haddock.Doc
- Documentation.Haddock.Parser.Util
- Documentation.Haddock.Markup
-
- Documentation.Haddock
- Haddock
- Haddock.Interface
- Haddock.Interface.Json
- Haddock.Interface.Rename
- Haddock.Interface.Create
- Haddock.Interface.AttachInstances
- Haddock.Interface.LexParseRn
- Haddock.Interface.ParseModuleHeader
- Haddock.Interface.RenameType
- Haddock.Parser
- Haddock.Utils
- Haddock.Utils.Json
- Haddock.Utils.Json.Parser
- Haddock.Utils.Json.Types
- Haddock.Backends.Xhtml
- Haddock.Backends.Xhtml.Decl
- Haddock.Backends.Xhtml.DocMarkup
- Haddock.Backends.Xhtml.Layout
- Haddock.Backends.Xhtml.Meta
- Haddock.Backends.Xhtml.Names
- Haddock.Backends.Xhtml.Themes
- Haddock.Backends.Xhtml.Types
- Haddock.Backends.Xhtml.Utils
- Haddock.Backends.LaTeX
- Haddock.Backends.HaddockDB
- Haddock.Backends.Hoogle
- Haddock.Backends.Hyperlinker
- Haddock.Backends.Hyperlinker.Parser
- Haddock.Backends.Hyperlinker.Renderer
- Haddock.Backends.Hyperlinker.Types
- Haddock.Backends.Hyperlinker.Utils
- Haddock.ModuleTree
- Haddock.Types
- Haddock.Doc
- Haddock.Version
- Haddock.InterfaceFile
- Haddock.Options
- Haddock.GhcUtils
- Haddock.Convert
-
- Paths_haddock
-
- autogen-modules:
- Paths_haddock
-
- else
+ base >= 4.13.0.0 && <4.21,
-- in order for haddock's advertised version number to have proper meaning,
-- we pin down to a single haddock-api version.
- build-depends: haddock-api == 2.30.0
+ haddock-api == 2.30.0
test-suite html-test
import: extensions
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ae4b76a741f63186a39bd07e60373ec46aec7ff
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/6ae4b76a741f63186a39bd07e60373ec46aec7ff
You're receiving this email because of your account on gitlab.haskell.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20240813/d3ded070/attachment-0001.html>
More information about the ghc-commits
mailing list