Skip to content

Commit 2747a15

Browse files
committed
Set the root for tests to the test directory
On startup, HLS performs a sanity check to validate the GHC version for the project is the same as the GHC version used to build HLS. Due to some oversights, the tests always use HLS's cabal package to perform this check. This is (almost) valid for the tests but adds overhead for finding the GHC version for each integration test in HLS. Improves the startup time for each integration tests that depends on hls-test-utils. Thus, ghcide test suite is unaffected. Fix `findCradle` invocations to point to a file in the root directory. `findCradle` from hie-bios doesn't work correctly for directories and requires a file, even if that file doesn't exist.
1 parent c941dac commit 2747a15

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

ghcide/session-loader/Development/IDE/Session.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ loadWithImplicitCradle mHieYaml rootDir = do
266266

267267
getInitialGhcLibDirDefault :: Recorder (WithPriority Log) -> FilePath -> IO (Maybe LibDir)
268268
getInitialGhcLibDirDefault recorder rootDir = do
269-
hieYaml <- findCradle def rootDir
269+
hieYaml <- findCradle def (rootDir </> "a")
270270
cradle <- loadCradle def hieYaml rootDir
271271
libDirRes <- getRuntimeGhcLibDir (toCologActionWithPrio (cmapWithPrio LogHieBios recorder)) cradle
272272
case libDirRes of

hls-test-utils/src/Test/Hls.hs

+1
Original file line numberDiff line numberDiff line change
@@ -617,6 +617,7 @@ runSessionWithServer' plugins conf sconf caps root s = withLock lock $ keepCurr
617617
, argsDefaultHlsConfig = conf
618618
, argsLogger = argsLogger
619619
, argsIdeOptions = ideOptions
620+
, argsProjectRoot = Just root
620621
}
621622

622623
x <- runSessionWithHandles inW outR sconf' caps root s

src/Ide/Main.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ defaultMain recorder args idePlugins = do
9090

9191
BiosMode PrintCradleType -> do
9292
dir <- IO.getCurrentDirectory
93-
hieYaml <- Session.findCradle def dir
93+
hieYaml <- Session.findCradle def (dir </> "a")
9494
cradle <- Session.loadCradle def hieYaml dir
9595
print cradle
9696

0 commit comments

Comments
 (0)