From 08e3144d37e3e29d5d2a44b7e781fac602600c88 Mon Sep 17 00:00:00 2001
From: Cheng Shao <terrorjack@type.dance>
Date: Thu, 22 Feb 2024 17:46:54 +0000
Subject: [PATCH] hadrian/hie-bios: pass -j to hadrian

This commit passes -j to hadrian in the hadrian/hie-bios scripts. When
the user starts HLS in a fresh clone that has just been configured, it
takes quite a while for hie-bios to pick up the ghc flags and start
actual indexing, due to the fact that the hadrian build step defaulted
to -j1, so -j speeds things up and improve HLS user experience in GHC.
Also add -j flag to .ghcid to speed up ghcid, and sets the Windows
build root to .hie-bios which also works and unifies with other
platforms, the previous build root _hie-bios was missing from
.gitignore anyway.

(cherry picked from commit c71bfdff79f2d92c843dc10c63f3e6b3a566d9f4)
---
 .ghcid               | 2 +-
 hadrian/hie-bios     | 3 +--
 hadrian/hie-bios.bat | 2 +-
 3 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/.ghcid b/.ghcid
index 966e6f5b0fa..15a7309c865 100644
--- a/.ghcid
+++ b/.ghcid
@@ -1,4 +1,4 @@
---command sh ./hadrian/ghci
+--command sh -c "HADRIAN_ARGS=-j ./hadrian/ghci -j"
 --reload compiler
 --reload ghc
 --reload includes
diff --git a/hadrian/hie-bios b/hadrian/hie-bios
index 49224253b8a..aa0982769dc 100755
--- a/hadrian/hie-bios
+++ b/hadrian/hie-bios
@@ -3,5 +3,4 @@
 # When run, this program will output a list of arguments which are necessary to
 # load the GHC library component into GHCi. The program is used by `ghcide` in
 # order to automatically set up the correct GHC API session for a project.
-TERM=dumb CABFLAGS=-v0 TOOL_OUTPUT=$HIE_BIOS_OUTPUT $PWD/hadrian/build-cabal tool:$1 -q --build-root=.hie-bios --flavour=ghc-in-ghci
-
+TERM=dumb CABFLAGS=-v0 TOOL_OUTPUT=$HIE_BIOS_OUTPUT $PWD/hadrian/build-cabal tool:$1 -q --build-root=.hie-bios --flavour=ghc-in-ghci -j
diff --git a/hadrian/hie-bios.bat b/hadrian/hie-bios.bat
index 73bbea82be3..dce803e6464 100644
--- a/hadrian/hie-bios.bat
+++ b/hadrian/hie-bios.bat
@@ -1,4 +1,4 @@
 set TERM=dumb
 set CABFLAGS=-v0
 set TOOL_OUTPUT=%HIE_BIOS_OUTPUT%
-%CD%\hadrian\build-cabal.bat tool:%1 --build-root=_hie-bios --flavour=ghc-in-ghci
+%CD%\hadrian\build-cabal.bat tool:%1 --build-root=.hie-bios --flavour=ghc-in-ghci -j
-- 
GitLab