diff options
author | Daniel Gröber <dxld@darkboxed.org> | 2020-02-11 12:56:48 +0100 |
---|---|---|
committer | Daniel Gröber <dxld@darkboxed.org> | 2020-02-11 13:00:35 +0100 |
commit | a18bbb2af92e9b4337e7f930cb80754f2408bcfd (patch) | |
tree | da77dab383110a6c2fae82c8aa04f0e79fa3f3f4 /src | |
parent | 4ca6570ecda0a39fc056c239ada6c2368b4dd698 (diff) |
Revert "Fix Cabal version selection for Stack (esp. build-type:Custom)"
This reverts commit 04c2d34f1874bc198288d33c784bc26f89280ee2.
Diffstat (limited to 'src')
-rw-r--r-- | src/CabalHelper/Compiletime/Cabal.hs | 13 | ||||
-rw-r--r-- | src/CabalHelper/Compiletime/Compile.hs | 12 |
2 files changed, 8 insertions, 17 deletions
diff --git a/src/CabalHelper/Compiletime/Cabal.hs b/src/CabalHelper/Compiletime/Cabal.hs index 88e53a7..b565152 100644 --- a/src/CabalHelper/Compiletime/Cabal.hs +++ b/src/CabalHelper/Compiletime/Cabal.hs @@ -268,18 +268,9 @@ complainIfNoCabalFile pkgdir Nothing = bultinCabalVersion :: Version bultinCabalVersion = parseVer VERSION_Cabal -readSetupConfigHeader :: FilePath -> IO UnitHeader +readSetupConfigHeader :: FilePath -> IO (Maybe UnitHeader) readSetupConfigHeader file = bracket (openFile file ReadMode) hClose $ \h -> do - mhdr <- parseSetupHeader <$> BS.hGetLine h - case mhdr of - Just hdr@(UnitHeader _PkgId ("Cabal", _hdrCabalVersion) _compId) -> do - return hdr - Just UnitHeader {uhSetupId=(setup_name, _)} -> panicIO $ - printf "Unknown Setup package-id in setup-config header '%s': '%s'" - (BS8.unpack setup_name) file - Nothing -> panicIO $ - printf "Could not read '%s' header" file - + parseSetupHeader <$> BS.hGetLine h parseSetupHeader :: BS.ByteString -> Maybe UnitHeader parseSetupHeader header = case BS8.words header of diff --git a/src/CabalHelper/Compiletime/Compile.hs b/src/CabalHelper/Compiletime/Compile.hs index a55ee93..d2886e8 100644 --- a/src/CabalHelper/Compiletime/Compile.hs +++ b/src/CabalHelper/Compiletime/Compile.hs @@ -90,7 +90,7 @@ data CompilationProductScope = CPSGlobal | CPSProject type CompHelperEnv = CompHelperEnv' CabalVersion data CompHelperEnv' cv = CompHelperEnv { cheCabalVer :: !cv - , chePkgDb :: ![PackageDbDir] + , chePkgDb :: !(Maybe PackageDbDir) -- ^ A package-db where we are guaranteed to find Cabal-`cheCabalVer`. , cheProjDir :: !FilePath , chePlanJson :: !(Maybe PlanJson) @@ -119,7 +119,7 @@ compileHelper' CompHelperEnv {..} = do CabalVersion cabalVerPlain -> do runMaybeT $ msum $ map (\f -> f ghcVer cabalVerPlain) $ case chePkgDb of - [] -> + Nothing -> [ compileWithCabalV2Inplace , compileWithCabalV2GhcEnv , compileCabalSource @@ -127,8 +127,8 @@ compileHelper' CompHelperEnv {..} = do , compileGlobal , compileWithCabalInPrivatePkgDb ] - dbs -> - [ ((.).(.)) liftIO (compilePkgDbs dbs) + Just db -> + [ ((.).(.)) liftIO (compilePkgDb db) ] appdir <- appCacheDir let cp@CompPaths {compExePath} = compPaths appdir cheProjLocalCacheDir comp @@ -148,11 +148,11 @@ compileHelper' CompHelperEnv {..} = do -- for relaxed deps: find (sameMajorVersionAs cheCabalVer) . reverse . sort - compilePkgDbs dbs _ghcVer cabalVer = return $ + compilePkgDb db _ghcVer cabalVer = return $ (,) (pure ()) CompileWithCabalPackage - { compPackageSource = GPSPackageDBs dbs + { compPackageSource = GPSPackageDBs [db] , compCabalVersion = CabalVersion cabalVer , compProductTarget = CPSProject } |