aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper
diff options
context:
space:
mode:
Diffstat (limited to 'src/CabalHelper')
-rw-r--r--src/CabalHelper/Runtime/HelperMain.hs122
1 files changed, 62 insertions, 60 deletions
diff --git a/src/CabalHelper/Runtime/HelperMain.hs b/src/CabalHelper/Runtime/HelperMain.hs
index 983223b..3758181 100644
--- a/src/CabalHelper/Runtime/HelperMain.hs
+++ b/src/CabalHelper/Runtime/HelperMain.hs
@@ -24,6 +24,7 @@ module CabalHelper.Runtime.HelperMain (helper_main) where
import Distribution.Simple.Utils (cabalVersion)
import Distribution.Simple.Configure
+import Distribution.Utils.Path
import Distribution.Package
( PackageIdentifier
, PackageId
@@ -278,68 +279,68 @@ helper_main args = do
let cmds = collectCmdOptions args'
flip mapM cmds $$ \x -> do
- case x of
- "version":[] ->
- return $ Just $ ChResponseVersion ("Cabal", toDataVersion cabalVersion)
-
- "package-id":[] ->
- return $ Just $ ChResponseVersion $ (,)
- (display (packageName gpd))
- (toDataVersion (packageVersion gpd))
-
- "flags":[] -> do
- return $ Just $ ChResponseFlags $ sort $
- map (flagName' &&& flagDefault) $ genPackageFlags gpd
-
- "config-flags":[] -> do
- return $ Just $ ChResponseFlags $ sort $
- map (first unFlagName)
- $ unFlagAssignment
- $ configConfigurationsFlags
- $ configFlags lbi
-
- "non-default-config-flags":[] -> do
- let flagDefinitons = genPackageFlags gpd
- flagAssgnments =
+ case x of
+ "version":[] ->
+ return $ Just $ ChResponseVersion ("Cabal", toDataVersion cabalVersion)
+
+ "package-id":[] ->
+ return $ Just $ ChResponseVersion $ (,)
+ (display (packageName gpd))
+ (toDataVersion (packageVersion gpd))
+
+ "flags":[] -> do
+ return $ Just $ ChResponseFlags $ sort $
+ map (flagName' &&& flagDefault) $ genPackageFlags gpd
+
+ "config-flags":[] -> do
+ return $ Just $ ChResponseFlags $ sort $
+ map (first unFlagName)
+ $ unFlagAssignment
+ $ configConfigurationsFlags
+ $ configFlags lbi
+
+ "non-default-config-flags":[] -> do
+ let flagDefinitons = genPackageFlags gpd
+ flagAssgnments =
#if CH_MIN_VERSION_Cabal(2,2,0)
- unFlagAssignment $ configConfigurationsFlags
+ unFlagAssignment $ configConfigurationsFlags
#else
- configConfigurationsFlags
+ configConfigurationsFlags
#endif
- $ configFlags lbi
- nonDefaultFlags =
- [ (flag_name, val)
- | flag <- flagDefinitons
- , let flag_name' = unFlagName $ flagName flag
- , let def_val = flagDefault flag
- , (unFlagName -> flag_name, val) <- flagAssgnments
- , flag_name == flag_name'
- , val /= def_val
- ]
- return $ Just $ ChResponseFlags $ sort nonDefaultFlags
-
- "write-autogen-files":[] -> do
- initialBuildStepsForAllComponents distdir pd lbi v
- return Nothing
-
- "compiler-id":[] -> do
- let CompilerId comp ver = compilerId $ compiler lbi
- return $ Just $ ChResponseVersion $ (,) (show comp) (toDataVersion ver)
-
- "component-info":[] -> do
- res <- componentsInfo lvd pt
- return $ Just $ ChResponseComponentsInfo res
-
- "print-lbi":flags ->
- case flags of
- ["--human"] -> print lbi >> return Nothing
- _ -> return $ Just $ ChResponseLbi $ show lbi
-
- cmd:_ | not (cmd `elem` commands) ->
- errMsg ("Unknown command: " ++ cmd) >> usage >> exitFailure
- _ ->
- errMsg "Invalid usage!" >> usage >> exitFailure
-
+ $ configFlags lbi
+ nonDefaultFlags =
+ [ (flag_name, val)
+ | flag <- flagDefinitons
+ , let flag_name' = unFlagName $ flagName flag
+ , let def_val = flagDefault flag
+ , (unFlagName -> flag_name, val) <- flagAssgnments
+ , flag_name == flag_name'
+ , val /= def_val
+ ]
+ return $ Just $ ChResponseFlags $ sort nonDefaultFlags
+
+ "write-autogen-files":[] -> do
+ initialBuildStepsForAllComponents distdir pd lbi v
+ return Nothing
+
+ "compiler-id":[] -> do
+ let CompilerId comp ver = compilerId $ compiler lbi
+ return $ Just $ ChResponseVersion $ (,) (show comp) (toDataVersion ver)
+
+ "component-info":[] -> do
+ res <- componentsInfo lvd pt
+ return $ Just $ ChResponseComponentsInfo res
+
+ "print-lbi":flags ->
+ case flags of
+ ["--human"] -> print lbi >> return Nothing
+ _ -> return $ Just $ ChResponseLbi $ show lbi
+
+ cmd:_ | not (cmd `elem` commands) ->
+ errMsg ("Unknown command: " ++ cmd) >> usage >> exitFailure
+ _ ->
+ errMsg "Invalid usage!" >> usage >> exitFailure
+
type ProjectType = String -- either "v1" or "v2"
componentsInfo
@@ -371,7 +372,8 @@ componentsInfo lvd@(lbi, v, distdir) pt = do
$ ChComponentInfo
<$> ZipList comp_name
<*> ZipList (map snd ciGhcOptions)
- <*> ZipList (map snd ciSourceDirs)
+ <*> ZipList (map (map getSymbolicPath . snd)
+ ciSourceDirs)
<*> ZipList (map snd ciEntrypoints)
return uiComponents