-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Guard PackageInfo behind
cabal-version
≥ 3.12 (#9481)
* Add `cabal-version` 3.12 * Add test for #9331 - `cabal check`: Guard Paths_* behind `cabal-version: 3.12` or higher, “fail” and “succeed” tests. - `cabal build`: Guard Paths_* behind `cabal-version: 3.12` or higher, “fail” test. * Guard PackageInfo behind cabal-version ≥ 3.12 --------- Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
- Loading branch information
1 parent
e3fd74c
commit f3eafa7
Showing
30 changed files
with
149 additions
and
28 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
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
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/AutogenModules/SrcDist/AutogenModules.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
10 changes: 10 additions & 0 deletions
10
cabal-testsuite/PackageTests/BuildAutogenPackageGuard/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,10 @@ | ||
# cabal v2-build | ||
Resolving dependencies... | ||
Build profile: -w ghc-<GHCVER> -O1 | ||
In order, the following will be built: | ||
- pkg-0 (lib) (first run) | ||
Configuring library for pkg-0... | ||
Error: [Cabal-5559] | ||
To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. | ||
Error: [Cabal-7125] | ||
Failed to build pkg-0-inplace. The failure occurred during the configure step. |
2 changes: 2 additions & 0 deletions
2
cabal-testsuite/PackageTests/BuildAutogenPackageGuard/cabal.project
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 @@ | ||
packages: . | ||
|
8 changes: 8 additions & 0 deletions
8
cabal-testsuite/PackageTests/BuildAutogenPackageGuard/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,8 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- #9331, guard PackageInfo functionality behind 3.12: make it a | ||
-- build failure. | ||
main = cabalTest $ do | ||
withProjectFile "cabal.project" $ do | ||
fails $ cabal "v2-build" ["pkg"] | ||
|
17 changes: 17 additions & 0 deletions
17
cabal-testsuite/PackageTests/BuildAutogenPackageGuard/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,17 @@ | ||
cabal-version: 2.4 | ||
name: pkg | ||
version: 0 | ||
license: GPL-3.0-or-later | ||
maintainer: Someone | ||
category: Example | ||
synopsis: Foo | ||
description: FooBar | ||
build-type: Simple | ||
|
||
library | ||
default-language: Haskell2010 | ||
build-depends: base == 4.* | ||
-- ☞ N.B.: PackageInfo packages must contain the same name of | ||
-- of the package! (In this example: `pkg`). | ||
autogen-modules: PackageInfo_pkg | ||
exposed-modules: PackageInfo_pkg |
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/Check/ConfiguredPackage/CabalVersion/AutoGenMods/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 |
---|---|---|
@@ -1,12 +1,12 @@ | ||
cabal-version: 2.0 | ||
cabal-version: 3.12 | ||
build-type: Simple | ||
name: pkg | ||
synopsis: synopsis | ||
description: description | ||
version: 0 | ||
category: example | ||
maintainer: [email protected] | ||
license: GPL-3 | ||
license: GPL-3.0-or-later | ||
license-file: LICENSE | ||
|
||
library | ||
|
4 changes: 4 additions & 0 deletions
4
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersion/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,4 @@ | ||
# cabal check | ||
The package will not build sanely due to these errors: | ||
Error: To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. | ||
Error: Hackage would reject this package. |
6 changes: 6 additions & 0 deletions
6
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersion/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,6 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- #9331: PackageInfo functionality should be guarded by cabal-version. | ||
main = cabalTest $ | ||
fails $ cabal "check" [] | ||
|
16 changes: 16 additions & 0 deletions
16
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersion/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,16 @@ | ||
cabal-version: 2.4 | ||
name: pkg | ||
version: 0 | ||
license: GPL-3.0-or-later | ||
maintainer: Someone | ||
category: Example | ||
synopsis: Foo | ||
description: FooBar | ||
build-type: Simple | ||
|
||
library | ||
default-language: Haskell2010 | ||
build-depends: base <5 | ||
autogen-modules: PackageInfo_pkg | ||
exposed-modules: PackageInfo_pkg | ||
|
2 changes: 2 additions & 0 deletions
2
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersionOk/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,2 @@ | ||
# cabal check | ||
No errors or warnings could be found in the package. |
7 changes: 7 additions & 0 deletions
7
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersionOk/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,7 @@ | ||
import Test.Cabal.Prelude | ||
|
||
-- #9331: PackageInfo functionality should be guarded by cabal-version, | ||
-- does not error when cabal-version is 3.12 or higher. | ||
main = cabalTest $ | ||
cabal "check" [] | ||
|
16 changes: 16 additions & 0 deletions
16
cabal-testsuite/PackageTests/Check/ConfiguredPackage/Sanity/AutogenVersionOk/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,16 @@ | ||
cabal-version: 3.12 | ||
name: pkg | ||
version: 0 | ||
license: GPL-3.0-or-later | ||
maintainer: Someone | ||
category: Example | ||
synopsis: Foo | ||
description: FooBar | ||
build-type: Simple | ||
|
||
library | ||
default-language: Haskell2010 | ||
build-depends: base <5 | ||
autogen-modules: PackageInfo_pkg | ||
exposed-modules: PackageInfo_pkg | ||
|
1 change: 1 addition & 0 deletions
1
cabal-testsuite/PackageTests/Check/NonConfCheck/PathsExtensions/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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# cabal check | ||
The package will not build sanely due to these errors: | ||
Error: To use the autogenerated module PackageInfo_* you need to specify `cabal-version: 3.12` or higher. | ||
Error: Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module Paths_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a Paths_* autogen module, specify at least 'cabal-version: 2.2'. | ||
Error: Packages using RebindableSyntax with OverloadedStrings or OverloadedLists in default-extensions, in conjunction with the autogenerated module PackageInfo_*, are known to cause compile failures with Cabal < 2.2. To use these default-extensions with a PackageInfo_* autogen module, specify at least 'cabal-version: 2.2'. | ||
Error: Hackage would reject this package. |
2 changes: 1 addition & 1 deletion
2
cabal-testsuite/PackageTests/NewBuild/CmdRun/Datafiles/foo/foo.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
2 changes: 1 addition & 1 deletion
2
cabal-testsuite/PackageTests/NewBuild/T5164/setup-lib/setup-lib.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
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/PackageInfoModule/Executable/my.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
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/PackageInfoModule/ImportQualifiedPost/my.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
2 changes: 1 addition & 1 deletion
2
cabal-testsuite/PackageTests/PackageInfoModule/Library/my.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Cabal-version: 2.2 | ||
Cabal-version: 3.12 | ||
name: PackageInfoModule | ||
version: 0.1 | ||
license: BSD-3-Clause | ||
|
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/PathsModule/Executable-Relocatable/my.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
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
4 changes: 2 additions & 2 deletions
4
cabal-testsuite/PackageTests/PathsModule/ImportQualifiedPost/my.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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
Cabal-version: 2.2 | ||
Cabal-version: 3.12 | ||
name: PathsModule | ||
version: 0.1 | ||
license: BSD-3-Clause | ||
|
2 changes: 1 addition & 1 deletion
2
cabal-testsuite/PackageTests/PathsModule/MissingSafeHaskellMode/my.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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
cabal-version: 2.2 | ||
cabal-version: 3.12 | ||
name: PathsModule | ||
version: 0.1 | ||
license: BSD-3-Clause | ||
|
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,13 @@ | ||
synopsis: Guard PackageInfo_* modules behind `cabal-version` ≥ 3.12 | ||
packages: Cabal cabal-install | ||
prs: #9481 | ||
issues: #9331 | ||
|
||
description: { | ||
|
||
`cabal check` now warns whenever PackageInfo_* autogen modules are | ||
used with `cabal-version` ≥ 3.12. | ||
Additionally, `cabal configure` will fail if you try to use PackageInfo_* | ||
with `cabal-version` < 3.12. | ||
|
||
} |