diff options
| author | Daniel Gröber <dxld@darkboxed.org> | 2019-08-13 04:43:45 +0200 | 
|---|---|---|
| committer | Daniel Gröber (dxld) <dxld@darkboxed.org> | 2019-09-17 17:48:26 +0200 | 
| commit | d78fab16c93073b1ccbd81f62052779e0de6613f (patch) | |
| tree | 6412c8c798d543a19122d0da6dd0d1725057db59 /tests | |
| parent | 2ccb986eb87c26693b4246dec7702e05f636bc95 (diff) | |
ghc-session: Use new project building API
One caveat: psiConfigure used to --only-configure the entire project. In
theory we shouldn't even need to do that anymore because we reconfigure
just the unit/target we need to before reading unit info.
However cabal has a bug or well they might consider it just inconsistent
behaviour in that instantiated backpack units' targets are not built by the
target mentioned in plan.json so this per-unit reconfigure is currently
broken there.
The workaround is to just build the entire project before running a query
for now.
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/GhcSession.hs | 23 | 
1 files changed, 4 insertions, 19 deletions
diff --git a/tests/GhcSession.hs b/tests/GhcSession.hs index 91ae42a..02e5c76 100644 --- a/tests/GhcSession.hs +++ b/tests/GhcSession.hs @@ -320,13 +320,12 @@ test modProgs (psdImpl -> ProjSetupImpl{..}) topdir tmpdir projdir cabal_file          qe = qe' { qePrograms = progs }      psiSdist progs topdir tmpdir -    psiConfigure progs projdir - -    cs <- concat <$> runQuery (allUnits (Map.elems . uiComponents)) qe -      -- TODO: Cludge until we can just build the unit dependencies -    psiBuild progs projdir +    -- TODO: Move back under runQuery when we fixed backpack +    buildProject qe + +    cs <- concat <$> runQuery (allUnits (Map.elems . uiComponents)) qe      let pkgdir = takeDirectory cabal_file      homedir <- getHomeDirectory @@ -439,8 +438,6 @@ data ProjSetupImpl pt =      { psiProjType  :: !(SProjType pt)      , psiDistDir   :: !(FilePath -> DistDir pt)      , psiProjLoc   :: !(CabalFile -> FilePath -> ProjLoc pt) -    , psiConfigure :: !(Programs -> FilePath -> IO ()) -    , psiBuild     :: !(Programs -> FilePath -> IO ())      , psiSdist     :: !(Programs -> FilePath -> FilePath -> IO ())      , psiQEmod     :: !(QueryEnv pt -> QueryEnv pt)      } @@ -450,10 +447,6 @@ oldBuildProjSetup = ProjSetupDescr "cabal-v1" $ Right $ Ex $ ProjSetupImpl      { psiProjType  = SCabal SCV1      , psiDistDir   = \dir -> DistDirCabal SCV1 (dir </> "dist")      , psiProjLoc   = \(CabalFile cf) projdir -> ProjLocV1CabalFile cf projdir -    , psiConfigure = \progs dir -> -        runWithCwd dir (cabalProgram progs) [ "configure" ] -    , psiBuild     = \progs dir -> -        runWithCwd dir (cabalProgram progs) [ "build" ]      , psiSdist     = \progs srcdir destdir ->          copyMuliPackageProject progs srcdir destdir (\_ _ -> return ())      , psiQEmod     = id @@ -467,10 +460,6 @@ newBuildProjSetup = ProjSetupDescr "cabal-v2" $ Right $ Ex $ ProjSetupImpl                       -- TODO: check if cabal.project is there and only use                       -- V2File then, also remove addCabalProject below so we                       -- cover both cases. -    , psiConfigure = \progs dir -> -        runWithCwd dir (cabalProgram progs) [ "new-build", "--only-configure" ] -    , psiBuild     = \progs dir -> -        runWithCwd dir (cabalProgram progs) [ "new-build" ]      , psiSdist     = \progs srcdir destdir -> do          copyMuliPackageProject progs srcdir destdir $ \pkgsrc pkgdest -> do            exists <- doesFileExist (pkgsrc </> "cabal.project") @@ -491,10 +480,6 @@ stackProjSetup ghcVer =        , psiDistDir   = \_dir  -> DistDirStack Nothing        , psiProjLoc   = \_cabal_file projdir ->            ProjLocStackYaml $ projdir </> "stack.yaml" -      , psiConfigure = \progs dir -> -          runWithCwd dir (stackProgram progs) $ argsBefore ++ [ "build", "--only-configure" ] -      , psiBuild     = \progs dir -> -          runWithCwd dir (stackProgram progs) $ argsBefore ++ [ "build" ]        , psiSdist     = \progs srcdir destdir -> do            copyMuliPackageProject progs srcdir destdir copyStackYamls        , psiQEmod     = \qe ->  | 
