diff --git a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs index 3d93b0db1153c7bd1eff5b3c1f9a9b655dbc9ab0..f89200d61cd1e909a81bc27646c19a65bfaf8852 100644 --- a/cabal-install/src/Distribution/Client/ProjectOrchestration.hs +++ b/cabal-install/src/Distribution/Client/ProjectOrchestration.hs @@ -863,24 +863,22 @@ printPlan verbosity PackageConfig {packageConfigOptimization = globalOptimization}, projectConfigLocalPackages = PackageConfig {packageConfigOptimization = localOptimization} - } + }, + currentCommand } ProjectBuildContext { elaboratedPlanToExecute = elaboratedPlan, elaboratedShared, pkgsBuildStatus } - - | null pkgs - = notice verbosity "Up to date" - - | otherwise - = noticeNoWrap verbosity $ unlines $ + | null pkgs && currentCommand == BuildCommand + = notice verbosity "Up to date" + | not (null pkgs) = noticeNoWrap verbosity $ unlines $ (showBuildProfile ++ "In order, the following " ++ wouldWill ++ " be built" ++ ifNormal " (use -v for more details)" ++ ":") : map showPkgAndReason pkgs - + | otherwise = return () where pkgs = InstallPlan.executionOrder elaboratedPlan diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdBuild/ScriptBuildRun/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdBuild/ScriptBuildRun/cabal.out index 5641c7a2ed849150fcfbca38c6d517f551693ef8..208af7b3a0b3124d7e84b90454cb333b19770f1d 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdBuild/ScriptBuildRun/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdBuild/ScriptBuildRun/cabal.out @@ -5,5 +5,4 @@ In order, the following will be built: - fake-package-0 (exe:cabal-script-script.hs) (first run) Configuring executable 'cabal-script-script.hs' for fake-package-0.. Building executable 'cabal-script-script.hs' for fake-package-0.. -# cabal v2-run -Up to date +# cabal v2-run \ No newline at end of file diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out index 1c5a2e370523beb00f63277fda105a1b8b9b41d2..e03600972755f672ff53022ff22860bd1fed88f4 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultipleExes/cabal.out @@ -14,7 +14,7 @@ Configuring executable 'bar' for MultipleExes-1.0.. Preprocessing executable 'bar' for MultipleExes-1.0.. Building executable 'bar' for MultipleExes-1.0.. # cabal v2-run -Up to date + # cabal v2-run Error: cabal: The run command is for running a single executable at once. The target '' refers to the package MultipleExes-1.0 which includes - executables: bar and foo diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out index 66606e2087084bfe62454638274699789904481c..d389571bb4f50b32559b64054b0d26913b545cfd 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/MultiplePackages/cabal.out @@ -7,7 +7,6 @@ Configuring executable 'bar-exe' for bar-1.0.. Preprocessing executable 'bar-exe' for bar-1.0.. Building executable 'bar-exe' for bar-1.0.. # cabal v2-run -Up to date # cabal v2-run Build profile: -w ghc-<GHCVER> -O1 In order, the following will be built: diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptRerun/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptRerun/cabal.out index f7a7ca06306c43926e9876c07d825c94d6425bf7..5384fa3bbe5d3529e4673eb7d9ed704cfb0d5fc7 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptRerun/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/ScriptRerun/cabal.out @@ -6,4 +6,3 @@ In order, the following will be built: Configuring executable 'cabal-script-script.hs' for fake-package-0.. Building executable 'cabal-script-script.hs' for fake-package-0.. # cabal v2-run -Up to date diff --git a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out index 486372189517c65880a6b3b0fc0c5b37da09561d..78f3af0113245c2b04224054b439708d8123786b 100644 --- a/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out +++ b/cabal-testsuite/PackageTests/NewBuild/CmdRun/Single/cabal.out @@ -7,12 +7,8 @@ Configuring executable 'foo' for Single-1.0.. Preprocessing executable 'foo' for Single-1.0.. Building executable 'foo' for Single-1.0.. # cabal v2-run -Up to date # cabal v2-run -Up to date # cabal v2-run -Up to date # cabal v2-run -Up to date # cabal v2-run Error: cabal: Cannot run the package bar, it is not in this project (either directly or indirectly). If you want to add it to the project then edit the cabal.project file. diff --git a/changelog.d/issue-4994 b/changelog.d/issue-4994 new file mode 100644 index 0000000000000000000000000000000000000000..e5b829599d3f8ff24b469c7501570e4321567093 --- /dev/null +++ b/changelog.d/issue-4994 @@ -0,0 +1,4 @@ +synopsis: Do not print "up to date" for commands unless running "cabal build" +packages: Cabal +issues: #4994 +prs: #8569