packages feed

valiant-plugin-0.1.0.0: valiant-plugin.cabal

cabal-version:   3.0
name:            valiant-plugin
version:         0.1.0.0
synopsis:        Compile-time checked SQL for Haskell, GHC source plugin
description:
  GHC source plugin that validates @queryFile@ calls at compile time
  by reading cached metadata from the @.valiant/@ directory.
license:         BSD-3-Clause
license-file:    LICENSE
author:          Josh Burgess
maintainer:      joshburgess.webdev@gmail.com
category:        Database
homepage:        https://github.com/joshburgess/valiant
bug-reports:     https://github.com/joshburgess/valiant/issues
build-type:      Simple
extra-doc-files:
  README.md
  CHANGELOG.md
tested-with:     GHC ==9.10.3

source-repository head
  type:     git
  location: https://github.com/joshburgess/valiant
  subdir:   plugin

flag werror
  description: Enable -Werror for development builds.
  default:     False
  manual:      True

common warnings
  ghc-options: -Wall -Wcompat -Wno-unticked-promoted-constructors -funbox-strict-fields -fspecialise-aggressively
  if flag(werror)
    ghc-options: -Werror

library
  import:           warnings
  hs-source-dirs:   src
  default-language: GHC2021
  default-extensions:
    DerivingStrategies
    LambdaCase
    OverloadedStrings
    RecordWildCards
    StrictData

  exposed-modules:
    Valiant.Plugin
    Valiant.Plugin.Cache
    Valiant.Plugin.Config

  -- Internal modules. Exposed only because the test suite imports a
  -- subset; treat as private and subject to change without notice.
  other-modules:
    Valiant.Plugin.Compat
    Valiant.Plugin.Errors
    Valiant.Plugin.Hash
    Valiant.Plugin.Rewrite
    Valiant.Plugin.Traverse
    Valiant.Plugin.TypeMap
    Valiant.Plugin.Verify

  build-depends:
    , base                  >=4.17    && <5
    , bytestring            >=0.11    && <0.13
    , text                  >=2.0     && <2.2
    , containers            >=0.6     && <0.8
    , filepath              >=1.4     && <1.6
    , directory             >=1.3     && <1.4
    , aeson                 >=2.1     && <2.3
    , cryptohash-sha256     >=0.11    && <0.12
    , ghc                   >=9.6     && <9.12
    , time                  >=1.12    && <1.15
    , edit-distance         >=0.2     && <0.3

test-suite valiant-plugin-test
  import:           warnings
  type:             exitcode-stdio-1.0
  hs-source-dirs:   test
  main-is:          Main.hs
  default-language: GHC2021
  default-extensions:
    OverloadedStrings

  ghc-options: -rtsopts "-with-rtsopts=-K8K"

  other-modules:
    Valiant.Plugin.ConfigSpec
    Valiant.Plugin.CacheSpec
    Valiant.Plugin.ErrorCaseSpec

  build-depends:
    , base          >=4.17 && <5
    , aeson
    , bytestring
    , directory
    , filepath
    , hspec         >=2.11 && <2.13
    , valiant-plugin
    , process       >=1.6  && <1.8
    , temporary     >=1.3  && <1.4
    , text

-- End-to-end test: compiles a module with the plugin loaded.
-- Validates that queryFile calls are rewritten and type-checked.
-- Requires: valiant prepare to have been run (cache files in ../.valiant/).
test-suite valiant-plugin-e2e
  import:           warnings
  type:             exitcode-stdio-1.0
  hs-source-dirs:   e2e
  main-is:          Main.hs
  default-language: GHC2021
  default-extensions:
    OverloadedStrings

  other-modules:
    PluginE2E

  ghc-options:
    -fplugin=Valiant.Plugin
    -fplugin-opt=Valiant.Plugin:sql-dir=../sql
    -fplugin-opt=Valiant.Plugin:cache-dir=../.valiant
    -rtsopts "-with-rtsopts=-K8K"

  build-depends:
    , base           >=4.17 && <5
    , valiant
    , valiant-plugin
    , text
    , time