on master help sign in
Refactoring: remove isTesting from ShakeExtras (#469)
0bf4e91Pepe Iborra
exe/Main.hs+1−1
@@ -95,7 +95,7 @@ main = do
95 let options = (defaultIdeOptions $ loadSession dir)
95 let options = (defaultIdeOptions $ loadSession dir)
96 { optReportProgress = clientSupportsProgress caps
96 { optReportProgress = clientSupportsProgress caps
97 , optShakeProfiling = argsShakeProfiling
97 , optShakeProfiling = argsShakeProfiling
98− , optTesting = IdeTesting argsTesting
98+ , optTesting = argsTesting
99 }
99 }
100 debouncer <- newAsyncDebouncer
100 debouncer <- newAsyncDebouncer
101 initialise caps (cradleRules >> mainRule >> pluginRules plugins >> action kick)
101 initialise caps (cradleRules >> mainRule >> pluginRules plugins >> action kick)
exe/Rules.hs+5−3
@@ -16,9 +16,11 @@ import Data.Functor ((<&>))
16import Data.Maybe (fromMaybe)
16import Data.Maybe (fromMaybe)
17import Data.Text (Text)
17import Data.Text (Text)
18import Development.IDE.Core.Rules (defineNoFile)
18import Development.IDE.Core.Rules (defineNoFile)
19−import Development.IDE.Core.Shake (ShakeExtras(ShakeExtras,isTesting), getShakeExtras, sendEvent, define, useNoFile_)
19+import Development.IDE.Core.Service (getIdeOptions)
20+import Development.IDE.Core.Shake (sendEvent, define, useNoFile_)
20import Development.IDE.GHC.Util
21import Development.IDE.GHC.Util
21import Development.IDE.Types.Location (fromNormalizedFilePath)
22import Development.IDE.Types.Location (fromNormalizedFilePath)
23+import Development.IDE.Types.Options (IdeOptions(IdeOptions, optTesting))
22import Development.Shake
24import Development.Shake
23import DynFlags (gopt_set, gopt_unset,
25import DynFlags (gopt_set, gopt_unset,
24 updOptLevel)
26 updOptLevel)
@@ -60,13 +62,13 @@ cradleToSession :: Rules ()
60cradleToSession = define $ \LoadCradle nfp -> do
62cradleToSession = define $ \LoadCradle nfp -> do
61 let f = fromNormalizedFilePath nfp
63 let f = fromNormalizedFilePath nfp
62
64
63− ShakeExtras{isTesting} <- getShakeExtras
65+ IdeOptions{optTesting} <- getIdeOptions
64
66
65 -- If the path points to a directory, load the implicit cradle
67 -- If the path points to a directory, load the implicit cradle
66 mbYaml <- doesDirectoryExist f <&> \isDir -> if isDir then Nothing else Just f
68 mbYaml <- doesDirectoryExist f <&> \isDir -> if isDir then Nothing else Just f
67 cradle <- liftIO $ maybe (loadImplicitCradle $ addTrailingPathSeparator f) loadCradle mbYaml
69 cradle <- liftIO $ maybe (loadImplicitCradle $ addTrailingPathSeparator f) loadCradle mbYaml
68
70
69− when isTesting $
71+ when optTesting $
70 sendEvent $ notifyCradleLoaded f
72 sendEvent $ notifyCradleLoaded f
71
73
72 cmpOpts <- liftIO $ getComponentOptions cradle
74 cmpOpts <- liftIO $ getComponentOptions cradle
src/Development/IDE/Core/Service.hs−1
@@ -61,7 +61,6 @@ initialise caps mainRule getLspId toDiags logger debouncer options vfs =
61 logger
61 logger
62 debouncer
62 debouncer
63 (optShakeProfiling options)
63 (optShakeProfiling options)
64− (optTesting options)
65 (optReportProgress options)
64 (optReportProgress options)
66 shakeOptions
65 shakeOptions
67 { shakeThreads = optThreads options
66 { shakeThreads = optThreads options
src/Development/IDE/Core/Shake.hs+1−4
@@ -102,8 +102,6 @@ data ShakeExtras = ShakeExtras
102 -- positions in a version of that document to positions in the latest version
102 -- positions in a version of that document to positions in the latest version
103 ,inProgress :: Var (HMap.HashMap NormalizedFilePath Int)
103 ,inProgress :: Var (HMap.HashMap NormalizedFilePath Int)
104 -- ^ How many rules are running for each file
104 -- ^ How many rules are running for each file
105− ,isTesting :: Bool
106− -- ^ enable additional messages used by the test suite to check invariants
107 }
105 }
108
106
109getShakeExtras :: Action ShakeExtras
107getShakeExtras :: Action ShakeExtras
@@ -299,12 +297,11 @@ shakeOpen :: IO LSP.LspId
299 -> Logger
297 -> Logger
300 -> Debouncer NormalizedUri
298 -> Debouncer NormalizedUri
301 -> Maybe FilePath
299 -> Maybe FilePath
302− -> IdeTesting
303 -> IdeReportProgress
300 -> IdeReportProgress
304 -> ShakeOptions
301 -> ShakeOptions
305 -> Rules ()
302 -> Rules ()
306 -> IO IdeState
303 -> IO IdeState
307−shakeOpen getLspId eventer logger debouncer shakeProfileDir (IdeTesting isTesting) (IdeReportProgress reportProgress) opts rules = do
304+shakeOpen getLspId eventer logger debouncer shakeProfileDir (IdeReportProgress reportProgress) opts rules = do
308 inProgress <- newVar HMap.empty
305 inProgress <- newVar HMap.empty
309 shakeExtras <- do
306 shakeExtras <- do
310 globals <- newVar HMap.empty
307 globals <- newVar HMap.empty
src/Development/IDE/Types/Options.hs+2−4
@@ -9,7 +9,6 @@ module Development.IDE.Types.Options
9 , IdePreprocessedSource(..)
9 , IdePreprocessedSource(..)
10 , IdeReportProgress(..)
10 , IdeReportProgress(..)
11 , IdeDefer(..)
11 , IdeDefer(..)
12− , IdeTesting(..)
13 , clientSupportsProgress
12 , clientSupportsProgress
14 , IdePkgLocationOptions(..)
13 , IdePkgLocationOptions(..)
15 , defaultIdeOptions
14 , defaultIdeOptions
@@ -41,7 +40,7 @@ data IdeOptions = IdeOptions
41 -- meaning we keep everything in memory but the daml CLI compiler uses this for incremental builds.
40 -- meaning we keep everything in memory but the daml CLI compiler uses this for incremental builds.
42 , optShakeProfiling :: Maybe FilePath
41 , optShakeProfiling :: Maybe FilePath
43 -- ^ Set to 'Just' to create a directory of profiling reports.
42 -- ^ Set to 'Just' to create a directory of profiling reports.
44− , optTesting :: IdeTesting
43+ , optTesting :: Bool
45 -- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
44 -- ^ Whether to enable additional lsp messages used by the test suite for checking invariants
46 , optReportProgress :: IdeReportProgress
45 , optReportProgress :: IdeReportProgress
47 -- ^ Whether to report progress during long operations.
46 -- ^ Whether to report progress during long operations.
@@ -68,7 +67,6 @@ data IdePreprocessedSource = IdePreprocessedSource
68
67
69newtype IdeReportProgress = IdeReportProgress Bool
68newtype IdeReportProgress = IdeReportProgress Bool
70newtype IdeDefer = IdeDefer Bool
69newtype IdeDefer = IdeDefer Bool
71−newtype IdeTesting = IdeTesting Bool
72
70
73clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
71clientSupportsProgress :: LSP.ClientCapabilities -> IdeReportProgress
74clientSupportsProgress caps = IdeReportProgress $ Just True ==
72clientSupportsProgress caps = IdeReportProgress $ Just True ==
@@ -87,7 +85,7 @@ defaultIdeOptions session = IdeOptions
87 ,optLanguageSyntax = "haskell"
85 ,optLanguageSyntax = "haskell"
88 ,optNewColonConvention = False
86 ,optNewColonConvention = False
89 ,optDefer = IdeDefer True
87 ,optDefer = IdeDefer True
90− ,optTesting = IdeTesting False
88+ ,optTesting = False
91 }
89 }
92
90
93
91