Skip to content

Commit b165e7d

Browse files
committed
Remove unnecessary hie.yaml file creation in setup function
1 parent 97e7c5a commit b165e7d

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

ghcide-bench/src/Experiments.hs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -671,50 +671,30 @@ callCommandLogging cmd = do
671671
output cmd
672672
callCommand cmd
673673

674-
simpleCabalCradleContent :: String
675-
simpleCabalCradleContent = "cradle:\n cabal:\n"
676-
677-
simpleStackCradleContent :: String
678-
simpleStackCradleContent = "cradle:\n stack:\n"
679-
680674
-- | Setup the benchmark
681-
-- we need to create a hie.yaml file for the examples
682-
-- or the hie.yaml file would be searched in the parent directories recursively
683-
-- implicit-hie is error prone for the example test `lsp-types-2.1.1.0`
684-
-- we are using the simpleCabalCradleContent for the hie.yaml file instead.
685-
-- it works if we have cabal > 3.2.
675+
-- we now rely on implicit hie.yaml discovery so no longer need to write one
686676
setup :: HasConfig => IO SetupResult
687677
setup = do
688678
benchDir <- case exampleDetails(example ?config) of
689-
ExamplePath examplePath -> do
690-
let hieYamlPath = examplePath </> "hie.yaml"
691-
alreadyExists <- doesFileExist hieYamlPath
692-
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent
693-
return examplePath
679+
ExamplePath examplePath -> return examplePath
694680
ExampleScript examplePath' scriptArgs -> do
695681
let exampleDir = examplesPath </> exampleName (example ?config)
696682
alreadySetup <- doesDirectoryExist exampleDir
697683
unless alreadySetup $ do
698684
createDirectoryIfMissing True exampleDir
699685
examplePath <- makeAbsolute examplePath'
700686
cmd_ (Cwd exampleDir) examplePath scriptArgs
701-
let hieYamlPath = exampleDir </> "hie.yaml"
702-
alreadyExists <- doesFileExist hieYamlPath
703-
unless alreadyExists $ writeFile hieYamlPath simpleCabalCradleContent
704687

705688
return exampleDir
706689
ExampleHackage ExamplePackage{..} -> do
707690
let path = examplesPath </> package
708691
package = packageName <> "-" <> showVersion packageVersion
709-
hieYamlPath = path </> "hie.yaml"
710692
alreadySetup <- doesDirectoryExist path
711693
unless alreadySetup $
712694
case buildTool ?config of
713695
Cabal -> do
714696
let cabalVerbosity = "-v" ++ show (fromEnum (verbose ?config))
715697
callCommandLogging $ "cabal get " <> cabalVerbosity <> " " <> package <> " -d " <> examplesPath
716-
let hieYamlPath = path </> "hie.yaml"
717-
writeFile hieYamlPath simpleCabalCradleContent
718698
-- Need this in case there is a parent cabal.project somewhere
719699
writeFile
720700
(path </> "cabal.project")
@@ -742,7 +722,6 @@ setup = do
742722
,"compiler"]
743723
]
744724
)
745-
writeFile hieYamlPath simpleStackCradleContent
746725
return path
747726

748727
whenJust (shakeProfiling ?config) $ createDirectoryIfMissing True

0 commit comments

Comments
 (0)