Skip to content

Commit

Permalink
Revert "Add support for build --assume-deps-up-to-date flag, partial …
Browse files Browse the repository at this point in the history
…fix to haskell#2775 (haskell#3287)"

This reverts commit 85a76c9.
  • Loading branch information
ezyang committed Oct 18, 2016
1 parent e79122c commit 62526dd
Show file tree
Hide file tree
Showing 8 changed files with 1 addition and 81 deletions.
1 change: 0 additions & 1 deletion Cabal/Cabal.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ extra-source-files:
tests/PackageTests/BenchmarkOptions/BenchmarkOptions.cabal
tests/PackageTests/BenchmarkOptions/test-BenchmarkOptions.hs
tests/PackageTests/BenchmarkStanza/my.cabal
tests/PackageTests/BuildAssumeDepsUpToDate/BuildAssumeDepsUpToDate.cabal
tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/GlobalBuildDepsNotAdditive1.cabal
tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive1/MyLibrary.hs
tests/PackageTests/BuildDeps/GlobalBuildDepsNotAdditive2/GlobalBuildDepsNotAdditive2.cabal
Expand Down
30 changes: 1 addition & 29 deletions Cabal/Distribution/Simple/Build.hs
Original file line number Diff line number Diff line change
Expand Up @@ -81,35 +81,7 @@ build :: PackageDescription -- ^ Mostly information from the .cabal file
-> BuildFlags -- ^ Flags that the user passed to build
-> [ PPSuffixHandler ] -- ^ preprocessors to run before compiling
-> IO ()
build pkg_descr lbi flags suffixes
| fromFlag (buildAssumeDepsUpToDate flags) = do
-- TODO: if checkBuildTargets ignores a target we may accept
-- a --assume-deps-up-to-date with multiple arguments. Arguably, we should
-- error early in this case.
target <- readTargetInfos verbosity pkg_descr lbi (buildArgs flags) >>= \r -> case r of
[] -> die "In --assume-deps-up-to-date mode you must specify a target"
[target] -> return target
_ -> die "In --assume-deps-up-to-date mode you can only build a single target"
-- NB: do NOT 'createInternalPackageDB'; we don't want to delete it.
-- But this means we have to be careful about unregistering
-- ourselves.
let dbPath = internalPackageDBPath lbi distPref
internalPackageDB = SpecificPackageDB dbPath
clbi = targetCLBI target
comp = targetComponent target
-- TODO: do we need to unregister libraries? In any case, this would
-- need to be done in the buildLib functionality.
-- Do the build
initialBuildSteps distPref pkg_descr lbi clbi verbosity
let bi = componentBuildInfo comp
progs' = addInternalBuildTools pkg_descr lbi bi (withPrograms lbi)
lbi' = lbi {
withPrograms = progs',
withPackageDB = withPackageDB lbi ++ [internalPackageDB]
}
buildComponent verbosity (buildNumJobs flags) pkg_descr
lbi' suffixes comp clbi distPref
| otherwise = do
build pkg_descr lbi flags suffixes = do
targets <- readTargetInfos verbosity pkg_descr lbi (buildArgs flags)
let componentsToBuild = neededTargetsInBuildOrder' pkg_descr lbi (map nodeKey targets)
info verbosity $ "Component build order: "
Expand Down
9 changes: 0 additions & 9 deletions Cabal/Distribution/Simple/Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1598,9 +1598,6 @@ data BuildFlags = BuildFlags {
buildDistPref :: Flag FilePath,
buildVerbosity :: Flag Verbosity,
buildNumJobs :: Flag (Maybe Int),
-- | If this is true, we don't build the dependencies of
-- 'buildArgs': only the directly referenced components.
buildAssumeDepsUpToDate :: Flag Bool,
-- TODO: this one should not be here, it's just that the silly
-- UserHooks stop us from passing extra info in other ways
buildArgs :: [String]
Expand All @@ -1618,7 +1615,6 @@ defaultBuildFlags = BuildFlags {
buildDistPref = mempty,
buildVerbosity = Flag normal,
buildNumJobs = mempty,
buildAssumeDepsUpToDate = Flag False,
buildArgs = []
}

Expand Down Expand Up @@ -1666,11 +1662,6 @@ buildOptions :: ProgramDb -> ShowOrParseArgs
buildOptions progDb showOrParseArgs =
[ optionNumJobs
buildNumJobs (\v flags -> flags { buildNumJobs = v })

, option "" ["assume-deps-up-to-date"]
"One-shot build"
buildAssumeDepsUpToDate (\c flags -> flags { buildAssumeDepsUpToDate = c })
trueArg
]

++ programDbPaths progDb showOrParseArgs
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

18 changes: 0 additions & 18 deletions Cabal/tests/PackageTests/Tests.hs
Original file line number Diff line number Diff line change
Expand Up @@ -526,24 +526,6 @@ tests config = do
tc "Regression/T3847" $ do
cabal "configure" ["--disable-tests"]

-- Test build --assume-deps-up-to-date
mtc "BuildAssumeDepsUpToDate" $ \step -> do
step "Initial build"
pkg_dir <- packageDir
liftIO $ writeFile (pkg_dir </> "A.hs") "module A where\na = \"a1\""
liftIO $ writeFile (pkg_dir </> "myprog/Main.hs") "import A\nmain = print (a ++ \" b1\")"
cabal_build []
runExe' "myprog" []
>>= assertOutputContains "a1 b1"

step "Rebuild executable only"
ghcFileModDelay
liftIO $ writeFile (pkg_dir </> "A.hs") "module A where\na = \"a2\""
liftIO $ writeFile (pkg_dir </> "myprog/Main.hs") "import A\nmain = print (a ++ \" b2\")"
cabal "build" ["--assume-deps-up-to-date", "myprog"]
runExe' "myprog" []
>>= assertOutputContains "a1 b2"

-- Test error message we report when a non-buildable target is
-- requested to be built
-- TODO: We can give a better error message here, see #3858.
Expand Down
1 change: 0 additions & 1 deletion cabal-install/Distribution/Client/ProjectPlanning.hs
Original file line number Diff line number Diff line change
Expand Up @@ -2659,7 +2659,6 @@ setupHsBuildFlags _ _ verbosity builddir =
buildProgramArgs = mempty, --unused, set at configure time
buildVerbosity = toFlag verbosity,
buildDistPref = toFlag builddir,
buildAssumeDepsUpToDate = toFlag False,
buildNumJobs = mempty, --TODO: [nice to have] sometimes want to use toFlag (Just numBuildJobs),
buildArgs = mempty -- unused, passed via args not flags
}
Expand Down

0 comments on commit 62526dd

Please sign in to comment.