Skip to content

Commit

Permalink
Merge pull request #9123 from andreabedini/andrea/remove-cabal-file
Browse files Browse the repository at this point in the history
Remove --cabal-file option
  • Loading branch information
mergify[bot] authored Dec 9, 2023
2 parents a1cbd89 + cd7b3d6 commit eeb99c9
Show file tree
Hide file tree
Showing 28 changed files with 134 additions and 35 deletions.
7 changes: 4 additions & 3 deletions cabal-install/src/Distribution/Client/NixStyleOptions.hs
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,12 @@ nixStyleOptions commandOptions showOrParseArgs =
configFlags
set1
-- Note: [Hidden Flags]
-- hide "constraint", "dependency", "promised-dependency" and
-- "exact-configuration" from the configure options.
-- We reuse the configure options from v1 commands which on their turn
-- reuse the ones from Cabal) but we hide some of them in v2 commands.
( filter
( ( `notElem`
[ "constraint"
[ "cabal-file"
, "constraint"
, "dependency"
, "promised-dependency"
, "exact-configuration"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: fail
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: [email protected]
build-type: Simple
cabal-version: 2.0

library mylib
build-depends: base
signatures: Database
exposed-modules: Mine
hs-source-dirs: mylib
default-language: Haskell2010

library mysql
build-depends: base
exposed-modules: Database.MySQL
hs-source-dirs: mysql
default-language: Haskell2010

library postgresql
build-depends: base
exposed-modules: Database.PostgreSQL
hs-source-dirs: postgresql
default-language: Haskell2010

library
build-depends: base, mysql, postgresql, mylib
mixins:
mysql (Database.MySQL as Database),
postgresql (Database.PostgreSQL as Database)
exposed-modules: App
hs-source-dirs: src
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Includes2
version: 0.1.0.0
license: BSD3
author: Edward Z. Yang
maintainer: [email protected]
build-type: Simple
cabal-version: 2.0

library mylib
build-depends: base
signatures: Database
exposed-modules: Mine
hs-source-dirs: mylib
default-language: Haskell2010

library mysql
build-depends: base
exposed-modules: Database.MySQL
hs-source-dirs: mysql
default-language: Haskell2010

library postgresql
build-depends: base
exposed-modules: Database.PostgreSQL
hs-source-dirs: postgresql
default-language: Haskell2010

library
build-depends: base, mysql, postgresql, mylib
mixins:
mylib (Mine as Mine.MySQL) requires (Database as Database.MySQL),
mylib (Mine as Mine.PostgreSQL) requires (Database as Database.PostgreSQL)
exposed-modules: App
hs-source-dirs: src
default-language: Haskell2010

executable exe
build-depends: base, Includes2
main-is: Main.hs
hs-source-dirs: exe
default-language: Haskell2010
Original file line number Diff line number Diff line change
@@ -1 +1 @@
packages: .
packages: ./Includes2
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.1"
r <- fails $ setup' "configure" ["--cabal-file", "Includes2.cabal.fail"]
r <- fails $ withDirectory "Includes2-fail" $ setup' "configure" []
assertOutputContains "mysql" r
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 8.1"
withPackageDb $ do
setup_install ["--cabal-file", "Includes2.cabal"]
-- TODO: haddock for internal method doesn't work
runExe "exe" []
withPackageDb $
withDirectory "Includes2" $ do
setup_install []
-- TODO: haddock for internal method doesn't work
runExe "exe" []
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ for Includes2-0.1.0.0...
Preprocessing library 'mylib' for Includes2-0.1.0.0...
Running Haddock on library 'mylib' instantiated with Database = <Database>
for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing internal library mylib in <PATH>
# Setup register
Expand All @@ -22,7 +22,7 @@ Building library 'mysql' for Includes2-0.1.0.0...
# Setup haddock
Preprocessing library 'mysql' for Includes2-0.1.0.0...
Running Haddock on library 'mysql' for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing internal library mysql in <PATH>
# Setup register
Expand All @@ -35,7 +35,7 @@ Building library 'postgresql' for Includes2-0.1.0.0...
# Setup haddock
Preprocessing library 'postgresql' for Includes2-0.1.0.0...
Running Haddock on library 'postgresql' for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing internal library postgresql in <PATH>
# Setup register
Expand All @@ -54,7 +54,7 @@ Preprocessing library 'mylib' for Includes2-0.1.0.0...
Running Haddock on library 'mylib' instantiated with
Database = mysql-0.1.0.0:Database.MySQL
for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing internal library mylib in <PATH>
# Setup register
Expand All @@ -75,7 +75,7 @@ Preprocessing library 'mylib' for Includes2-0.1.0.0...
Running Haddock on library 'mylib' instantiated with
Database = postgresql-0.1.0.0:Database.PostgreSQL
for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing internal library mylib in <PATH>
# Setup register
Expand All @@ -90,7 +90,7 @@ Building library for Includes2-0.1.0.0...
# Setup haddock
Preprocessing library for Includes2-0.1.0.0...
Running Haddock on library for Includes2-0.1.0.0...
Documentation created: setup-per-component.dist/work/dist/doc/html/Includes2/
Documentation created: ../setup-per-component.dist/work/Includes2/dist/doc/html/Includes2/
# Setup copy
Installing library in <PATH>
# Setup register
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ main = setupTest $ do
skipUnlessGhcVersion ">= 8.1"
ghc <- isGhcVersion "== 9.0.2 || == 9.2.* || == 9.4.* || == 9.6.*"
expectBrokenIf ghc 7987 $
withPackageDb $ do
let setup_install' args = setup_install_with_docs (["--cabal-file", "Includes2.cabal"] ++ args)
setup_install' ["mylib", "--cid", "mylib-0.1.0.0"]
setup_install' ["mysql", "--cid", "mysql-0.1.0.0"]
setup_install' ["postgresql", "--cid", "postgresql-0.1.0.0"]
setup_install' ["mylib", "--cid", "mylib-0.1.0.0",
"--instantiate-with", "Database=mysql-0.1.0.0:Database.MySQL"]
setup_install' ["mylib", "--cid", "mylib-0.1.0.0",
"--instantiate-with", "Database=postgresql-0.1.0.0:Database.PostgreSQL"]
setup_install' ["Includes2"]
setup_install' ["exe"]
runExe' "exe" [] >>= assertOutputContains "minemysql minepostgresql"
withPackageDb $
withDirectory "Includes2" $ do
let setup_install' args = setup_install_with_docs args
setup_install' ["mylib", "--cid", "mylib-0.1.0.0"]
setup_install' ["mysql", "--cid", "mysql-0.1.0.0"]
setup_install' ["postgresql", "--cid", "postgresql-0.1.0.0"]
setup_install' ["mylib", "--cid", "mylib-0.1.0.0",
"--instantiate-with", "Database=mysql-0.1.0.0:Database.MySQL"]
setup_install' ["mylib", "--cid", "mylib-0.1.0.0",
"--instantiate-with", "Database=postgresql-0.1.0.0:Database.PostgreSQL"]
setup_install' ["Includes2"]
setup_install' ["exe"]
runExe' "exe" [] >>= assertOutputContains "minemysql minepostgresql"
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ main = setupAndCabalTest $ do
withPackageDb $ do
withDirectory "containers-dupe" $
setup_install []
withDirectory "p" $ do
r <- fails $ setup' "configure" ["--cabal-file", "p.cabal.fail-ambiguous"]
withDirectory "p-fail-ambiguous" $ do
r <- fails $ setup' "configure" []
assertOutputContains "Data.Map" r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 7.9"
withDirectory "p" $ do
r <- fails $ setup' "configure" ["--cabal-file", "p.cabal.fail-missing"]
withDirectory "p-fail-missing" $ do
r <- fails $ setup' "configure" []
assertOutputContains "Missing" r
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 7.9"
withDirectory "p" $ do
r <- fails $ setup' "configure" ["--cabal-file", "p.cabal.fail-other"]
withDirectory "p-fail-other" $ do
r <- fails $ setup' "configure" []
assertOutputContains "Private" r
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ import Test.Cabal.Prelude
main = setupAndCabalTest $ do
skipUnlessGhcVersion ">= 7.9"
withPackageDb $ do
withDirectory "p" $ setup_install ["--cabal-file", "p.cabal"]
withDirectory "p" $ setup_install []
withDirectory "q" $ setup_build []
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Test.Cabal.Prelude
import Test.Cabal.Script
main = setupTest $
void $ setup'' "pkg" "configure" ["--cabal-file", "pkg/a.cabal"]
withDirectory "pkg" $
void $ setup' "configure" []
8 changes: 8 additions & 0 deletions changelog.d/pr-9123
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
synopsis: Remove --cabal-file flags from v2 commands
packages: cabal-install
prs: #9123
issues: #8395 #7225 #6880
description: {
The --cabal-file flag was never meant for public use but only for testing. To
avoid confusing the users any further we removed the flag from v2 commands.
}

0 comments on commit eeb99c9

Please sign in to comment.