aboutsummaryrefslogtreecommitdiff
path: root/src/CabalHelper/Runtime
diff options
context:
space:
mode:
authorAlan Zimmerman <alan.zimm@gmail.com>2017-12-14 11:32:14 +0200
committerDaniel Gröber <dxld@darkboxed.org>2018-01-18 14:10:26 +0100
commitc76893a035c37c949cca9c09f10ccea59402cf55 (patch)
treed3971b5d14927bc462ca29d1929b0c2b70688ab0 /src/CabalHelper/Runtime
parentf40e568f2be06b9254b8b5a956319c6eafd13997 (diff)
Progress on when to build and when not
Diffstat (limited to 'src/CabalHelper/Runtime')
-rw-r--r--src/CabalHelper/Runtime/Main.hs16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/CabalHelper/Runtime/Main.hs b/src/CabalHelper/Runtime/Main.hs
index 0173fe9..e2829b3 100644
--- a/src/CabalHelper/Runtime/Main.hs
+++ b/src/CabalHelper/Runtime/Main.hs
@@ -70,8 +70,11 @@ import Distribution.Simple.LocalBuildInfo
, withComponentsLBI
, withLibLBI
, withExeLBI
+
+#if CH_MIN_VERSION_Cabal(2,0,0)
, allLibModules
, componentBuildDir
+#endif
)
import Distribution.Simple.GHC
( componentGhcOptions
@@ -396,8 +399,10 @@ main = do
#if CH_MIN_VERSION_Cabal(2,0,0)
includeDirMap <- recursiveDepInfo lbi v distdir
eps <- componentsMap lbi v distdir $ \c clbi _bi -> do
- let (_,_,seps) = recursiveIncludeDirs includeDirMap (componentUnitId clbi)
- return seps
+ case needsBuildOutput includeDirMap (componentUnitId clbi) of
+ ProduceBuildOutput -> return $ componentEntrypoints c
+ NoBuildOutput -> return seps
+ where (_,_,seps) = recursiveIncludeDirs includeDirMap (componentUnitId clbi)
#else
eps <- componentsMap lbi v distdir $ \c _clbi _bi ->
return $ componentEntrypoints c
@@ -544,6 +549,8 @@ removeInplaceDeps _v lbi pd clbi includeDirs = let
, componentIncludes = incs }
in (hasIdeps',c')
+ needsBuild = needsBuildOutput includeDirs (componentUnitId clbi)
+
cleanRecursiveOpts :: Component
-> BuildInfo -> ComponentLocalBuildInfo -> GhcOptions
cleanRecursiveOpts comp libbi libclbi =
@@ -563,15 +570,16 @@ removeInplaceDeps _v lbi pd clbi includeDirs = let
(hasIdeps,clbi') = removeInplace clbi
libopts =
+ -- AZ:TODO: we already have the clbi, use it rather
case (getLibraryClbi pd lbi,getExeClbi pd lbi) of
- (Just (lib, libclbi),_) | hasIdeps ->
+ (Just (lib, libclbi),_) | hasIdeps && (needsBuild == NoBuildOutput) ->
let
libbi = libBuildInfo lib
opts = cleanRecursiveOpts (CLib lib) libbi libclbi
in
-- ghcOptInputModules = toNubListR $ allLibModules lib clbi,
opts { ghcOptInputModules = ghcOptInputModules opts <> (toNubListR $ allLibModules lib libclbi) }
- (_,Just (exe,execlbi)) | hasIdeps ->
+ (_,Just (exe,execlbi)) | hasIdeps && (needsBuild == NoBuildOutput) ->
let
exebi = buildInfo exe
in