forked from haskell/cabal
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add tests for haskell#9742 `main-is` not picked up when inside a multibranch CondNode. * Fix comments * Add simplifyBranch to Distribution.Types.CondTree Goes hand in hand with with simplifyCondTree. * Make `check` deal correctly with multiple branches `cabal check` had a problem recognising fields in presence of multiple branches. This patch fixes the problem and does not meaningfully increases CI time of particularly taxing tests (like “duplicate flagged dependencies” from MemoryUsage). --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
2269835
commit 74b1f21
Showing
14 changed files
with
216 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cabal check | ||
No errors or warnings could be found in the package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- `main-is` in both branches is not missing (after). | ||
main = cabalTest $ | ||
cabal "check" [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cabal-version: 3.0 | ||
name: pkg | ||
synopsis: synopsis | ||
description: description | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
license: GPL-3.0-or-later | ||
|
||
flag my-flag | ||
description: Test for branches. | ||
default: False | ||
manual: True | ||
|
||
executable exe | ||
if os(windows) | ||
ghc-options: -pgml misc/static-libstdc++ | ||
|
||
if flag(my-flag) | ||
main-is: Main.hs | ||
build-depends: async, unix | ||
c-sources: executable/link.c | ||
else | ||
main-is: ParallelMain.hs | ||
|
||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cabal check | ||
No errors or warnings could be found in the package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- `main-is` in both branches is not missing. | ||
main = cabalTest $ | ||
cabal "check" [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
cabal-version: 3.0 | ||
name: pkg | ||
synopsis: synopsis | ||
description: description | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
license: GPL-3.0-or-later | ||
|
||
flag my-flag | ||
description: Test for branches. | ||
default: False | ||
manual: True | ||
|
||
executable exe | ||
if flag(my-flag) | ||
main-is: Main.hs | ||
build-depends: async, unix | ||
c-sources: executable/link.c | ||
else | ||
main-is: ParallelMain.hs | ||
|
||
if os(windows) | ||
ghc-options: -pgml misc/static-libstdc++ | ||
|
||
default-language: Haskell2010 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# cabal check | ||
No errors or warnings could be found in the package. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- `main-is` in both branches is not missing (deep). | ||
main = cabalTest $ | ||
cabal "check" [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
cabal-version: 3.0 | ||
name: pkg | ||
synopsis: synopsis | ||
description: description | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
license: GPL-3.0-or-later | ||
|
||
flag my-flag | ||
description: Test for branches. | ||
default: False | ||
manual: True | ||
|
||
flag another-flag | ||
description: Deep test for branches. | ||
default: False | ||
manual: True | ||
|
||
executable exe | ||
if flag(my-flag) | ||
if flag(another-flag) | ||
main-is: Main.hs | ||
build-depends: async, unix | ||
c-sources: executable/link.c | ||
else | ||
main-is: AnotherMain.hs | ||
else | ||
main-is: ParallelMain.hs | ||
|
||
if os(windows) | ||
ghc-options: -pgml misc/static-libstdc++ | ||
|
||
default-language: Haskell2010 |
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/Check/Cond/DeepMissing/cabal.out
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# cabal check | ||
The package will not build sanely due to these errors: | ||
Error: [no-main-is] No 'main-is' field found for executable exe | ||
Error: Hackage would reject this package. | ||
|
5 changes: 5 additions & 0 deletions
5
cabal-testsuite/PackageTests/Check/Cond/DeepMissing/cabal.test.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- `main-is` in both branches is not missing (deep, actually missing). | ||
main = cabalTest $ | ||
fails $ cabal "check" [] |
35 changes: 35 additions & 0 deletions
35
cabal-testsuite/PackageTests/Check/Cond/DeepMissing/pkg.cabal
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
cabal-version: 3.0 | ||
name: pkg | ||
synopsis: synopsis | ||
description: description | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
license: GPL-3.0-or-later | ||
|
||
flag my-flag | ||
description: Test for branches. | ||
default: False | ||
manual: True | ||
|
||
flag another-flag | ||
description: Deep test for branches. | ||
default: False | ||
manual: True | ||
|
||
executable exe | ||
if flag(my-flag) | ||
if flag(another-flag) | ||
main-is: Main.hs | ||
build-depends: async, unix | ||
c-sources: executable/link.c | ||
else | ||
build-depends: async, unix | ||
c-sources: executable/link.c | ||
else | ||
main-is: ParallelMain.hs | ||
|
||
if os(windows) | ||
ghc-options: -pgml misc/static-libstdc++ | ||
|
||
default-language: Haskell2010 |