aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Compiletime/Program/CabalInstall.hs
diff options
context:
space:
mode:
authorDaniel Gröber <dxld@darkboxed.org>2018-12-16 01:04:38 +0100
committerDaniel Gröber <dxld@darkboxed.org>2019-01-22 03:06:51 +0100
commit30591c394974aa282891e37a6cff2802b4f92773 (patch)
treea367cea43c62f399618fba8c0fadfe2bc4d3e5d5 /src/CabalHelper/Compiletime/Program/CabalInstall.hs
parent571448ca604065a6e6bfe7e6423b8ae6789b4dd9 (diff)
Add 'uComponentName' query
Diffstat (limited to 'src/CabalHelper/Compiletime/Program/CabalInstall.hs')
-rw-r--r--src/CabalHelper/Compiletime/Program/CabalInstall.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/CabalHelper/Compiletime/Program/CabalInstall.hs b/src/CabalHelper/Compiletime/Program/CabalInstall.hs
index 49bc7f2..6b6d401 100644
--- a/src/CabalHelper/Compiletime/Program/CabalInstall.hs
+++ b/src/CabalHelper/Compiletime/Program/CabalInstall.hs
@@ -49,6 +49,8 @@ import CabalHelper.Compiletime.Program.GHC
import CabalHelper.Compiletime.Cabal
( CabalSourceDir(..), UnpackedCabalVersion, CabalVersion'(..), unpackCabalV1 )
import CabalHelper.Compiletime.Process
+import CabalHelper.Shared.InterfaceTypes
+ ( ChComponentName(..), ChLibraryName(..) )
import CabalHelper.Shared.Common
( parseVer, trim, appCacheDir, panicIO )
@@ -248,8 +250,10 @@ planUnits plan = do
, uPId=CP.PkgId pkg_name _
} = do
cabal_file <- Cabal.findCabalFile pkgdir
+ let comp_names = Map.keys comps
let uiV2Components =
map (Text.unpack . CP.dispCompNameTarget pkg_name) $ Map.keys comps
+ let uiV2ComponentNames = map cpCompNameToChComponentName comp_names
return $ Just $ Right $ Unit
{ uUnitId = UnitId $ Text.unpack (coerce (CP.uId u))
, uPackageDir = pkgdir
@@ -261,3 +265,14 @@ planUnits plan = do
return $ Just $ Left u
takeunit _ =
return $ Nothing
+
+cpCompNameToChComponentName :: CP.CompName -> ChComponentName
+cpCompNameToChComponentName cn =
+ case cn of
+ CP.CompNameSetup -> ChSetupHsName
+ CP.CompNameLib -> ChLibName ChMainLibName
+ (CP.CompNameSubLib name) -> ChLibName $ ChSubLibName $ Text.unpack name
+ (CP.CompNameFLib name) -> ChFLibName $ Text.unpack name
+ (CP.CompNameExe name) -> ChExeName $ Text.unpack name
+ (CP.CompNameTest name) -> ChTestName $ Text.unpack name
+ (CP.CompNameBench name) -> ChBenchName $ Text.unpack name