Skip to content

Commit

Permalink
Merge pull request #3919 from ezyang/pr/new-repl-noregister
Browse files Browse the repository at this point in the history
Only reregister inplace package if we built it.
  • Loading branch information
ezyang committed Oct 6, 2016
2 parents 8fa4d2e + 4a80b8e commit 4fd559a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 29 deletions.
32 changes: 14 additions & 18 deletions cabal-install/Distribution/Client/ProjectBuilding.hs
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,11 @@ checkPackageFileMonitorChanged PackageFileMonitor{..}
where
buildReason = BuildReasonEphemeralTargets

(MonitorUnchanged buildResult _, MonitorUnchanged mipkg _) ->
(MonitorUnchanged buildResult _, MonitorUnchanged _ _) ->
return $ Right BuildResult {
buildResultDocs = docsResult,
buildResultTests = testsResult,
buildResultLogFile = Nothing,
buildResultLibInfo = mipkg
buildResultLogFile = Nothing
}
where
(docsResult, testsResult) = buildResult
Expand Down Expand Up @@ -883,8 +882,7 @@ buildAndInstallUnpackedPackage verbosity
setup buildCommand buildFlags

-- Install phase
mipkg <-
annotateFailure mlogFile InstallFailed $ do
annotateFailure mlogFile InstallFailed $ do
--TODO: [required eventually] need to lock installing this ipkig so other processes don't
-- stomp on our files, since we don't have ABI compat, not safe to replace

Expand Down Expand Up @@ -919,8 +917,7 @@ buildAndInstallUnpackedPackage verbosity
Cabal.registerPackage verbosity compiler progdb
HcPkg.MultiInstance
(elabRegisterPackageDBStack pkg) ipkg
return (Just ipkg)
else return Nothing
else return ()

--TODO: [required feature] docs and test phases
let docsResult = DocsNotTried
Expand All @@ -929,8 +926,7 @@ buildAndInstallUnpackedPackage verbosity
return BuildResult {
buildResultDocs = docsResult,
buildResultTests = testsResult,
buildResultLogFile = mlogFile,
buildResultLibInfo = mipkg
buildResultLogFile = mlogFile
}

where
Expand Down Expand Up @@ -1070,8 +1066,7 @@ buildInplaceUnpackedPackage verbosity

-- PURPOSELY omitted: no copy!

mipkg <- whenReRegister $
annotateFailureNoLog InstallFailed $ do
whenReRegister $ annotateFailureNoLog InstallFailed $ do
-- Register locally
mipkg <- if elabRequiresRegistration pkg
then do
Expand All @@ -1089,7 +1084,6 @@ buildInplaceUnpackedPackage verbosity
else return Nothing

updatePackageRegFileMonitor packageFileMonitor srcdir mipkg
return mipkg

-- Repl phase
--
Expand All @@ -1105,8 +1099,7 @@ buildInplaceUnpackedPackage verbosity
return BuildResult {
buildResultDocs = docsResult,
buildResultTests = testsResult,
buildResultLogFile = Nothing,
buildResultLibInfo = mipkg
buildResultLogFile = Nothing
}

where
Expand All @@ -1133,10 +1126,13 @@ buildInplaceUnpackedPackage verbosity
| elabBuildHaddocks pkg = action
| otherwise = return ()

whenReRegister action = case buildStatus of
BuildStatusConfigure _ -> action
BuildStatusBuild Nothing _ -> action
BuildStatusBuild (Just mipkg) _ -> return mipkg
whenReRegister action
= case buildStatus of
-- We registered the package already
BuildStatusBuild (Just _) _ -> return ()
-- There is nothing to register
_ | null (elabBuildTargets pkg) -> return ()
| otherwise -> action

configureCommand = Cabal.configureCommand defaultProgramDb
configureFlags v = flip filterConfigureFlags v $
Expand Down
12 changes: 1 addition & 11 deletions cabal-install/Distribution/Client/ProjectBuilding/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -177,17 +177,7 @@ type BuildOutcome = Either BuildFailure BuildResult
data BuildResult = BuildResult {
buildResultDocs :: DocsResult,
buildResultTests :: TestsResult,
buildResultLogFile :: Maybe FilePath,
-- | If the build was for a library, this field will be @Just@;
-- otherwise, it will be @Nothing@. What about internal
-- libraries? This never occurs, because a build result is either
-- for a per-component build (in which case there won't
-- be multiple libraries), or a package with no internal
-- libraries (internal libraries with Custom setups are NOT
-- supported, and even if they were supported, we could
-- assume the Cabal library version was recent enough to
-- support per-component build.).
buildResultLibInfo :: Maybe InstalledPackageInfo
buildResultLogFile :: Maybe FilePath
}
deriving Show

Expand Down

0 comments on commit 4fd559a

Please sign in to comment.