diff options
-rw-r--r-- | lib/Distribution/Helper.hs | 9 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Types.hs | 3 | ||||
-rw-r--r-- | src/CabalHelper/Runtime/Main.hs | 7 | ||||
-rw-r--r-- | src/CabalHelper/Shared/InterfaceTypes.hs | 2 |
4 files changed, 15 insertions, 6 deletions
diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs index 4757200..90935c9 100644 --- a/lib/Distribution/Helper.hs +++ b/lib/Distribution/Helper.hs @@ -436,21 +436,22 @@ readUnitInfo :: QueryEnvI c pt -> FilePath -> Unit -> IO UnitInfo readUnitInfo qe exe unit@Unit {uUnitId=uiUnitId, uPackageDir=pkgdir, uDistDir=distdir} = do res <- readHelper qe exe pkgdir distdir - [ "package-db-stack" + [ "package-id" + , "package-db-stack" , "flags" , "compiler-version" , "config-flags" , "non-default-config-flags" , "component-info" ] - let [ Just (ChResponsePkgDbs uiPackageDbStack), + let [ Just (ChResponseVersion uiPackageId), + Just (ChResponsePkgDbs uiPackageDbStack), Just (ChResponseFlags uiPackageFlags), - Just (ChResponseVersion comp compVer), + Just (ChResponseVersion uiCompilerVersion), Just (ChResponseFlags uiConfigFlags), Just (ChResponseFlags uiNonDefaultConfigFlags), Just (ChResponseComponentsInfo uiComponents) ] = res - uiCompilerVersion = (comp, compVer) uiModTimes <- getUnitModTimes unit return $ UnitInfo {..} diff --git a/src/CabalHelper/Compiletime/Types.hs b/src/CabalHelper/Compiletime/Types.hs index 58e90b1..e803ae6 100644 --- a/src/CabalHelper/Compiletime/Types.hs +++ b/src/CabalHelper/Compiletime/Types.hs @@ -146,6 +146,9 @@ data UnitInfo = UnitInfo { uiUnitId :: !UnitId -- ^ A unique identifier of this init within the project. + , uiPackageId :: !(String, Version) + -- ^ The package-name and version this unit belongs to. + , uiComponents :: !(Map ChComponentName ChComponentInfo) -- ^ The components of the unit: libraries, executables, test-suites, -- benchmarks and so on. diff --git a/src/CabalHelper/Runtime/Main.hs b/src/CabalHelper/Runtime/Main.hs index 3a363a3..d0eea1a 100644 --- a/src/CabalHelper/Runtime/Main.hs +++ b/src/CabalHelper/Runtime/Main.hs @@ -306,6 +306,11 @@ main = do print =<< flip mapM cmds $$ \x -> do case x of + "package-id":[] -> + return $ Just $ ChResponseVersion $ (,) + (display (packageName gpd)) + (toDataVersion (packageVersion gpd)) + "flags":[] -> do return $ Just $ ChResponseFlags $ sort $ map (flagName' &&& flagDefault) $ genPackageFlags gpd @@ -344,7 +349,7 @@ main = do "compiler-version":[] -> do let CompilerId comp ver = compilerId $ compiler lbi - return $ Just $ ChResponseVersion (show comp) (toDataVersion ver) + return $ Just $ ChResponseVersion $ (,) (show comp) (toDataVersion ver) "package-db-stack":[] -> do let diff --git a/src/CabalHelper/Shared/InterfaceTypes.hs b/src/CabalHelper/Shared/InterfaceTypes.hs index 0539b96..ae72f3f 100644 --- a/src/CabalHelper/Shared/InterfaceTypes.hs +++ b/src/CabalHelper/Shared/InterfaceTypes.hs @@ -41,7 +41,7 @@ data ChResponse | ChResponseList [String] | ChResponsePkgDbs [ChPkgDb] | ChResponseLbi String - | ChResponseVersion String Version + | ChResponseVersion (String, Version) | ChResponseLicenses [(String, [(String, Version)])] | ChResponseFlags [(String, Bool)] deriving (Eq, Ord, Read, Show, Generic) |