aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cabal-helper.cabal169
-rw-r--r--scripts/update-cabal-common-section-instantiations.awk34
2 files changed, 32 insertions, 171 deletions
diff --git a/cabal-helper.cabal b/cabal-helper.cabal
index ba312e8..2727307 100644
--- a/cabal-helper.cabal
+++ b/cabal-helper.cabal
@@ -67,44 +67,7 @@ flag dev
manual: True
--- [Note test dependencies] Vaious tests need access to modules used in other
--- components, unfortunately we can't use Cabal 2.2's new common stanzas for
--- this because we'd like to support Cabal-2.0 for a while still. Instead we
--- just copy 'hs-source-dirs', 'build-depends' and 'other-modules' fields using
--- an awk script as appropriate.
---
--- The following awk command will copy paragraphs starting with:
--- -- Common <some-name>
--- to following paragraphs starting with:
--- -- Instantiate common <some-name>
---
--- $ gawk -i inplace -f scripts/update-cabal-common-section-instantiations.awk cabal-helper.cabal
-
-library c-h-internal
- exposed-modules:
- CabalHelper.Compiletime.Cabal
- CabalHelper.Compiletime.Compat.Environment
- CabalHelper.Compiletime.Compat.ProgramDb
- CabalHelper.Compiletime.Compat.Version
- CabalHelper.Compiletime.Compile
- CabalHelper.Compiletime.Data
- CabalHelper.Compiletime.Log
- CabalHelper.Compiletime.Process
- CabalHelper.Compiletime.Program.CabalInstall
- CabalHelper.Compiletime.Program.Stack
- CabalHelper.Compiletime.Program.GHC
- CabalHelper.Compiletime.Types
- CabalHelper.Compiletime.Types.RelativePath
- CabalHelper.Shared.Common
- CabalHelper.Shared.InterfaceTypes
- CabalHelper.Shared.Sandbox
- other-modules:
- Paths_cabal_helper
- autogen-modules:
- Paths_cabal_helper
- hs-source-dirs: src
-
- -- Common c-h-internal -- See [Note test dependencies]
+common extensions
default-language: Haskell2010
default-extensions: NondecreasingIndentation
ImplicitParams
@@ -112,6 +75,8 @@ library c-h-internal
FlexibleContexts
ConstraintKinds
other-extensions: TemplateHaskell
+
+common build-deps
build-depends: base < 5 && >= 4.8
, Cabal < 2.5 && >= 2.0 || < 1.26 && >= 1.14
, cabal-plan < 0.5 && >= 0.3.0.0
@@ -122,6 +87,7 @@ library c-h-internal
, mtl < 2.3 && >= 2.0
, process < 1.7 && >= 1.2.3.0
, pretty-show < 1.9 && >= 1.8.1
+ , semigroups < 0.19 && >= 0.18
, semigroupoids < 5.4 && >= 5.2
, SHA < 1.7 && >= 1.6.4.4
, text < 1.3 && >= 1.0.0.0
@@ -136,8 +102,33 @@ library c-h-internal
ghc-options: -Wall
+library c-h-internal
+ import: build-deps, extensions
+ exposed-modules:
+ CabalHelper.Compiletime.Cabal
+ CabalHelper.Compiletime.Compat.Environment
+ CabalHelper.Compiletime.Compat.ProgramDb
+ CabalHelper.Compiletime.Compat.Version
+ CabalHelper.Compiletime.Compile
+ CabalHelper.Compiletime.Data
+ CabalHelper.Compiletime.Log
+ CabalHelper.Compiletime.Process
+ CabalHelper.Compiletime.Program.CabalInstall
+ CabalHelper.Compiletime.Program.Stack
+ CabalHelper.Compiletime.Program.GHC
+ CabalHelper.Compiletime.Types
+ CabalHelper.Compiletime.Types.RelativePath
+ CabalHelper.Shared.Common
+ CabalHelper.Shared.InterfaceTypes
+ CabalHelper.Shared.Sandbox
+ other-modules:
+ Paths_cabal_helper
+ autogen-modules:
+ Paths_cabal_helper
+ hs-source-dirs: src
library
+ import: build-deps, extensions
exposed-modules: Distribution.Helper
other-modules:
Paths_cabal_helper
@@ -145,121 +136,25 @@ library
Paths_cabal_helper
hs-source-dirs: lib
build-depends: c-h-internal
- -- Instantiate common c-h-internal -- See [Note test dependencies]
- default-language: Haskell2010
- default-extensions: NondecreasingIndentation
- ImplicitParams
- NamedFieldPuns RecordWildCards
- FlexibleContexts
- ConstraintKinds
- other-extensions: TemplateHaskell
- build-depends: base < 5 && >= 4.8
- , Cabal < 2.5 && >= 2.0 || < 1.26 && >= 1.14
- , cabal-plan < 0.5 && >= 0.3.0.0
- , containers < 1 && >= 0.5.5.1
- , bytestring < 0.11 && >= 0.9.2.1
- , directory < 1.4 && >= 1.2.1.0
- , filepath < 1.5 && >= 1.3.0.0
- , mtl < 2.3 && >= 2.0
- , process < 1.7 && >= 1.2.3.0
- , pretty-show < 1.9 && >= 1.8.1
- , semigroupoids < 5.4 && >= 5.2
- , SHA < 1.7 && >= 1.6.4.4
- , text < 1.3 && >= 1.0.0.0
- , template-haskell < 2.15 && >= 2.7.0.0
- , temporary < 1.3 && >= 1.2.1
- , transformers < 0.6 && >= 0.3.0.0
- if !os(windows)
- build-depends: unix < 2.8 && >= 2.5.1.1
- build-depends: unix-compat < 0.6 && >= 0.4.3.1
- , utf8-string < 1.1 && >= 1.0.1.1
- if flag(dev)
- ghc-options: -Wall
-
-
test-suite compile-test
+ import: build-deps, extensions
type: exitcode-stdio-1.0
main-is: CompileTest.hs
hs-source-dirs: tests
ghc-options: -Wall
build-depends: c-h-internal
- -- Instantiate common c-h-internal -- See [Note test dependencies]
- default-language: Haskell2010
- default-extensions: NondecreasingIndentation
- ImplicitParams
- NamedFieldPuns RecordWildCards
- FlexibleContexts
- ConstraintKinds
- other-extensions: TemplateHaskell
- build-depends: base < 5 && >= 4.8
- , Cabal < 2.5 && >= 2.0 || < 1.26 && >= 1.14
- , cabal-plan < 0.5 && >= 0.3.0.0
- , containers < 1 && >= 0.5.5.1
- , bytestring < 0.11 && >= 0.9.2.1
- , directory < 1.4 && >= 1.2.1.0
- , filepath < 1.5 && >= 1.3.0.0
- , mtl < 2.3 && >= 2.0
- , process < 1.7 && >= 1.2.3.0
- , pretty-show < 1.9 && >= 1.8.1
- , semigroupoids < 5.4 && >= 5.2
- , SHA < 1.7 && >= 1.6.4.4
- , text < 1.3 && >= 1.0.0.0
- , template-haskell < 2.15 && >= 2.7.0.0
- , temporary < 1.3 && >= 1.2.1
- , transformers < 0.6 && >= 0.3.0.0
- if !os(windows)
- build-depends: unix < 2.8 && >= 2.5.1.1
- build-depends: unix-compat < 0.6 && >= 0.4.3.1
- , utf8-string < 1.1 && >= 1.0.1.1
- if flag(dev)
- ghc-options: -Wall
-
-
test-suite ghc-session
+ import: build-deps, extensions
type: exitcode-stdio-1.0
main-is: GhcSession.hs
hs-source-dirs: tests
ghc-options: -Wall
- build-depends: base < 5 && >= 4.8
- , ghc < 8.7 && >= 7.10
+ build-depends: ghc < 8.7 && >= 7.10
, ghc-paths < 0.2 && >= 0.1.0.9
, cabal-helper
, c-h-internal
- -- Instantiate common c-h-internal -- See [Note test dependencies]
- default-language: Haskell2010
- default-extensions: NondecreasingIndentation
- ImplicitParams
- NamedFieldPuns RecordWildCards
- FlexibleContexts
- ConstraintKinds
- other-extensions: TemplateHaskell
- build-depends: base < 5 && >= 4.8
- , Cabal < 2.5 && >= 2.0 || < 1.26 && >= 1.14
- , cabal-plan < 0.5 && >= 0.3.0.0
- , containers < 1 && >= 0.5.5.1
- , bytestring < 0.11 && >= 0.9.2.1
- , directory < 1.4 && >= 1.2.1.0
- , filepath < 1.5 && >= 1.3.0.0
- , mtl < 2.3 && >= 2.0
- , process < 1.7 && >= 1.2.3.0
- , pretty-show < 1.9 && >= 1.8.1
- , semigroupoids < 5.4 && >= 5.2
- , SHA < 1.7 && >= 1.6.4.4
- , text < 1.3 && >= 1.0.0.0
- , template-haskell < 2.15 && >= 2.7.0.0
- , temporary < 1.3 && >= 1.2.1
- , transformers < 0.6 && >= 0.3.0.0
- if !os(windows)
- build-depends: unix < 2.8 && >= 2.5.1.1
- build-depends: unix-compat < 0.6 && >= 0.4.3.1
- , utf8-string < 1.1 && >= 1.0.1.1
- if flag(dev)
- ghc-options: -Wall
-
-
-
executable cabal-helper-main
default-language: Haskell2010
diff --git a/scripts/update-cabal-common-section-instantiations.awk b/scripts/update-cabal-common-section-instantiations.awk
deleted file mode 100644
index 0bfacae..0000000
--- a/scripts/update-cabal-common-section-instantiations.awk
+++ /dev/null
@@ -1,34 +0,0 @@
-BEGIN {
- delete sections;
- section="";
- ignoring=0;
-}
-
-/^[[:space:]]*$/ {
- section="";
- ignoring=0;
-}
-
-{
- if(section) {
- tmp = sections[section];
- sections[section] = tmp (tmp ? RS : "") $0;
- }
-}
-
-/^[[:space:]]*-- *Common/ {
- section = $3
-}
-
-/^[[:space:]]*-- *Instantiate *common/ {
- ignoring=1
-
- print $0;
- print sections[$4];
-}
-
-{
- if(!ignoring) {
- print $0;
- }
-}