Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

clean cabal when package-id is gone

  • Loading branch information...
commit 78ad0c1269b15a8dcfb6297ced5a34e604cc1a39 1 parent 57b88a5
@JPMoresmau authored
View
1  lib/Scion/Cabal.hs
@@ -108,6 +108,7 @@ instance IsComponent CabalComponent where
componentInit = cabalComponentInit
componentTargets = cabalTargets
componentOptions = cabalDynFlags
+ componentClean = cabalClean . cabalFile
scionDistDir :: FilePath
scionDistDir = ".dist-scion"
View
4 lib/Scion/Types.hs
@@ -384,8 +384,10 @@ class (Show c, Eq c, JSON c) => IsComponent c where
componentInit :: c -> ScionM (Maybe String) --error msg
componentTargets :: c -> ScionM [Target]
componentOptions :: c -> ScionM [String]
-
+ componentClean :: c -> ScionM ()
+
componentInit _ = return Nothing
+ componentClean _ = return ()
data Component = forall c. IsComponent c => Component c
View
18 server/Scion/Server/Commands.hs
@@ -47,7 +47,7 @@ import qualified Outputable as O ( (<+>),alwaysQualify,neverQualify,text )
import Control.Applicative
import Control.Monad
-import Data.List ( nub )
+import Data.List ( nub, isInfixOf )
import Data.Time.Clock ( NominalDiffTime )
import System.Exit ( ExitCode(..) )
import Text.JSON.AttoJSON (JSON,JSValue(..),fromJSON,toJSON)
@@ -212,7 +212,7 @@ handleScionException :: ScionM a -> ScionM (OkErr a)
handleScionException m = ((((do
r <- m
return (Ok r)
- `gcatch` \(e :: SomeScionException) -> return (Error (show e)))
+ `gcatch` \(e :: SomeScionException) -> return (Error ("Scion:" ++ (show e))))
`gcatch` \(e' :: GhcException) ->
case e' of
Panic _ -> throw e'
@@ -220,12 +220,12 @@ handleScionException m = ((((do
#if __GLASGOW_HASKELL__ < 700
Interrupted -> throw e'
#endif
- _ -> return (Error (show e')))
+ _ -> return (Error ("GHC:" ++ (show e'))))
`gcatch` \(e :: ExitCode) ->
-- client code may not exit the server!
return (Error (show e)))
`gcatch` \(e :: IOError) ->
- return (Error (show e)))
+ return (Error ("IO:" ++ (show e))))
-- `gcatch` \(e :: SomeException) ->
-- liftIO (print e) >> liftIO (throwIO e)
@@ -699,7 +699,15 @@ cmdDumpSources = Cmd "dump-sources" $ noArgs $ cmd
cmdLoad :: Cmd
cmdLoad = Cmd "load" $ reqArg "component" <&> optArg "options" defaultLoadOptions $ cmd
where
- cmd comp options = loadComponent' comp options
+ cmd comp options = do
+ loadComponent' comp options
+ `gcatch` \(e' :: GhcException) ->
+ case e' of
+ CmdLineError s | isInfixOf "cannot satisfy -package-id" s,
+ Component c <- comp -> do
+ componentClean c
+ loadComponent' comp options
+ _ -> throw e'
cmdSetVerbosity :: Cmd
cmdSetVerbosity =
Please sign in to comment.
Something went wrong with that request. Please try again.