diff --git a/install.hs b/install.hs index 094ee774aa..be440279e4 100755 --- a/install.hs +++ b/install.hs @@ -2,12 +2,12 @@ {- stack runghc --stack-yaml=install/shake.yaml - --package hie-install + --package hls-install -} {- cabal: build-depends: base - , hie-install + , hls-install -} -- call as: -- * `cabal v2-run install.hs --project-file install/shake.project ` @@ -16,6 +16,6 @@ build-depends: -- TODO: set `shake.project` in cabal-config above, when supported -- (see https://github.com/haskell/cabal/issues/6353) -import HieInstall (defaultMain) +import HlsInstall (defaultMain) main = defaultMain diff --git a/install/Setup.hs b/install/Setup.hs deleted file mode 100644 index 9a994af677..0000000000 --- a/install/Setup.hs +++ /dev/null @@ -1,2 +0,0 @@ -import Distribution.Simple -main = defaultMain diff --git a/install/hie-install.cabal b/install/hls-install.cabal similarity index 89% rename from install/hie-install.cabal rename to install/hls-install.cabal index 013d246fe3..197a0f42a8 100644 --- a/install/hie-install.cabal +++ b/install/hls-install.cabal @@ -1,6 +1,6 @@ -name: hie-install +name: hls-install version: 0.8.0.0 -synopsis: Install the haskell-ide-engine +synopsis: Install the haskell-language-engine license: BSD3 author: Many, TBD when we release maintainer: samuel.pilz@posteo.net @@ -10,7 +10,7 @@ cabal-version: >=2.0 library hs-source-dirs: src - exposed-modules: HieInstall + exposed-modules: HlsInstall other-modules: BuildSystem , Stack , Version diff --git a/install/shake.yaml b/install/shake.yaml index 8c30114faa..af55d1d2ef 100644 --- a/install/shake.yaml +++ b/install/shake.yaml @@ -7,5 +7,5 @@ nix: packages: [ zlib ] flags: - hie-install: + hls-install: run-from-stack: true diff --git a/install/src/Cabal.hs b/install/src/Cabal.hs index 8f010c542d..af38070860 100644 --- a/install/src/Cabal.hs +++ b/install/src/Cabal.hs @@ -43,8 +43,8 @@ getGhcPathOfOrThrowError versionNumber = error (ghcVersionNotFoundFailMsg versionNumber) Just p -> return p -cabalInstallHie :: VersionNumber -> [String] -> Action () -cabalInstallHie versionNumber args = do +cabalInstallHls :: VersionNumber -> [String] -> Action () +cabalInstallHls versionNumber args = do localBin <- liftIO $ getInstallDir cabalVersion <- getCabalVersion args ghcPath <- getGhcPathOfOrThrowError versionNumber diff --git a/install/src/Env.hs b/install/src/Env.hs index 5a6c44d96e..6388338639 100644 --- a/install/src/Env.hs +++ b/install/src/Env.hs @@ -41,17 +41,17 @@ isWindowsSystem = os `elem` ["mingw32", "win32"] findInstalledGhcs :: IO [(VersionNumber, GhcPath)] findInstalledGhcs = do - hieVersions <- getHieVersions :: IO [VersionNumber] + hlsVersions <- getHlsVersions :: IO [VersionNumber] knownGhcs <- mapMaybeM (\version -> getGhcPathOf version >>= \case Nothing -> return Nothing Just p -> return $ Just (version, p) ) - (reverse hieVersions) + (reverse hlsVersions) -- filter out not supported ghc versions - availableGhcs <- filter ((`elem` hieVersions) . fst) <$> getGhcPaths + availableGhcs <- filter ((`elem` hlsVersions) . fst) <$> getGhcPaths return - -- sort by version to make it coherent with getHieVersions + -- sort by version to make it coherent with getHlsVersions $ sortBy (comparing fst) -- nub by version. knownGhcs takes precedence. $ nubBy ((==) `on` fst) @@ -103,15 +103,15 @@ ghcVersionNotFoundFailMsg versionNumber = <> "Either install a fitting GHC, use the stack targets or modify the PATH variable accordingly." --- | Defines all different hie versions that are buildable. +-- | Defines all different hls versions that are buildable. -- -- The current directory is scanned for `stack-*.yaml` files. -getHieVersions :: MonadIO m => m [VersionNumber] -getHieVersions = do +getHlsVersions :: MonadIO m => m [VersionNumber] +getHlsVersions = do let stackYamlPrefix = T.pack "stack-" let stackYamlSuffix = T.pack ".yaml" files <- liftIO $ listDirectory "." - let hieVersions = + let hlsVersions = files & map T.pack & mapMaybe @@ -120,10 +120,10 @@ getHieVersions = do -- the following line excludes `8.6.3`, `8.8.1` and `8.8.2` on windows systems & filter (\p -> not (isWindowsSystem && p `elem` ["8.6.3", "8.8.1", "8.8.2"])) & sort - return hieVersions + return hlsVersions --- | Most recent version of hie. +-- | Most recent version of hls. -- Shown in the more concise help message. -mostRecentHieVersion :: MonadIO m => m VersionNumber -mostRecentHieVersion = last <$> getHieVersions +mostRecentHlsVersion :: MonadIO m => m VersionNumber +mostRecentHlsVersion = last <$> getHlsVersions diff --git a/install/src/Help.hs b/install/src/Help.hs index 885c520fc0..f831f33f1f 100644 --- a/install/src/Help.hs +++ b/install/src/Help.hs @@ -30,20 +30,20 @@ printUsage = do -- | short help message is printed by default shortHelpMessage :: Action () shortHelpMessage = do - hieVersions <- getHieVersions + hlsVersions <- getHlsVersions printUsage printLine "" printLine "Targets:" - mapM_ (printLineIndented . showHelpItem (spaces hieVersions)) (targets hieVersions) + mapM_ (printLineIndented . showHelpItem (spaces hlsVersions)) (targets hlsVersions) printLine "" where - spaces hieVersions = space (targets hieVersions) - targets hieVersions = + spaces hlsVersions = space (targets hlsVersions) + targets hlsVersions = [ ("help", "Show help message including all targets") , emptyTarget , buildTarget , buildLatestTarget - , hieTarget $ last hieVersions + , hlsTarget $ last hlsVersions , buildDataTarget , cabalGhcsTarget ] @@ -90,7 +90,7 @@ helpMessage versions@BuildableVersions {..} = do generalTargets = [helpTarget] defaultTargets = [buildTarget, buildLatestTarget, buildDataTarget] - ++ map hieTarget (getDefaultBuildSystemVersions versions) + ++ map hlsTarget (getDefaultBuildSystemVersions versions) -- | Empty target. Purpose is to introduce a newline between the targets emptyTarget :: (String, String) @@ -99,8 +99,8 @@ emptyTarget = ("", "") templateTarget :: (String, String) templateTarget = ("", "") -hieTarget :: String -> TargetDescription -hieTarget version = +hlsTarget :: String -> TargetDescription +hlsTarget version = ("hls-" ++ version, "Install haskell-language-server for GHC version " ++ version) buildTarget :: TargetDescription diff --git a/install/src/HieInstall.hs b/install/src/HlsInstall.hs similarity index 91% rename from install/src/HieInstall.hs rename to install/src/HlsInstall.hs index 72652790bd..3e25a39fc7 100644 --- a/install/src/HieInstall.hs +++ b/install/src/HlsInstall.hs @@ -1,4 +1,4 @@ -module HieInstall where +module HlsInstall where import Development.Shake import Control.Monad @@ -21,7 +21,7 @@ defaultMain = do let cabalVersions = map fst ghcPaths -- used for stack-based targets - stackVersions <- getHieVersions + stackVersions <- getHlsVersions let versions = if isRunFromStack then stackVersions else cabalVersions @@ -62,9 +62,9 @@ defaultMain = do need ["submodules"] need ["check"] if isRunFromStack then - stackInstallHieWithErrMsg (Just version) args + stackInstallHlsWithErrMsg (Just version) args else - cabalInstallHie version args + cabalInstallHls version args ) unless (null versions) $ do @@ -72,12 +72,12 @@ defaultMain = do phony "hls" (need ["data", "latest"]) -- stack specific targets - -- Default `stack.yaml` uses ghc-8.8.2 and we can't build hie in windows + -- Default `stack.yaml` uses ghc-8.8.2 and we can't build hls in windows -- TODO: Enable for windows when it uses ghc-8.8.3 when (isRunFromStack && not isWindowsSystem) $ phony "dev" $ do need ["show-options"] - stackInstallHieWithErrMsg Nothing args + stackInstallHlsWithErrMsg Nothing args -- cabal specific targets when isRunFromCabal $ do diff --git a/install/src/Stack.hs b/install/src/Stack.hs index 355d94e535..8052b65247 100644 --- a/install/src/Stack.hs +++ b/install/src/Stack.hs @@ -9,14 +9,14 @@ import System.Directory ( copyFile ) import Version import Print -stackInstallHieWithErrMsg :: Maybe VersionNumber -> [String] -> Action () -stackInstallHieWithErrMsg mbVersionNumber args = - stackInstallHie mbVersionNumber args +stackInstallHlsWithErrMsg :: Maybe VersionNumber -> [String] -> Action () +stackInstallHlsWithErrMsg mbVersionNumber args = + stackInstallHls mbVersionNumber args `actionOnException` liftIO (putStrLn stackBuildFailMsg) -- | copy the built binaries into the localBinDir -stackInstallHie :: Maybe VersionNumber -> [String] -> Action () -stackInstallHie mbVersionNumber args = do +stackInstallHls :: Maybe VersionNumber -> [String] -> Action () +stackInstallHls mbVersionNumber args = do versionNumber <- case mbVersionNumber of Nothing -> do @@ -30,11 +30,11 @@ stackInstallHie mbVersionNumber args = do return vn localBinDir <- getLocalBin args - let hie = "haskell-language-server" <.> exe + let hls = "haskell-language-server" <.> exe liftIO $ do - copyFile (localBinDir hie) + copyFile (localBinDir hls) (localBinDir "haskell-language-server-" ++ versionNumber <.> exe) - copyFile (localBinDir hie) + copyFile (localBinDir hls) (localBinDir "haskell-language-server-" ++ dropExtension versionNumber <.> exe) getGhcVersionOfCfgFile :: String -> [String] -> Action VersionNumber