[Git][ghc/ghc][master] 4 commits: rel_eng: Update hackage docs upload scripts
Marge Bot (@marge-bot)
gitlab at gitlab.haskell.org
Tue Mar 5 19:22:58 UTC 2024
Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC
Commits:
18ad1077 by Matthew Pickering at 2024-03-05T14:22:31-05:00
rel_eng: Update hackage docs upload scripts
This adds the upload of ghc-internal and ghc-experimental to our scripts
which upload packages to hackage.
- - - - -
bf47c9ba by Matthew Pickering at 2024-03-05T14:22:31-05:00
docs: Remove stray module comment from GHC.Profiling.Eras
- - - - -
37d9b340 by Matthew Pickering at 2024-03-05T14:22:31-05:00
Fix ghc-internal cabal file
The file mentioned some artifacts relating to the base library. I have
renamed these to the new ghc-internal variants.
- - - - -
23f2a478 by Matthew Pickering at 2024-03-05T14:22:31-05:00
Fix haddock source links and hyperlinked source
There were a few issues with the hackage links:
1. We were using the package id rather than the package name for the
package links. This is fixed by now allowing the template to mention
%pkg% or %pkgid% and substituing both appropiatly.
2. The `--haddock-base-url` flag is renamed to `--haddock-for-hackage`
as the new base link works on a local or remote hackage server.
3. The "src" path including too much stuff, so cross-package source
links were broken as the template was getting double expanded.
Fixes #24086
- - - - -
8 changed files:
- .gitlab/generate-ci/gen_ci.hs
- .gitlab/jobs.yaml
- .gitlab/rel_eng/upload_ghc_libs.py
- hadrian/README.md
- hadrian/src/CommandLine.hs
- hadrian/src/Settings/Builders/Haddock.hs
- libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
- libraries/ghc-internal/ghc-internal.cabal
Changes:
=====================================
.gitlab/generate-ci/gen_ci.hs
=====================================
@@ -1031,7 +1031,7 @@ job_groups =
-- (see Note [Object unloading]).
fullyStaticBrokenTests = modifyJobs (addVariable "BROKEN_TESTS" "ghcilink002 linker_unload_native")
- hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-base-url")
+ hackage_doc_job = rename (<> "-hackage") . modifyJobs (addVariable "HADRIAN_ARGS" "--haddock-for-hackage")
tsan_jobs =
modifyJobs
=====================================
.gitlab/jobs.yaml
=====================================
@@ -2330,7 +2330,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "HADRIAN_ARGS": "--haddock-base-url",
+ "HADRIAN_ARGS": "--haddock-for-hackage",
"LLC": "/bin/false",
"OPT": "/bin/false",
"RUNTEST_ARGS": "",
@@ -4007,7 +4007,7 @@
"BIN_DIST_NAME": "ghc-x86_64-linux-fedora33-release",
"BUILD_FLAVOUR": "release",
"CONFIGURE_ARGS": "--enable-strict-ghc-toolchain-check",
- "HADRIAN_ARGS": "--haddock-base-url --hash-unit-ids",
+ "HADRIAN_ARGS": "--haddock-for-hackage --hash-unit-ids",
"IGNORE_PERF_FAILURES": "all",
"LLC": "/bin/false",
"OPT": "/bin/false",
=====================================
.gitlab/rel_eng/upload_ghc_libs.py
=====================================
@@ -49,6 +49,10 @@ def prep_base():
shutil.copy('config.guess', 'libraries/base')
shutil.copy('config.sub', 'libraries/base')
+def prep_ghc_internal():
+ shutil.copy('config.guess', 'libraries/ghc-internal')
+ shutil.copy('config.sub', 'libraries/ghc-internal')
+
def build_copy_file(pkg: Package, f: Path):
target = Path('_build') / 'stage1' / pkg.path / 'build' / f
dest = pkg.path / f
@@ -93,6 +97,8 @@ PACKAGES = {
pkg.name: pkg
for pkg in [
Package('base', Path("libraries/base"), prep_base),
+ Package('ghc-internal', Path("libraries/ghc-internal"), prep_ghc_internal),
+ Package('ghc-experimental', Path("libraries/ghc-experimental"), no_prep),
Package('ghc-prim', Path("libraries/ghc-prim"), prep_ghc_prim),
Package('integer-gmp', Path("libraries/integer-gmp"), no_prep),
Package('ghc-bignum', Path("libraries/ghc-bignum"), prep_ghc_bignum),
=====================================
hadrian/README.md
=====================================
@@ -306,9 +306,9 @@ all of the documentation targets:
You can pass several `--docs=...` flags, Hadrian will combine
their effects.
-To build haddock documentation for upload to hackage you need to pass the `--haddock-base-url` flag,
-by default this will choose a url suitable for uploading to hackage but you might also want to pass something like
-`http://127.0.0.1:8080/package/%pkg%/docs` for testing upload locally on a local hackage server.
+To build haddock documentation for upload to hackage you need to pass the `--haddock-for-hackage` flag,
+This will generate URLs which are appropiate for either uploading to a local hackage
+server or the global hackage server.
#### Source distribution
=====================================
hadrian/src/CommandLine.hs
=====================================
@@ -17,7 +17,6 @@ import System.Environment
import qualified System.Directory as Directory
import qualified Data.Set as Set
-import Data.Maybe
data TestSpeed = TestSlow | TestNormal | TestFast deriving (Show, Eq)
@@ -114,7 +113,7 @@ data DocArgs = DocArgs
} deriving (Eq, Show)
defaultDocArgs :: DocArgs
-defaultDocArgs = DocArgs { docsBaseUrl = "../%pkg%" }
+defaultDocArgs = DocArgs { docsBaseUrl = "../%pkgid%" }
readConfigure :: Either String (CommandLineArgs -> CommandLineArgs)
readConfigure = Left "hadrian --configure has been deprecated (see #20167). Please run ./boot; ./configure manually"
@@ -192,11 +191,11 @@ readTestOnlyPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testO
readTestSkipPerf :: Either String (CommandLineArgs -> CommandLineArgs)
readTestSkipPerf = Right $ \flags -> flags { testArgs = (testArgs flags) { testSkipPerf = True } }
-readHaddockBaseUrl :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
-readHaddockBaseUrl base_url = Right $ \flags ->
- flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url' } }
+readHaddockBaseUrl :: Either String (CommandLineArgs -> CommandLineArgs)
+readHaddockBaseUrl = Right $ \flags ->
+ flags { docsArgs = (docsArgs flags) { docsBaseUrl = base_url } }
- where base_url' = fromMaybe "https://hackage.haskell.org/package/%pkg%/docs" base_url
+ where base_url = "/package/%pkg%/docs"
readTestRootDirs :: Maybe String -> Either String (CommandLineArgs -> CommandLineArgs)
@@ -320,8 +319,8 @@ optDescrs =
"Destination path for the bindist 'install' rule"
, Option [] ["complete-setting"] (OptArg readCompleteStg "SETTING")
"Setting key to autocomplete, for the 'autocomplete' target."
- , Option [] ["haddock-base-url"] (OptArg readHaddockBaseUrl "BASE_URL")
- "Generate documentation suitable for upload to hackage or for another base URL (for example a local hackage server)."
+ , Option [] ["haddock-for-hackage"] (NoArg readHaddockBaseUrl)
+ "Generate documentation suitable for upload to a hackage server."
]
-- | A type-indexed map containing Hadrian command line arguments to be passed
=====================================
hadrian/src/Settings/Builders/Haddock.hs
=====================================
@@ -43,12 +43,15 @@ haddockBuilderArgs = mconcat
version <- expr $ pkgVersion pkg
synopsis <- expr $ pkgSynopsis pkg
haddocks <- expr $ haddockDependencies context
- haddocks_with_versions <- expr $ sequence $ [(,h) <$> pkgUnitId stage p | (p, h) <- haddocks]
+ haddocks_with_versions <- expr $ sequence $ [(,,h) <$> pkgSimpleIdentifier p <*> pkgUnitId stage p | (p, h) <- haddocks]
hVersion <- expr $ pkgVersion haddock
statsDir <- expr $ haddockStatsFilesDir
baseUrlTemplate <- expr (docsBaseUrl <$> userSetting defaultDocArgs)
- let baseUrl p = substituteTemplate baseUrlTemplate p
+ -- The path to where the docs for a package are
+ let docpath p = substituteTemplate baseUrlTemplate p
+ -- The path to where the src folder is for a package (typically docs ++ "/src/")
+ let srcpath p = docpath p ++ "/src/"
ghcOpts <- haddockGhcArgs
-- These are the options which are necessary to perform the build. Additional
-- options such as `--hyperlinked-source`, `--hoogle`, `--quickjump` are
@@ -67,14 +70,18 @@ haddockBuilderArgs = mconcat
, arg $ "--optghc=-D__HADDOCK_VERSION__="
++ show (versionToInt hVersion)
, map ("--hide=" ++) <$> getContextData otherModules
- , pure [ "--read-interface=../" ++ p
- ++ "," ++ baseUrl p ++ "/src/%{MODULE}.html#%{NAME},"
- ++ haddock | (p, haddock) <- haddocks_with_versions ]
+ , pure [ "--read-interface=" ++ docpath (p, pid)
+ ++ "," ++ srcpath (p, pid) ++ ","
+ ++ haddock | (p, pid, haddock) <- haddocks_with_versions ]
, pure [ "--optghc=" ++ opt | opt <- ghcOpts, not ("--package-db" `isInfixOf` opt) ]
, arg "+RTS"
, arg $ "-t" ++ (statsDir -/- pkgName pkg ++ ".t")
, arg "--machine-readable"
, arg "-RTS" ] ]
-substituteTemplate :: String -> String -> String
-substituteTemplate baseTemplate pkgId = T.unpack . T.replace "%pkg%" (T.pack pkgId) . T.pack $ baseTemplate
+substituteTemplate :: String -> (String, String) -> String
+substituteTemplate baseTemplate (pkg, pkgId) =
+ T.unpack
+ . T.replace "%pkg%" (T.pack pkg)
+ . T.replace "%pkgid%" (T.pack pkgId)
+ . T.pack $ baseTemplate
=====================================
libraries/ghc-experimental/src/GHC/Profiling/Eras.hs
=====================================
@@ -1,7 +1,6 @@
{-# LANGUAGE Trustworthy #-}
{-# LANGUAGE NoImplicitPrelude #-}
--- | TODO move this module into ghc-internals
module GHC.Profiling.Eras ( setUserEra
, getUserEra
, incrementUserEra
=====================================
libraries/ghc-internal/ghc-internal.cabal
=====================================
@@ -17,7 +17,7 @@ description:
extra-tmp-files:
autom4te.cache
- base.buildinfo
+ ghc-internal.buildinfo
config.log
config.status
include/EventConfig.h
@@ -25,8 +25,8 @@ extra-tmp-files:
extra-source-files:
aclocal.m4
- base.buildinfo.in
- changelog.md
+ ghc-internal.buildinfo.in
+ CHANGELOG.md
configure
configure.ac
include/CTypes.h
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82ccb8012ba532f0fa06dc6ff96d33217560088a...23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f
--
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/82ccb8012ba532f0fa06dc6ff96d33217560088a...23f2a478b7dc6b61cab86cf7d0db7fec8a6d9a1f
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/20240305/89d58756/attachment-0001.html>
More information about the ghc-commits
mailing list