[commit: ghc] wip/nfs-locking: Error when a non-optional builder is not specified. (8ba5cff)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:24:11 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/8ba5cfffa37a1992567104a90566d506b4d83f56/ghc

>---------------------------------------------------------------

commit 8ba5cfffa37a1992567104a90566d506b4d83f56
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Mar 4 01:43:30 2016 +0000

    Error when a non-optional builder is not specified.
    
    See #211.


>---------------------------------------------------------------

8ba5cfffa37a1992567104a90566d506b4d83f56
 src/Builder.hs | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/src/Builder.hs b/src/Builder.hs
index 75d3d4e..eee24cb 100644
--- a/src/Builder.hs
+++ b/src/Builder.hs
@@ -86,6 +86,11 @@ isStaged = \case
     (GhcPkg _) -> True
     _          -> False
 
+isOptional :: Builder -> Bool
+isOptional = \case
+    HsColour -> True
+    _        -> False
+
 -- TODO: get rid of fromJust
 -- | Determine the location of a 'Builder'
 builderPath :: Builder -> Action FilePath
@@ -116,9 +121,13 @@ builderPath builder = case builderProvenance builder of
                 _ -> error $ "Cannot determine builderKey for " ++ show builder
         path <- askConfigWithDefault builderKey . putError $
             "\nCannot find path to '" ++ builderKey
-            ++ "' in configuration files. Have you forgot to run configure?"
-        if path == "" -- TODO: get rid of "" paths
-        then return ""
+            ++ "' in system.config file. Have you forgot to run configure?"
+        if null path
+        then do
+            if isOptional builder
+            then return ""
+            else putError $ "Builder '" ++ builderKey ++ "' is not specified in"
+                ++ " system.config file. Cannot proceed without it."
         else do
             path' <- lookupInPath path
             fixAbsolutePathOnWindows $ path' -<.> exe



More information about the ghc-commits mailing list