From 29c13da426a9009754f5d32351a9f54bccf3cbb5 Mon Sep 17 00:00:00 2001 From: Daniel Gröber Date: Tue, 6 Aug 2019 02:06:54 +0200 Subject: Remove crusty old helper code - Inplace component inlining really always was a nasty cludge, now that we have proper build-system support we can get rid of it. - GHC options subsets aren't really needed, we can split these up after parsing the options using the ghc library. - Dropped GHC 7.10, it seems unsupportable without the inplace component inlining, possibly a Stack/lib:Cabal bug, but it is quite old so time for it to go anyway. This is the second thing commit it was holing up too! --- lib/Distribution/Helper.hs | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'lib') diff --git a/lib/Distribution/Helper.hs b/lib/Distribution/Helper.hs index 98afbd3..89ce6f9 100644 --- a/lib/Distribution/Helper.hs +++ b/lib/Distribution/Helper.hs @@ -86,7 +86,6 @@ module Distribution.Helper ( , ChModuleName(..) , ChPkgDb(..) , ChEntrypoint(..) - , NeedsBuildOutput(..) -- * General information , Distribution.Helper.buildPlatform @@ -499,17 +498,15 @@ readUnitInfo :: Helper pt -> Unit pt -> IO UnitInfo readUnitInfo helper unit@Unit {uUnitId=uiUnitId} = do res <- runHelper helper unit [ "package-id" - , "package-db-stack" - , "flags" , "compiler-id" + , "flags" , "config-flags" , "non-default-config-flags" , "component-info" ] let [ Just (ChResponseVersion uiPackageId), - Just (ChResponsePkgDbs uiPackageDbStack), - Just (ChResponseFlags uiPackageFlags), Just (ChResponseVersion uiCompilerId), + Just (ChResponseFlags uiPackageFlags), Just (ChResponseFlags uiConfigFlags), Just (ChResponseFlags uiNonDefaultConfigFlags), Just (ChResponseComponentsInfo uiComponents) @@ -653,12 +650,13 @@ newtype Helper pt = Helper { runHelper :: Unit pt -> [String] -> IO [Maybe ChResponse] } getHelper :: ProjInfo pt -> QueryEnvI c pt -> IO (Helper pt) -getHelper ProjInfo{piCabalVersion} QueryEnv{..} +getHelper ProjInfo{piCabalVersion} qe@QueryEnv{..} | piCabalVersion == bultinCabalVersion = return $ Helper $ \Unit{ uCabalFile=CabalFile cabal_file , uDistDir=DistDirLib distdir } args -> - helper_main $ cabal_file : distdir : args + let pt = dispHelperProjectType (projTypeOfQueryEnv qe) in + helper_main $ cabal_file : distdir : pt : args getHelper proj_info qe@QueryEnv{..} = do withVerbosity $ withProgs (piImpl proj_info) qe $ do t0 <- Clock.getTime Monotonic @@ -671,8 +669,17 @@ getHelper proj_info qe@QueryEnv{..} = do Left rv -> panicIO $ "compileHelper': compiling helper failed! exit code "++ show rv Right exe -> + let pt = dispHelperProjectType (projTypeOfQueryEnv qe) in return $ Helper $ \Unit{uCabalFile, uDistDir} args -> - readHelper qe exe uCabalFile uDistDir args + readHelper qe exe uCabalFile uDistDir (pt : args) + +dispHelperProjectType :: SProjType pt -> String +dispHelperProjectType (SCabal SCV1) = "v1" +-- ^ v1-build needs a last minute addition of the inplace package-db +-- beyond what lbi has +dispHelperProjectType (SCabal SCV2) = "v2" +dispHelperProjectType SStack = "v2" +-- ^ stack also embeds all necessary options into lbi like v2 mkCompHelperEnv :: Verbose -- cgit v1.2.3