[Git][ghc/ghc][wip/ci-docs] 2 commits: hadrian: Improve parallelism in binary-dist-dir rule

Matthew Pickering (@mpickering) gitlab at gitlab.haskell.org
Wed Feb 28 10:34:31 UTC 2024



Matthew Pickering pushed to branch wip/ci-docs at Glasgow Haskell Compiler / GHC


Commits:
3fe285a0 by Matthew Pickering at 2024-02-28T10:23:55+00:00
hadrian: Improve parallelism in binary-dist-dir rule

I noticed that the "docs" target was needed after the libraries and
executables were built. We can improve the parallelism by needing
everything at once so that documentation can be built immediately after
a library is built for example.

- - - - -
f63132b6 by Matthew Pickering at 2024-02-28T10:34:24+00:00
try..

- - - - -


2 changed files:

- .gitlab/ci.sh
- hadrian/src/Rules/BinaryDist.hs


Changes:

=====================================
.gitlab/ci.sh
=====================================
@@ -361,6 +361,8 @@ function fetch_sphinx() {
           cp -p $toolchain/sphinx/bin/sphinx-build $toolchain/sphinx/bin/sphinx-build.exe
           chmod +x $toolchain/sphinx/bin/sphinx-build.exe
           ls -alh $toolchain/sphinx/bin
+          ls -alh $toolchain/sphinx/
+          cat $toolchain/sphinx/bin/sphinx-build.exe
 #          $PYTHON -m venv $toolchain/.venv-sphinx
 #          $toolchain/.venv-sphinx/bin/pip uninstall -y sphinx
 #          cat $toolchain/.venv-sphinx/bin/pip


=====================================
hadrian/src/Rules/BinaryDist.hs
=====================================
@@ -145,12 +145,7 @@ bindistRules = do
         installTo NotRelocatable installPrefix
 
     phony "binary-dist-dir" $ do
-        -- We 'need' all binaries and libraries
-        all_pkgs <- stagePackages Stage1
-        (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs
-        cross <- flag CrossCompiling
-        iserv_targets <- if cross then pure [] else iservBins
-        need (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets)))
+
 
         version        <- setting ProjectVersion
         targetPlatform <- setting TargetPlatformFull
@@ -164,6 +159,22 @@ bindistRules = do
             rtsIncludeDir    = ghcBuildDir -/- "lib" -/- distDir -/- rtsDir
                                -/- "include"
 
+        -- We 'need' all binaries and libraries
+        all_pkgs <- stagePackages Stage1
+        (lib_targets, bin_targets) <- partitionEithers <$> mapM pkgTarget all_pkgs
+        cross <- flag CrossCompiling
+        iserv_targets <- if cross then pure [] else iservBins
+
+        let lib_exe_targets = (lib_targets ++ (map (\(_, p) -> p) (bin_targets ++ iserv_targets)))
+
+        let doc_target = if cross then [] else ["docs"]
+
+        let other_targets = map (bindistFilesDir -/-) (["configure", "Makefile"] ++ bindistInstallFiles)
+        let all_targets = lib_exe_targets ++ doc_target ++ other_targets
+
+        -- Better parallelism if everything is needed together.
+        need all_targets
+
         -- We create the bindist directory at <root>/bindist/ghc-X.Y.Z-platform/
         -- and populate it with Stage2 build results
         createDirectory bindistFilesDir
@@ -232,7 +243,6 @@ bindistRules = do
         cmd_ (bindistFilesDir -/- "bin" -/- ghcPkgName) ["recache"]
 
 
-        unless cross $ need ["docs"]
 
         -- TODO: we should only embed the docs that have been generated
         -- depending on the current settings (flavours' "ghcDocs" field and
@@ -274,8 +284,6 @@ bindistRules = do
         -- We then 'need' all the files necessary to configure and install
         -- (as in, './configure [...] && make install') this build on some
         -- other machine.
-        need $ map (bindistFilesDir -/-)
-                  (["configure", "Makefile"] ++ bindistInstallFiles)
         copyFile ("hadrian" -/- "bindist" -/- "config.mk.in") (bindistFilesDir -/- "config.mk.in")
         generateBuildMk >>= writeFile' (bindistFilesDir -/- "build.mk")
         copyFile ("hadrian" -/- "cfg" -/- "default.target.in") (bindistFilesDir -/- "default.target.in")



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/16b851b0f586752041994dea20574817e3941733...f63132b6eec4031d7f1f3560feb821d74c3ccaa0

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/compare/16b851b0f586752041994dea20574817e3941733...f63132b6eec4031d7f1f3560feb821d74c3ccaa0
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/20240228/f045b1ee/attachment-0001.html>


More information about the ghc-commits mailing list