From 008ef208b98f788c7bc8fead8a19b5fcf2dc5ac8 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 23 Feb 2020 23:55:06 +0100 Subject: [PATCH 01/17] Use ghc-8.2.2 for linux+cabal --- .azure/linux-cabal.yml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/.azure/linux-cabal.yml b/.azure/linux-cabal.yml index 1e93abedb..3f5e8081b 100644 --- a/.azure/linux-cabal.yml +++ b/.azure/linux-cabal.yml @@ -5,11 +5,8 @@ jobs: vmImage: ubuntu-16.04 strategy: matrix: - # Fail with compilation error building haddock-api - # ghc-8.8.2: - # GHC_VERSION: "8.8.2" - ghc-8.8.1: - GHC_VERSION: "8.8.1" + ghc-8.8.2: + GHC_VERSION: "8.8.2" ghc-8.6.5: GHC_VERSION: "8.6.5" ghc-8.4.4: From 0af983c31d8cc03ebe4f2b5456af7a77f73bce8b Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 23 Feb 2020 23:56:11 +0100 Subject: [PATCH 02/17] Change macos stack bashrc file --- .azure/{macos.bashrc => macos-stack.bashrc} | 0 .azure/macos-stack.yml | 22 ++++++++++----------- 2 files changed, 11 insertions(+), 11 deletions(-) rename .azure/{macos.bashrc => macos-stack.bashrc} (100%) diff --git a/.azure/macos.bashrc b/.azure/macos-stack.bashrc similarity index 100% rename from .azure/macos.bashrc rename to .azure/macos-stack.bashrc diff --git a/.azure/macos-stack.yml b/.azure/macos-stack.yml index 4b0cfd90b..fad15c141 100644 --- a/.azure/macos-stack.yml +++ b/.azure/macos-stack.yml @@ -47,19 +47,19 @@ jobs: tar vxz --strip-components=1 --include '*/stack' -C ~/.local/bin; displayName: Install stack - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack setup --stack-yaml $(YAML_FILE) displayName: Install GHC - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies displayName: Build dependencies - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack build --stack-yaml $(YAML_FILE) displayName: Build `hie` - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack install --stack-yaml $(YAML_FILE) # `hie` binary required locally for tests mkdir .azure-deploy stack install --stack-yaml $(YAML_FILE) --local-bin-path .azure-deploy @@ -76,7 +76,7 @@ jobs: tar -vczf $(Build.ArtifactStagingDirectory)/$ARTIFACT_NAME.tar.xz * displayName: Install `hie` - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack build --stack-yaml $(YAML_FILE) --test --bench --only-dependencies displayName: Build Test-dependencies - bash: | @@ -86,26 +86,26 @@ jobs: brew install z3 displayName: "Install Runtime Test-Dependencies: z3" - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack install --resolver=lts-13.20 liquid-fixpoint-0.8.0.2 liquidhaskell-0.8.6.2 displayName: "Install Runtime Test-Dependencies: liquidhaskell" - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack build hoogle --stack-yaml=$(YAML_FILE) # This step frequently fails with http 403 stack exec hoogle generate --stack-yaml=$(YAML_FILE) || stack exec hoogle generate --stack-yaml=$(YAML_FILE) displayName: "Install Runtime Test-Dependencies: hoogle database" - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc brew install cabal-install displayName: "Install Runtime Unit Test-Dependencies: cabal" - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack test :unit-test --stack-yaml $(YAML_FILE) displayName: "Run Test: unit-test" # TODO: Enable dispatcher-test for ghc-8.4.* - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc GHC_MAJOR_VERSION=${YAML_FILE:6:3} if [ $GHC_MAJOR_VERSION != "8.4" ]; then TEST_TARGETS=:dispatcher-test :plugin-dispatcher-test :wrapper-test @@ -117,7 +117,7 @@ jobs: condition: False # TODO: Enable func-test for ghc-8.4.* - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc GHC_MAJOR_VERSION=${YAML_FILE:6:3} if [ $GHC_MAJOR_VERSION != "8.4" ]; then stack test :func-test --stack-yaml $(YAML_FILE) From 2cebb0817ad23c23b8dc1e9415ae105931e74d03 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 23 Feb 2020 23:57:14 +0100 Subject: [PATCH 03/17] Correct target name --- .azure/windows-installhs-cabal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/windows-installhs-cabal.yml b/.azure/windows-installhs-cabal.yml index 662931078..84500a0b4 100644 --- a/.azure/windows-installhs-cabal.yml +++ b/.azure/windows-installhs-cabal.yml @@ -46,7 +46,7 @@ jobs: - bash: | source .azure/windows-cabal.bashrc cabal v2-run ./install.hs --project-file $PROJECT_FILE latest - displayName: Run build-latest target of `install.hs` + displayName: Run latest target of `install.hs` - bash: | source .azure/windows-cabal.bashrc mkdir -p .azure-cache From eb294f7a872d2b5c9757635e949a93f2c05b21f3 Mon Sep 17 00:00:00 2001 From: jneira Date: Sun, 23 Feb 2020 23:57:58 +0100 Subject: [PATCH 04/17] Add installhs cabal for macos --- .azure/macos-cabal.bashrc | 2 ++ .azure/macos-installhs-cabal.yml | 42 ++++++++++++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100644 .azure/macos-cabal.bashrc create mode 100644 .azure/macos-installhs-cabal.yml diff --git a/.azure/macos-cabal.bashrc b/.azure/macos-cabal.bashrc new file mode 100644 index 000000000..90489c404 --- /dev/null +++ b/.azure/macos-cabal.bashrc @@ -0,0 +1,2 @@ +export CABAL_ROOT=$HOME/.cabal +export PATH=$CABAL_ROOT/bin:$PATH diff --git a/.azure/macos-installhs-cabal.yml b/.azure/macos-installhs-cabal.yml new file mode 100644 index 000000000..7a84007b6 --- /dev/null +++ b/.azure/macos-installhs-cabal.yml @@ -0,0 +1,42 @@ +jobs: +- job: MacOs_installhs_Cabal + timeoutInMinutes: 0 + pool: + vmImage: macOS-10.14 + variables: + PROJECT_FILE: "./install/shake.project" + steps: + - task: Cache@2 + inputs: + key: '"cabal-installhs" | "$(Agent.OS)" | $(Build.SourcesDirectory)/cabal.project | $(Build.SourcesDirectory)/haskell-ide-engine.cabal | $(Build.SourcesDirectory)/hie-plugin-api/hie-plugin-api.cabal' + path: .azure-cache + cacheHitVar: CACHE_RESTORED + displayName: "Download cache" + - bash: | + source .azure/macos-cabal.bashrc + mkdir -p $CABAL_ROOT + tar -vxzf .azure-cache/cabal-root.tar.gz -C / + mkdir -p dist-newstyle + tar -vxzf .azure-cache/cabal-dist.tar.gz + displayName: "Unpack cache" + condition: eq(variables.CACHE_RESTORED, 'true') + - bash: | + brew install cabal-install + which cabal + which ghc + cabal update + displayName: Install cabal and ghc + - bash: | + source .azure/windows-cabal.bashrc + cabal v2-run ./install.hs --project-file $PROJECT_FILE -- help + displayName: Run help of `install.hs` + - bash: | + source .azure/windows-cabal.bashrc + cabal v2-run ./install.hs --project-file $PROJECT_FILE -- latest + displayName: Run latest target of `install.hs` + - bash: | + source .azure/macos-cabal.bashrc + mkdir -p .azure-cache + tar -vczf .azure-cache/cabal-root.tar.gz $CABAL_ROOT + tar -vczf .azure-cache/cabal-dist.tar.gz dist-newstyle + displayName: "Pack cache" From 70dca0e14c785812cf4b7d587dc935b985ae377a Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 00:04:51 +0100 Subject: [PATCH 05/17] Add new installhs job with cabal on macos --- azure-pipelines.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index e9345a9cb..0ed02f2c3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -40,4 +40,5 @@ jobs: - template: ./.azure/linux-installhs-stack.yml - template: ./.azure/windows-installhs-stack.yml - template: ./.azure/windows-installhs-cabal.yml +- template: ./.azure/macos-installhs-cabal.yml - template: ./.azure/macos-installhs-stack.yml From e23352ec6cb514a2961fbbaf016077a98ca3fbb5 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 00:09:53 +0100 Subject: [PATCH 06/17] Correct identation --- .azure/macos-installhs-cabal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/macos-installhs-cabal.yml b/.azure/macos-installhs-cabal.yml index 7a84007b6..1d0b16013 100644 --- a/.azure/macos-installhs-cabal.yml +++ b/.azure/macos-installhs-cabal.yml @@ -26,7 +26,7 @@ jobs: which ghc cabal update displayName: Install cabal and ghc - - bash: | + - bash: | source .azure/windows-cabal.bashrc cabal v2-run ./install.hs --project-file $PROJECT_FILE -- help displayName: Run help of `install.hs` From 16707b7231493f6bbfa9f356d7d81d093bee1ed1 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 00:10:45 +0100 Subject: [PATCH 07/17] Disable all jobs but the new one --- azure-pipelines.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 0ed02f2c3..a52db7e23 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,13 +32,13 @@ pr: - '*.md' jobs: -- template: ./.azure/linux-stack.yml -- template: ./.azure/linux-cabal.yml -- template: ./.azure/windows-stack.yml -- template: ./.azure/windows-cabal.yml -- template: ./.azure/macos-stack.yml -- template: ./.azure/linux-installhs-stack.yml -- template: ./.azure/windows-installhs-stack.yml -- template: ./.azure/windows-installhs-cabal.yml +# - template: ./.azure/linux-stack.yml +# - template: ./.azure/linux-cabal.yml +# - template: ./.azure/windows-stack.yml +# - template: ./.azure/windows-cabal.yml +# - template: ./.azure/macos-stack.yml +# - template: ./.azure/linux-installhs-stack.yml +# - template: ./.azure/windows-installhs-stack.yml +#- template: ./.azure/windows-installhs-cabal.yml - template: ./.azure/macos-installhs-cabal.yml -- template: ./.azure/macos-installhs-stack.yml +# - template: ./.azure/macos-installhs-stack.yml From d5a13a2d59e9d589f1721c4f2ad9ba2a2d0e2903 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 00:41:56 +0100 Subject: [PATCH 08/17] Enable all macos jobs --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index a52db7e23..33b7989de 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -36,9 +36,9 @@ jobs: # - template: ./.azure/linux-cabal.yml # - template: ./.azure/windows-stack.yml # - template: ./.azure/windows-cabal.yml -# - template: ./.azure/macos-stack.yml +- template: ./.azure/macos-stack.yml # - template: ./.azure/linux-installhs-stack.yml # - template: ./.azure/windows-installhs-stack.yml #- template: ./.azure/windows-installhs-cabal.yml - template: ./.azure/macos-installhs-cabal.yml -# - template: ./.azure/macos-installhs-stack.yml +- template: ./.azure/macos-installhs-stack.yml From 4d048938d46742c2ce795b7c36d25f92af963eaa Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 06:27:23 +0100 Subject: [PATCH 09/17] Use new macos-stack.bashrc for installhs --- .azure/macos-installhs-stack.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.azure/macos-installhs-stack.yml b/.azure/macos-installhs-stack.yml index 4b3a9a04e..0de8c9bdb 100644 --- a/.azure/macos-installhs-stack.yml +++ b/.azure/macos-installhs-stack.yml @@ -28,23 +28,23 @@ jobs: tar xz --strip-components=1 --include '*/stack' -C ~/.local/bin; displayName: Install stack - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack setup --stack-yaml $(YAML_FILE) displayName: Install GHC - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack --stack-yaml $(YAML_FILE) --install-ghc build --only-dependencies displayName: Build dependencies - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack build --stack-yaml $(YAML_FILE) displayName: Build `hie-install` - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack install.hs help displayName: Run help of `install.hs` - bash: | - source .azure/macos.bashrc + source .azure/macos-stack.bashrc stack install.hs latest displayName: Run latest target of `install.hs` - bash: | From b46a5314546a6d7ff3f06eaa4dc8aea212c6be83 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:17:24 +0100 Subject: [PATCH 10/17] Several improvements to install script * Remove unused imports * Pass number of jobs and verbosity shake args to build tools * Use custom cabal.project-${ghcVersion} if exists * Add comments with the possible resolvers to shake.yaml --- install/hie-install.cabal | 2 +- install/shake.yaml | 14 ++++++- install/src/Cabal.hs | 75 ++++++++++++++++++++++------------- install/src/Env.hs | 6 +-- install/src/Help.hs | 21 ++++++---- install/src/HieInstall.hs | 83 +++++++++++++++++---------------------- install/src/Print.hs | 12 +++--- install/src/Stack.hs | 79 +++++++++++++++++++++---------------- install/src/Version.hs | 1 - 9 files changed, 163 insertions(+), 130 deletions(-) diff --git a/install/hie-install.cabal b/install/hie-install.cabal index 013d246fe..39e73f636 100644 --- a/install/hie-install.cabal +++ b/install/hie-install.cabal @@ -1,5 +1,5 @@ name: hie-install -version: 0.8.0.0 +version: 0.8.1.0 synopsis: Install the haskell-ide-engine license: BSD3 author: Many, TBD when we release diff --git a/install/shake.yaml b/install/shake.yaml index 8c30114fa..17b5d4abc 100644 --- a/install/shake.yaml +++ b/install/shake.yaml @@ -1,8 +1,20 @@ # Used to provide a different environment for the shake build script -resolver: lts-14.11 # GHC 8.6.5 +resolver: lts-13.19 # last lts with GHC 8.6.5 +# resolver: nightly-2020-01-31 # GHC 8.8.2 +# resolver: nightly-2020-01-21 # last nightly GHC 8.8.1 +# resolver: lts-13.19 # last lts GHC 8.6.4 +# resolver: lts-12.26 # last lts GHC 8.4.4 +# resolver: lts-12.14 # last lts GHC 8.4.3 +# resolver: nightly-2018-05-30 # last nightly for GHC 8.4.2 packages: - . +extra-deps: +- shake-0.18.5 +# for resolvers with ghc < 8.6 +# - shake-0.17 + + nix: packages: [ zlib ] diff --git a/install/src/Cabal.hs b/install/src/Cabal.hs index 72fd00b04..205d75716 100644 --- a/install/src/Cabal.hs +++ b/install/src/Cabal.hs @@ -1,23 +1,14 @@ {-# LANGUAGE CPP #-} - module Cabal where import Development.Shake -import Development.Shake.Command import Development.Shake.FilePath import Control.Monad -import Data.Maybe ( isNothing - , isJust - ) -import Control.Monad.Extra ( whenMaybe ) -import System.Directory ( findExecutable - , copyFile - ) +import System.Directory ( copyFile ) import Version import Print import Env -import Data.Functor.Identity #if RUN_FROM_STACK import Control.Exception ( throwIO ) #else @@ -38,23 +29,23 @@ execCabal = command [] "cabal" execCabal_ :: [String] -> Action () execCabal_ = execCabal -cabalBuildData :: Action () -cabalBuildData = do - execCabal_ ["v2-build", "hoogle"] - execCabal_ ["v2-exec", "hoogle", "generate"] +cabalBuildData :: [String] -> Action () +cabalBuildData args = do + execCabal_ $ ["v2-build", "hoogle"] ++ args + execCabal_ $ ["v2-exec", "hoogle", "generate"] ++ args getGhcPathOfOrThrowError :: VersionNumber -> Action GhcPath -getGhcPathOfOrThrowError versionNumber = +getGhcPathOfOrThrowError versionNumber = getGhcPathOf versionNumber >>= \case Nothing -> do printInStars $ ghcVersionNotFoundFailMsg versionNumber error (ghcVersionNotFoundFailMsg versionNumber) Just p -> return p -cabalInstallHie :: VersionNumber -> Action () -cabalInstallHie versionNumber = do +cabalInstallHie :: VersionNumber -> [String] -> Action () +cabalInstallHie versionNumber args = do localBin <- liftIO $ getInstallDir - cabalVersion <- getCabalVersion + cabalVersion <- getCabalVersion args ghcPath <- getGhcPathOfOrThrowError versionNumber let isCabal3 = checkVersion [3,0,0,0] cabalVersion @@ -62,19 +53,24 @@ cabalInstallHie versionNumber = do | otherwise = "--symlink-bindir" installMethod | isWindowsSystem && isCabal3 = ["--install-method=copy"] | otherwise = [] + + projectFile <- getProjectFile versionNumber + execCabal_ $ [ "v2-install" , "-w", ghcPath , "--write-ghc-environment-files=never" , installDirOpt, localBin , "--max-backjumps=5000" - , "exe:hie" + , "exe:hie", "exe:hie-wrapper" , "--overwrite-policy=always" + , "--project-file=" ++ projectFile ] ++ installMethod + ++ args let minorVerExe = "hie-" ++ versionNumber <.> exe - majorVerExe = "hie-" ++ dropExtension versionNumber <.> exe + majorVerExe = "hie-" ++ dropExtension versionNumber <.> exe liftIO $ do copyFile (localBin "hie" <.> exe) (localBin minorVerExe) @@ -87,20 +83,27 @@ cabalInstallHie versionNumber = do ++ minorVerExe ++ " to " ++ localBin -checkCabal_ :: Action () -checkCabal_ = checkCabal >> return () +getProjectFile :: VersionNumber -> Action FilePath +getProjectFile ver = do + existFile <- doesFileExist $ "cabal.project-" ++ ver + return $ if existFile + then "cabal.project-" ++ ver + else "cabal.project" + +checkCabal_ :: [String] -> Action () +checkCabal_ args = checkCabal args >> return () -- | check `cabal` has the required version -checkCabal :: Action String -checkCabal = do - cabalVersion <- getCabalVersion +checkCabal :: [String] -> Action String +checkCabal args = do + cabalVersion <- getCabalVersion args unless (checkVersion requiredCabalVersion cabalVersion) $ do printInStars $ cabalInstallIsOldFailMsg cabalVersion error $ cabalInstallIsOldFailMsg cabalVersion return cabalVersion -getCabalVersion :: Action String -getCabalVersion = trimmedStdout <$> execCabal ["--numeric-version"] +getCabalVersion :: [String] -> Action String +getCabalVersion args = trimmedStdout <$> (execCabal $ ["--numeric-version"] ++ args) -- | Error message when the `cabal` binary is an older version cabalInstallIsOldFailMsg :: String -> String @@ -119,3 +122,21 @@ requiredCabalVersion | isWindowsSystem = requiredCabalVersionForWindows requiredCabalVersionForWindows :: RequiredVersion requiredCabalVersionForWindows = [3, 0, 0, 0] + +getVerbosityArg :: Verbosity -> String +getVerbosityArg v = "-v" ++ cabalVerbosity + where cabalVerbosity = case v of + Silent -> "0" +#if MIN_VERSION_shake(0,18,4) + Error -> "0" + Warn -> "1" + Info -> "1" + Verbose -> "2" +#else + Quiet -> "0" + Normal -> "1" + Loud -> "2" + Chatty -> "2" +#endif + Diagnostic -> "3" + diff --git a/install/src/Env.hs b/install/src/Env.hs index 83c23b0fc..c53557aa4 100644 --- a/install/src/Env.hs +++ b/install/src/Env.hs @@ -1,15 +1,11 @@ module Env where import Development.Shake -import Development.Shake.Command import Control.Monad.IO.Class import Control.Monad import Development.Shake.FilePath -import System.Info ( os - , arch - ) +import System.Info ( os ) import Data.Maybe ( isJust - , isNothing , mapMaybe ) import System.Directory ( findExecutable diff --git a/install/src/Help.hs b/install/src/Help.hs index a512f2593..547cf39a5 100644 --- a/install/src/Help.hs +++ b/install/src/Help.hs @@ -2,21 +2,18 @@ module Help where import Development.Shake -import Data.List ( intersperse - , intercalate - ) +import Data.List ( intercalate ) import Env import Print import Version import BuildSystem -import Cabal stackCommand :: TargetDescription -> String -stackCommand target = "stack install.hs " ++ fst target +stackCommand target = "stack install.hs " ++ fst target ++ " [options]" cabalCommand :: TargetDescription -> String -cabalCommand target = "cabal v2-run install.hs --project-file install/shake.project " ++ fst target +cabalCommand target = "cabal v2-run install.hs --project-file install/shake.project -- " ++ fst target ++ " [options]" buildCommand :: TargetDescription -> String buildCommand | isRunFromCabal = cabalCommand @@ -37,7 +34,7 @@ shortHelpMessage = do printUsage printLine "" printLine "Targets:" - mapM_ (printLineIndented . showTarget (spaces hieVersions)) (targets hieVersions) + mapM_ (printLineIndented . showHelpItem (spaces hieVersions)) (targets hieVersions) printLine "" where spaces hieVersions = space (targets hieVersions) @@ -68,7 +65,10 @@ helpMessage versions@BuildableVersions {..} = do printUsage printLine "" printLine "Targets:" - mapM_ (printLineIndented . showTarget spaces) targets + mapM_ (printLineIndented . showHelpItem spaces) targets + printLine "" + printLine "Options:" + mapM_ (printLineIndented . showHelpItem spaces) options printLine "" where spaces = space targets @@ -81,6 +81,11 @@ helpMessage versions@BuildableVersions {..} = do , if isRunFromCabal then [cabalGhcsTarget] else [stackDevTarget] , [macosIcuTarget] ] + options = [ ("-j[N], --jobs[=N]", "Allow N jobs/threads at once [default number of CPUs].") + , ("-s, --silent", "Don't print anything.") + , ("-q, --quiet", "Print less (pass repeatedly for even less).") + , ("-V, --verbose", "Print more (pass repeatedly for even more).") + ] -- All targets with their respective help message. generalTargets = [helpTarget] diff --git a/install/src/HieInstall.hs b/install/src/HieInstall.hs index d46e2bffe..b2afbde1b 100644 --- a/install/src/HieInstall.hs +++ b/install/src/HieInstall.hs @@ -1,43 +1,13 @@ module HieInstall where import Development.Shake -import Development.Shake.Command -import Development.Shake.FilePath import Control.Monad -import Control.Monad.IO.Class -import Control.Monad.Extra ( unlessM - , mapMaybeM - ) -import Data.Maybe ( isJust ) -import System.Directory ( listDirectory ) import System.Environment ( unsetEnv ) -import System.Info ( os - , arch - ) - -import Data.Maybe ( isNothing - , mapMaybe - ) -import Data.List ( dropWhileEnd - , intersperse - , intercalate - , sort - , sortOn - ) -import qualified Data.Text as T -import Data.Char ( isSpace ) -import Data.Version ( parseVersion - , makeVersion - , showVersion - ) -import Data.Function ( (&) ) -import Text.ParserCombinators.ReadP ( readP_to_S ) import BuildSystem import Stack import Cabal import Version -import Print import Env import Help @@ -53,37 +23,53 @@ defaultMain = do -- used for stack-based targets stackVersions <- getHieVersions - let versions = if isRunFromStack then stackVersions else cabalVersions + let versions = if isRunFromStack then stackVersions else cabalVersions let toolsVersions = BuildableVersions stackVersions cabalVersions let latestVersion = last versions - shakeArgs shakeOptions { shakeFiles = "_build" } $ do + shakeArgs shakeOptions { shakeFiles = "_build", shakeThreads = 0 } $ do + + shakeOptionsRules <- getShakeOptionsRules + + let jobsArg = "-j" ++ show (shakeThreads shakeOptionsRules) + + let verbosityArg = if isRunFromStack then Stack.getVerbosityArg else Cabal.getVerbosityArg + + let args = [jobsArg, verbosityArg (shakeVerbosity shakeOptionsRules)] + + phony "show-options" $ do + putNormal $ "Options:" + putNormal $ " Number of jobs: " ++ show (shakeThreads shakeOptionsRules) + putNormal $ " Verbosity level: " ++ show (shakeVerbosity shakeOptionsRules) + want ["short-help"] -- general purpose targets phony "submodules" updateSubmodules phony "short-help" shortHelpMessage phony "help" (helpMessage toolsVersions) - - phony "check" (if isRunFromStack then checkStack else checkCabal_) + + phony "check" (if isRunFromStack then checkStack args else checkCabal_ args) phony "data" $ do + need ["show-options"] need ["submodules"] need ["check"] - if isRunFromStack then stackBuildData else cabalBuildData + if isRunFromStack then stackBuildData args else cabalBuildData args forM_ versions (\version -> phony ("hie-" ++ version) $ do + need ["show-options"] need ["submodules"] need ["check"] if isRunFromStack then - stackInstallHieWithErrMsg (Just version) + stackInstallHieWithErrMsg (Just version) args else - cabalInstallHie version + cabalInstallHie version args ) - + unless (null versions) $ do phony "latest" (need ["hie-" ++ latestVersion]) phony "hie" (need ["data", "latest"]) @@ -92,7 +78,9 @@ defaultMain = do -- Default `stack.yaml` uses ghc-8.8.2 and we can't build hie in windows -- TODO: Enable for windows when it uses ghc-8.8.3 when (isRunFromStack && not isWindowsSystem) $ - phony "dev" $ stackInstallHieWithErrMsg Nothing + phony "dev" $ do + need ["show-options"] + stackInstallHieWithErrMsg Nothing args -- cabal specific targets when isRunFromCabal $ do @@ -101,20 +89,23 @@ defaultMain = do phony "ghcs" $ showInstalledGhcs ghcPaths -- macos specific targets - phony "icu-macos-fix" - (need ["icu-macos-fix-install"] >> need ["icu-macos-fix-build"]) + phony "icu-macos-fix" $ do + need ["show-options"] + need ["icu-macos-fix-install"] + need ["icu-macos-fix-build"] + phony "icu-macos-fix-install" (command_ [] "brew" ["install", "icu4c"]) - phony "icu-macos-fix-build" $ mapM_ buildIcuMacosFix versions + phony "icu-macos-fix-build" $ mapM_ (flip buildIcuMacosFix $ args) versions -buildIcuMacosFix :: VersionNumber -> Action () -buildIcuMacosFix version = execStackWithGhc_ - version +buildIcuMacosFix :: VersionNumber -> [String] -> Action () +buildIcuMacosFix version args = execStackWithGhc_ + version $ [ "build" , "text-icu" , "--extra-lib-dirs=/usr/local/opt/icu4c/lib" , "--extra-include-dirs=/usr/local/opt/icu4c/include" - ] + ] ++ args -- | update the submodules that the project is in the state as required by the `stack.yaml` files updateSubmodules :: Action () diff --git a/install/src/Print.hs b/install/src/Print.hs index 41216022b..063525e7e 100644 --- a/install/src/Print.hs +++ b/install/src/Print.hs @@ -1,10 +1,8 @@ module Print where import Development.Shake -import Development.Shake.Command import Control.Monad.IO.Class import Data.List ( dropWhileEnd - , dropWhile ) import Data.Char ( isSpace ) @@ -37,11 +35,11 @@ type TargetDescription = (String, String) -- | Number of spaces the target name including whitespace should have. -- At least twenty, maybe more if target names are long. At most the length of the longest target plus five. -space :: [TargetDescription] -> Int -space phonyTargets = maximum (20 : map ((+ 5) . length . fst) phonyTargets) +space :: [(String,String)] -> Int +space helpItems = maximum (20 : map ((+ 5) . length . fst) helpItems) -- | Show a target. -- Concatenates the target with its help message and inserts whitespace between them. -showTarget :: Int -> TargetDescription -> String -showTarget spaces (target, msg) = - target ++ replicate (spaces - length target) ' ' ++ msg +showHelpItem :: Int -> (String,String) -> String +showHelpItem spaces (helpItemKey, msg) = + helpItemKey ++ replicate (spaces - length helpItemKey) ' ' ++ msg diff --git a/install/src/Stack.hs b/install/src/Stack.hs index ec8aabcd0..3049ec9cb 100644 --- a/install/src/Stack.hs +++ b/install/src/Stack.hs @@ -1,38 +1,32 @@ +{-# LANGUAGE CPP #-} module Stack where import Development.Shake -import Development.Shake.Command import Development.Shake.FilePath -import Control.Exception import Control.Monad -import Data.List import System.Directory ( copyFile ) -import System.FilePath ( splitSearchPath, searchPathSeparator, () ) -import System.Environment ( lookupEnv, setEnv, getEnvironment ) -import System.IO.Error ( isDoesNotExistError ) -import BuildSystem +-- import System.FilePath ( () ) import Version import Print -import Env -stackInstallHieWithErrMsg :: Maybe VersionNumber -> Action () -stackInstallHieWithErrMsg mbVersionNumber = - stackInstallHie mbVersionNumber +stackInstallHieWithErrMsg :: Maybe VersionNumber -> [String] -> Action () +stackInstallHieWithErrMsg mbVersionNumber args = + stackInstallHie mbVersionNumber args `actionOnException` liftIO (putStrLn stackBuildFailMsg) -- | copy the built binaries into the localBinDir -stackInstallHie :: Maybe VersionNumber -> Action () -stackInstallHie mbVersionNumber = do - versionNumber <- +stackInstallHie :: Maybe VersionNumber -> [String] -> Action () +stackInstallHie mbVersionNumber args = do + versionNumber <- case mbVersionNumber of Nothing -> do - execStackWithCfgFile_ "stack.yaml" ["install"] - getGhcVersionOfCfgFile "stack.yaml" + execStackWithCfgFile_ "stack.yaml" $ ["install"] ++ args + getGhcVersionOfCfgFile "stack.yaml" args Just vn -> do - execStackWithGhc_ vn ["install"] + execStackWithGhc_ vn $ ["install"] ++ args return vn - - localBinDir <- getLocalBin + + localBinDir <- getLocalBin args let hie = "hie" <.> exe liftIO $ do copyFile (localBinDir hie) @@ -40,31 +34,31 @@ stackInstallHie mbVersionNumber = do copyFile (localBinDir hie) (localBinDir "hie-" ++ dropExtension versionNumber <.> exe) -getGhcVersionOfCfgFile :: String -> Action VersionNumber -getGhcVersionOfCfgFile stackFile = do - Stdout ghcVersion <- - execStackWithCfgFile stackFile ["exec", "ghc", "--", "--numeric-version"] +getGhcVersionOfCfgFile :: String -> [String] -> Action VersionNumber +getGhcVersionOfCfgFile stackFile args = do + Stdout ghcVersion <- + execStackWithCfgFile stackFile $ ["exec", "ghc"] ++ args ++ ["--", "--numeric-version"] return $ trim ghcVersion -- | check `stack` has the required version -checkStack :: Action () -checkStack = do - stackVersion <- trimmedStdout <$> execStackShake ["--numeric-version"] +checkStack :: [String] -> Action () +checkStack args = do + stackVersion <- trimmedStdout <$> (execStackShake $ ["--numeric-version"] ++ args) unless (checkVersion requiredStackVersion stackVersion) $ do printInStars $ stackExeIsOldFailMsg stackVersion error $ stackExeIsOldFailMsg stackVersion -- | Get the local binary path of stack. -- Equal to the command `stack path --local-bin` -getLocalBin :: Action FilePath -getLocalBin = do - Stdout stackLocalDir' <- execStackShake ["path", "--local-bin"] +getLocalBin :: [String] -> Action FilePath +getLocalBin args = do + Stdout stackLocalDir' <- execStackShake $ ["path", "--local-bin"] ++ args return $ trim stackLocalDir' -stackBuildData :: Action () -stackBuildData = do - execStackShake_ ["build", "hoogle"] - execStackShake_ ["exec", "hoogle", "generate"] +stackBuildData :: [String] -> Action () +stackBuildData args = do + execStackShake_ $ ["build", "hoogle"] ++ args + execStackShake_ $ ["exec", "hoogle", "generate"] ++ args -- | Execute a stack command for a specified ghc, discarding the output execStackWithGhc_ :: VersionNumber -> [String] -> Action () @@ -82,7 +76,7 @@ execStackWithCfgFile_ = execStackWithCfgFile -- | Execute a stack command for a specified stack.yaml file execStackWithCfgFile :: CmdResult r => String -> [String] -> Action r -execStackWithCfgFile stackFile args = +execStackWithCfgFile stackFile args = command [] "stack" (("--stack-yaml=" ++ stackFile) : args) -- | Execute a stack command with the same resolver as the build script @@ -118,3 +112,20 @@ stackBuildFailMsg = ++ "If this does not work, open an issue at \n" ++ "\thttps://github.com/haskell/haskell-ide-engine" +getVerbosityArg :: Verbosity -> String +getVerbosityArg v = "--verbosity=" ++ stackVerbosity + where stackVerbosity = case v of + Silent -> "silent" +#if MIN_VERSION_shake(0,18,4) + Error -> "error" + Warn -> "warn" + Info -> "info" + Verbose -> "info" +#else + Quiet -> "error" + Normal -> "warn" + Loud -> "info" + Chatty -> "info" +#endif + + Diagnostic -> "debug" \ No newline at end of file diff --git a/install/src/Version.hs b/install/src/Version.hs index 0d89b4b95..464700414 100644 --- a/install/src/Version.hs +++ b/install/src/Version.hs @@ -6,7 +6,6 @@ import Data.Version ( Version , showVersion ) import Text.ParserCombinators.ReadP ( readP_to_S ) -import Control.Monad.IO.Class type VersionNumber = String From b7f93eed53315593d6fccf009be298cddfc07eea Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:22:05 +0100 Subject: [PATCH 11/17] Add specific cabal.project for ghc-8.8.2 --- cabal.project-8.8.2 | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 cabal.project-8.8.2 diff --git a/cabal.project-8.8.2 b/cabal.project-8.8.2 new file mode 100644 index 000000000..e38f8b79e --- /dev/null +++ b/cabal.project-8.8.2 @@ -0,0 +1,32 @@ +packages: + ./ + ./hie-plugin-api/ + + -- ./submodules/HaRe + +-- To avoid build error with ghc-8.8.2 +-- See https://github.com/haskell/haddock/issues/1123 +source-repository-package + type: git + location: https://github.com/haskell/haddock.git + subdir: haddock-api + tag: be8b02c4e3cffe7d45b3dad0a0f071d35a274d65 + +source-repository-package + type: git + location: https://github.com/jneira/cabal-helper.git + tag: ffb1f57a5ffc6b7ac3c46a9974c4420a6d2bb9b2 + +tests: true + +package haskell-ide-engine + test-show-details: direct + +-- Match the flag settings we use in stac builds +constraints: + haskell-ide-engine +pedantic + hie-plugin-api +pedantic + +write-ghc-environment-files: never + +index-state: 2020-02-05T07:49:28Z From a66c6e750af7b792ea11c6768f54134af9b65f15 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:22:56 +0100 Subject: [PATCH 12/17] Explain why we are using a custom haddock-api --- stack-8.8.2.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/stack-8.8.2.yaml b/stack-8.8.2.yaml index da9ba0672..fd4ed7b89 100644 --- a/stack-8.8.2.yaml +++ b/stack-8.8.2.yaml @@ -16,6 +16,8 @@ extra-deps: - constrained-dynamic-0.1.0.0 - floskell-0.10.2 - ghc-lib-parser-ex-8.8.4.0 +# To avoid build error with ghc-8.8.2 +# See https://github.com/haskell/haddock/issues/1123 - git: https://github.com/haskell/haddock.git commit: be8b02c4e3cffe7d45b3dad0a0f071d35a274d65 subdirs: From 1a4dd8fc756f468785fa73a62cef090c0463bb93 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:25:24 +0100 Subject: [PATCH 13/17] Use custom cabal.project-${ghcVersion} if exists --- .azure/linux-cabal.bashrc | 6 ++++++ .azure/linux-cabal.yml | 18 +++++++++--------- .azure/macos-cabal.bashrc | 6 ++++++ .azure/windows-cabal.bashrc | 6 ++++++ .azure/windows-cabal.yml | 25 +++++++++++++------------ 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/.azure/linux-cabal.bashrc b/.azure/linux-cabal.bashrc index 864dfa2ae..6e087c538 100644 --- a/.azure/linux-cabal.bashrc +++ b/.azure/linux-cabal.bashrc @@ -1 +1,7 @@ +if [ -z "$PROJECT_FILE" ]; then + export PROJECT_FILE="cabal.project" + if [ -f "cabal.project-$GHC_VERSION" ]; then + export PROJECT_FILE="cabal.project-$GHC_VERSION" + fi +fi export PATH=$HOME/.cabal/bin:/opt/cabal/$CABAL_VERSION/bin:/opt/ghc/$GHC_VERSION/bin:$HOME/.local/bin:$PATH diff --git a/.azure/linux-cabal.yml b/.azure/linux-cabal.yml index 3f5e8081b..c63d29fb2 100644 --- a/.azure/linux-cabal.yml +++ b/.azure/linux-cabal.yml @@ -45,19 +45,19 @@ jobs: displayName: Update cabal - bash: | source .azure/linux-cabal.bashrc - cabal v2-build --disable-tests --disable-benchmarks --only-dependencies + cabal v2-build --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE displayName: Build dependencies - bash: | source .azure/linux-cabal.bashrc - cabal v2-build --disable-tests --disable-benchmarks + cabal v2-build --disable-tests --disable-benchmarks --project-file $PROJECT_FILE displayName: Build `hie` - bash: | source .azure/linux-cabal.bashrc - cabal v2-install # `hie` binary required locally for tests + cabal v2-install --project-file $PROJECT_FILE # `hie` binary required locally for tests displayName: Install `hie` - bash: | source .azure/linux-cabal.bashrc - cabal v2-build --enable-tests --enable-benchmarks --only-dependencies + cabal v2-build --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE displayName: Build Test-dependencies - bash: | sudo apt update @@ -70,20 +70,20 @@ jobs: displayName: "Install Runtime Test-Dependencies: liquidhaskell" - bash: | source .azure/linux-cabal.bashrc - cabal v2-build hoogle - cabal v2-exec hoogle generate + cabal v2-build hoogle --project-file $PROJECT_FILE + cabal v2-exec hoogle generate --project-file $PROJECT_FILE displayName: "Install Runtime Test-Dependencies: hoogle database" - bash: | source .azure/linux-cabal.bashrc - cabal v2-test :unit-test + cabal v2-test :unit-test --project-file $PROJECT_FILE displayName: "Run Test: unit-test" - bash: | source .azure/linux-cabal.bashrc - cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test + cabal v2-test :dispatcher-test :plugin-dispatcher-test :wrapper-test --project-file $PROJECT_FILE displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test" - bash: | source .azure/linux-cabal.bashrc - cabal v2-test :func-test + cabal v2-test :func-test --project-file $PROJECT_FILE displayName: "Run Test: func-test" - bash: | mkdir -p .azure-cache diff --git a/.azure/macos-cabal.bashrc b/.azure/macos-cabal.bashrc index 90489c404..44deaa783 100644 --- a/.azure/macos-cabal.bashrc +++ b/.azure/macos-cabal.bashrc @@ -1,2 +1,8 @@ +if [ -z "$PROJECT_FILE" ]; then + export PROJECT_FILE="cabal.project" + if [ -f "cabal.project-$GHC_VERSION" ]; then + export PROJECT_FILE="cabal.project-$GHC_VERSION" + fi +fi export CABAL_ROOT=$HOME/.cabal export PATH=$CABAL_ROOT/bin:$PATH diff --git a/.azure/windows-cabal.bashrc b/.azure/windows-cabal.bashrc index de43edfc8..4530c4f40 100644 --- a/.azure/windows-cabal.bashrc +++ b/.azure/windows-cabal.bashrc @@ -1,3 +1,9 @@ +if [ -z "$PROJECT_FILE" ]; then + export PROJECT_FILE="cabal.project" + if [ -f "cabal.project-$GHC_VERSION" ]; then + export PROJECT_FILE="cabal.project-$GHC_VERSION" + fi +fi if [ -z "$CABAL_DIR" ]; then CABAL_DIR="$APPDATA\\cabal" fi diff --git a/.azure/windows-cabal.yml b/.azure/windows-cabal.yml index ee3e185de..bf4e9b9ab 100644 --- a/.azure/windows-cabal.yml +++ b/.azure/windows-cabal.yml @@ -5,7 +5,8 @@ jobs: vmImage: windows-2019 strategy: matrix: - # It still is not in chocolatey + # ghc versions 8.8.1 and 8.8.2 are not usable in windows + # due to https://gitlab.haskell.org/ghc/ghc/issues/17575 # ghc-8.8.2: # GHC_VERSION: "8.8.2" ghc-8.6.5: @@ -51,28 +52,28 @@ jobs: displayName: Install cabal - bash: | source .azure/windows-cabal.bashrc - cabal v2-update + cabal v2-update --project-file $PROJECT_FILE echo "store-dir: $CABAL_STORE_DIR" >> $CABAL_ROOT/config echo "overwrite-policy: always" >> $CABAL_ROOT/config displayName: Update cabal - bash: | source .azure/windows-cabal.bashrc - cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies + cabal v2-build all --disable-tests --disable-benchmarks --only-dependencies --project-file $PROJECT_FILE displayName: Build dependencies - bash: | source .azure/windows-cabal.bashrc - cabal v2-build all --disable-tests --disable-benchmarks + cabal v2-build all --disable-tests --disable-benchmarks --project-file $PROJECT_FILE displayName: Build `hie` - bash: | source .azure/windows-cabal.bashrc # `hie` binary required locally for tests # we have to use a separate store for install and builds # to workaround https://github.com/haskell/cabal/issues/6483 - cabal --store-dir ${CABAL_STORE_DIR}i v2-install + cabal --store-dir ${CABAL_STORE_DIR}i v2-install --project-file $PROJECT_FILE displayName: Install `hie` - bash: | source .azure/windows-cabal.bashrc - cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies + cabal v2-build all --enable-tests --enable-benchmarks --only-dependencies --project-file $PROJECT_FILE displayName: Build Test-dependencies - bash: | mkdir -p /usr/local @@ -88,19 +89,19 @@ jobs: displayName: "Install Runtime Test-Dependencies: liquidhaskell" - bash: | source .azure/windows-cabal.bashrc - cabal v2-build hoogle - cabal v2-exec hoogle generate + cabal v2-build hoogle --project-file $PROJECT_FILE + cabal v2-exec hoogle generate --project-file $PROJECT_FILE displayName: "Install Runtime Test-Dependencies: hoogle database" - bash: | curl -sSkL http://www.stackage.org/stack/windows-x86_64 -o /usr/bin/stack.zip unzip -o /usr/bin/stack.zip -d /usr/bin/ mkdir -p "$STACK_ROOT" - # If we don't install the ghc used in test projects in advance, tests fail + # If we don't install the ghc used in test projects in advance, tests fail stack setup --stack-yaml stack-${GHC_VERSION}.yaml displayName: "Install Runtime Unit Test-Dependencies: stack" - bash: | source .azure/windows-cabal.bashrc - cabal v2-test :unit-test + cabal v2-test :unit-test --project-file $PROJECT_FILE displayName: "Run Test: unit-test" - bash: | source .azure/windows-cabal.bashrc @@ -108,11 +109,11 @@ jobs: stack setup --stack-yaml stack-8.8.1.yaml stack setup --stack-yaml stack-8.6.5.yaml # TODO Enable :dispatcher-test suite - cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test + cabal v2-test :plugin-dispatcher-test :wrapper-test # :dispatcher-test --project-file $PROJECT_FILE displayName: "Run Test: dispatcher-test, plugin-dispatcher-test and wrapper-test" - bash: | source .azure/windows-cabal.bashrc - cabal v2-test :func-test + cabal v2-test :func-test --project-file $PROJECT_FILE displayName: "Run Test: func-test" - bash: | source .azure/windows-cabal.bashrc From d84147eecaac62e09541b4924e348ddede3143b5 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:26:21 +0100 Subject: [PATCH 14/17] Enable all jobs --- azure-pipelines.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 33b7989de..0ed02f2c3 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -32,13 +32,13 @@ pr: - '*.md' jobs: -# - template: ./.azure/linux-stack.yml -# - template: ./.azure/linux-cabal.yml -# - template: ./.azure/windows-stack.yml -# - template: ./.azure/windows-cabal.yml +- template: ./.azure/linux-stack.yml +- template: ./.azure/linux-cabal.yml +- template: ./.azure/windows-stack.yml +- template: ./.azure/windows-cabal.yml - template: ./.azure/macos-stack.yml -# - template: ./.azure/linux-installhs-stack.yml -# - template: ./.azure/windows-installhs-stack.yml -#- template: ./.azure/windows-installhs-cabal.yml +- template: ./.azure/linux-installhs-stack.yml +- template: ./.azure/windows-installhs-stack.yml +- template: ./.azure/windows-installhs-cabal.yml - template: ./.azure/macos-installhs-cabal.yml - template: ./.azure/macos-installhs-stack.yml From 5882356d9a4f0afff3df37ab648956fa618005d6 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 12:36:11 +0100 Subject: [PATCH 15/17] Use project file in cabal update --- .azure/linux-cabal.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.azure/linux-cabal.yml b/.azure/linux-cabal.yml index c63d29fb2..362c8585f 100644 --- a/.azure/linux-cabal.yml +++ b/.azure/linux-cabal.yml @@ -40,7 +40,7 @@ jobs: displayName: Install ghc - bash: | source .azure/linux-cabal.bashrc - cabal v2-update + cabal v2-update --project-file $PROJECT_FILE echo "overwrite-policy: always" >> $HOME/.cabal/config displayName: Update cabal - bash: | From d773cfdab85d1b137c0ffa57edd49b5ee886d406 Mon Sep 17 00:00:00 2001 From: jneira Date: Mon, 24 Feb 2020 14:21:55 +0100 Subject: [PATCH 16/17] Add missing import if built with cabal --- install/src/Cabal.hs | 1 + 1 file changed, 1 insertion(+) diff --git a/install/src/Cabal.hs b/install/src/Cabal.hs index 205d75716..8429b59d9 100644 --- a/install/src/Cabal.hs +++ b/install/src/Cabal.hs @@ -13,6 +13,7 @@ import Env import Control.Exception ( throwIO ) #else import Cabal.Config +import Data.Functor.Identity #endif getInstallDir :: IO FilePath From 7e45d349632fa1874a5c8bd07b35937968e6f63f Mon Sep 17 00:00:00 2001 From: jneira Date: Wed, 26 Feb 2020 19:50:10 +0100 Subject: [PATCH 17/17] Not share jobs arg between shake and build --- install/src/HieInstall.hs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/install/src/HieInstall.hs b/install/src/HieInstall.hs index b2afbde1b..c98cb157d 100644 --- a/install/src/HieInstall.hs +++ b/install/src/HieInstall.hs @@ -29,19 +29,16 @@ defaultMain = do let latestVersion = last versions - shakeArgs shakeOptions { shakeFiles = "_build", shakeThreads = 0 } $ do + shakeArgs shakeOptions { shakeFiles = "_build" } $ do shakeOptionsRules <- getShakeOptionsRules - let jobsArg = "-j" ++ show (shakeThreads shakeOptionsRules) - let verbosityArg = if isRunFromStack then Stack.getVerbosityArg else Cabal.getVerbosityArg - let args = [jobsArg, verbosityArg (shakeVerbosity shakeOptionsRules)] + let args = [verbosityArg (shakeVerbosity shakeOptionsRules)] phony "show-options" $ do putNormal $ "Options:" - putNormal $ " Number of jobs: " ++ show (shakeThreads shakeOptionsRules) putNormal $ " Verbosity level: " ++ show (shakeVerbosity shakeOptionsRules) want ["short-help"]