From 71ee4b64c3f2fd1166971069ca2b51a67d0a9131 Mon Sep 17 00:00:00 2001 From: Oleg Grenrus Date: Tue, 12 Jun 2018 22:09:23 +0300 Subject: [PATCH] Support servant-0.14 Move to haskell-servant organisation --- .travis.yml | 26 ++++++++++++++----- cabal.make-travis-yml | 4 +++ servant-swagger-ui-core/Changelog.md | 3 +++ .../servant-swagger-ui-core.cabal | 17 ++++++------ .../src/Servant/Swagger/UI/Core.hs | 11 +++++--- .../servant-swagger-ui-example.cabal | 8 +++--- .../servant-swagger-ui-jensoleg.cabal | 13 +++++----- .../servant-swagger-ui-redoc.cabal | 13 +++++----- servant-swagger-ui/servant-swagger-ui.cabal | 13 +++++----- 9 files changed, 68 insertions(+), 40 deletions(-) create mode 100644 servant-swagger-ui-core/Changelog.md diff --git a/.travis.yml b/.travis.yml index ea394a8..276be8d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,14 +64,18 @@ install: - BENCH=${BENCH---enable-benchmarks} - TEST=${TEST---enable-tests} - HADDOCK=${HADDOCK-true} - - INSTALLED=${INSTALLED-true} + - UNCONSTRAINED=${UNCONSTRAINED-true} + - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false} - GHCHEAD=${GHCHEAD-false} - travis_retry cabal update -v - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config" - rm -fv cabal.project cabal.project.local - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$' - "printf 'packages: \"servant-swagger-ui\" \"servant-swagger-ui-core\" \"servant-swagger-ui-example\" \"servant-swagger-ui-jensoleg\" \"servant-swagger-ui-redoc\"\\n' > cabal.project" - - cat cabal.project + - touch cabal.project.local + - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" + - cat cabal.project || true + - cat cabal.project.local || true - if [ -f "servant-swagger-ui/configure.ac" ]; then (cd "servant-swagger-ui" && autoreconf -i); fi @@ -106,13 +110,13 @@ script: - cd ${DISTDIR} || false - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \; - "printf 'packages: servant-swagger-ui-*/*.cabal servant-swagger-ui-core-*/*.cabal servant-swagger-ui-example-*/*.cabal servant-swagger-ui-jensoleg-*/*.cabal servant-swagger-ui-redoc-*/*.cabal\\n' > cabal.project" - - cat cabal.project + - touch cabal.project.local + - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi" + - cat cabal.project || true + - cat cabal.project.local || true # this builds all libraries and executables (without tests/benchmarks) - cabal new-build -w ${HC} --disable-tests --disable-benchmarks all - # Build with installed constraints for packages in global-db - - if $INSTALLED; then echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks $(${HCPKG} list --global --simple-output --names-only | sed 's/\([a-zA-Z0-9-]\{1,\}\) */--constraint="\1 installed" /g') all | sh; else echo "Not building with installed constraints"; fi - # build & run tests, build benchmarks - cabal new-build -w ${HC} ${TEST} ${BENCH} all @@ -127,6 +131,12 @@ script: - rm -rf ./dist-newstyle - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi + # Build without installed constraints for packages in global-db + - if $UNCONSTRAINED; then rm -f cabal.project.local; echo cabal new-build -w ${HC} --disable-tests --disable-benchmarks all; else echo "Not building without installed constraints"; fi + + # Constraint sets + - rm -rf cabal.project.local + # Constraint set servant-0.7 - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80000 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.7.*' all; else echo skipping...; fi @@ -148,5 +158,9 @@ script: # Constraint set servant-0.13 - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80600 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.13.*' all; else echo skipping...; fi + # Constraint set servant-0.14 + - if [ $HCNUMVER -ge 70800 ] && [ $HCNUMVER -lt 80600 ]; then cabal new-build -w ${HC} --disable-tests --disable-benchmarks --constraint='servant ==0.14.*' all; else echo skipping...; fi + + # REGENDATA ["--branch","master","--output",".travis.yml","--config","cabal.project"] # EOF diff --git a/cabal.make-travis-yml b/cabal.make-travis-yml index 82be892..5a73677 100644 --- a/cabal.make-travis-yml +++ b/cabal.make-travis-yml @@ -25,3 +25,7 @@ constraint-set servant-0.12 constraint-set servant-0.13 ghc: >= 7.8 && <8.6 constraints: servant ==0.13.* + +constraint-set servant-0.14 + ghc: >= 7.8 && <8.6 + constraints: servant ==0.14.* diff --git a/servant-swagger-ui-core/Changelog.md b/servant-swagger-ui-core/Changelog.md new file mode 100644 index 0000000..239aae1 --- /dev/null +++ b/servant-swagger-ui-core/Changelog.md @@ -0,0 +1,3 @@ +# 0.3.1 + +- Support `servant-0.14` diff --git a/servant-swagger-ui-core/servant-swagger-ui-core.cabal b/servant-swagger-ui-core/servant-swagger-ui-core.cabal index 89958e3..7a68ab7 100644 --- a/servant-swagger-ui-core/servant-swagger-ui-core.cabal +++ b/servant-swagger-ui-core/servant-swagger-ui-core.cabal @@ -1,7 +1,6 @@ cabal-version: 1.12 name: servant-swagger-ui-core -version: 0.3 -x-revision: 1 +version: 0.3.1 synopsis: Servant swagger ui core components category: Web, Servant, Swagger @@ -11,18 +10,20 @@ description: See servant-swagger-ui, servant-swagger-ui-jensoleg or servant-swagger-ui-redoc for "concrete" implementations. -homepage: https://github.com/phadej/servant-swagger-ui -bug-reports: https://github.com/phadej/servant-swagger-ui/issues +homepage: https://github.com/haskell-servant/servant-swagger-ui +bug-reports: https://github.com/haskell-servant/servant-swagger-ui/issues author: Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: haskell-servant-maintainers@googlegroups.com license: BSD3 license-file: LICENSE build-type: Simple tested-with: GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.3 +extra-source-files: + Changelog.md source-repository head type: git - location: https://github.com/phadej/servant-swagger-ui + location: https://github.com/haskell-servant/servant-swagger-ui flag servant-0-5 description: Whether use servant >= 0.5 @@ -39,9 +40,9 @@ library , blaze-markup >=0.7.0.2 && <0.9 , bytestring >=0.10.4.0 && <0.11 , http-media >=0.6.2 && <0.8 - , servant >=0.4.4.5 && <0.14 + , servant >=0.4.4.5 && <0.15 , servant-blaze >=0.4.4.5 && <0.9 - , servant-server >=0.4.4.5 && <0.14 + , servant-server >=0.4.4.5 && <0.15 , swagger2 >=2.0.1 && <2.3 , text >=1.2.0.6 && <1.3 , wai-app-static >=3.0.1.1 && <3.2 diff --git a/servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hs b/servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hs index b4a081c..e48c36f 100644 --- a/servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hs +++ b/servant-swagger-ui-core/src/Servant/Swagger/UI/Core.hs @@ -100,15 +100,18 @@ type SwaggerSchemaUI' (dir :: Symbol) (api :: *) = -- to find schema file automatically. data SwaggerUiHtml (dir :: Symbol) (api :: *) = SwaggerUiHtml T.Text -#if MIN_VERSION_servant(0,10,0) -#define LINK Link +#if MIN_VERSION_servant(0,14,0) +#define LINK Link ~ MkLink api Link +#define LINKPATH uriPath . linkURI +#elif MIN_VERSION_servant(0,10,0) +#define LINK Link ~ MkLink api #define LINKPATH uriPath . linkURI #else -#define LINK URI +#define LINK URI ~ MkLink api #define LINKPATH uriPath #endif -instance (KnownSymbol dir, HasLink api, LINK ~ MkLink api, IsElem api api) +instance (KnownSymbol dir, HasLink api, LINK, IsElem api api) => ToMarkup (SwaggerUiHtml dir api) where toMarkup (SwaggerUiHtml template) = preEscapedToMarkup diff --git a/servant-swagger-ui-example/servant-swagger-ui-example.cabal b/servant-swagger-ui-example/servant-swagger-ui-example.cabal index 7430727..28ba102 100644 --- a/servant-swagger-ui-example/servant-swagger-ui-example.cabal +++ b/servant-swagger-ui-example/servant-swagger-ui-example.cabal @@ -7,10 +7,10 @@ category: Web, Servant, Swagger description: A kind of test-suite of servant-swagger-ui -homepage: https://github.com/phadej/servant-swagger-ui -bug-reports: https://github.com/phadej/servant-swagger-ui/issues +homepage: https://github.com/haskell-servant/servant-swagger-ui +bug-reports: https://github.com/haskell-servant/servant-swagger-ui/issues author: Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: haskell-servant-maintainers@googlegroups.com license: BSD3 license-file: LICENSE build-type: Simple @@ -18,7 +18,7 @@ tested-with: GHC ==7.8.4 || ==7.10.3 || ==8.0.2 || ==8.2.2 || ==8.4.3 source-repository head type: git - location: https://github.com/phadej/servant-swagger-ui + location: https://github.com/haskell-servant/servant-swagger-ui executable servant-swagger-ui-example main-is: Main.hs diff --git a/servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabal b/servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabal index b1e63df..c66fbbf 100644 --- a/servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabal +++ b/servant-swagger-ui-jensoleg/servant-swagger-ui-jensoleg.cabal @@ -1,6 +1,7 @@ cabal-version: 1.12 name: servant-swagger-ui-jensoleg version: 0.3 +x-revision: 1 synopsis: Servant swagger ui: Jens-Ole Graulund theme category: Web, Servant, Swagger @@ -9,10 +10,10 @@ description: . Jsn-Ole Graulund theme https://github.com/jensoleg/swagger-org -homepage: https://github.com/phadej/servant-swagger-ui -bug-reports: https://github.com/phadej/servant-swagger-ui/issues +homepage: https://github.com/haskell-servant/servant-swagger-ui +bug-reports: https://github.com/haskell-servant/servant-swagger-ui/issues author: Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: haskell-servant-maintainers@googlegroups.com license: BSD3 license-file: LICENSE build-type: Simple @@ -71,7 +72,7 @@ extra-source-files: source-repository head type: git - location: https://github.com/phadej/servant-swagger-ui + location: https://github.com/haskell-servant/servant-swagger-ui library hs-source-dirs: @@ -85,8 +86,8 @@ library base >=4.7 && <4.12 , bytestring >=0.10.4.0 && <0.11 , file-embed-lzma >=0 && <0.1 - , servant >=0.4.4.5 && <0.14 - , servant-server >=0.4.4.5 && <0.14 + , servant >=0.4.4.5 && <0.15 + , servant-server >=0.4.4.5 && <0.15 , swagger2 >=2.0.1 && <2.3 , text >=1.2.0.6 && <1.3 exposed-modules: diff --git a/servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabal b/servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabal index eb86e9c..18493c0 100644 --- a/servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabal +++ b/servant-swagger-ui-redoc/servant-swagger-ui-redoc.cabal @@ -1,6 +1,7 @@ cabal-version: 1.12 name: servant-swagger-ui-redoc version: 0.3.0.1.21.2 +x-revision: 1 synopsis: Servant swagger ui: ReDoc theme category: Web, Servant, Swagger @@ -9,10 +10,10 @@ description: . ReDoc theme: https://github.com/Rebilly/ReDoc -homepage: https://github.com/phadej/servant-swagger-ui -bug-reports: https://github.com/phadej/servant-swagger-ui/issues +homepage: https://github.com/haskell-servant/servant-swagger-ui +bug-reports: https://github.com/haskell-servant/servant-swagger-ui/issues author: Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: haskell-servant-maintainers@googlegroups.com license: BSD3 license-file: LICENSE build-type: Simple @@ -24,7 +25,7 @@ extra-source-files: source-repository head type: git - location: https://github.com/phadej/servant-swagger-ui + location: https://github.com/haskell-servant/servant-swagger-ui library hs-source-dirs: @@ -38,8 +39,8 @@ library base >=4.7 && <4.12 , bytestring >=0.10.4.0 && <0.11 , file-embed-lzma >=0 && <0.1 - , servant >=0.4.4.5 && <0.14 - , servant-server >=0.4.4.5 && <0.14 + , servant >=0.4.4.5 && <0.15 + , servant-server >=0.4.4.5 && <0.15 , swagger2 >=2.0.1 && <2.3 , text >=1.2.0.6 && <1.3 exposed-modules: diff --git a/servant-swagger-ui/servant-swagger-ui.cabal b/servant-swagger-ui/servant-swagger-ui.cabal index 4ef2288..b7e2219 100644 --- a/servant-swagger-ui/servant-swagger-ui.cabal +++ b/servant-swagger-ui/servant-swagger-ui.cabal @@ -1,15 +1,16 @@ cabal-version: 1.12 name: servant-swagger-ui version: 0.3.0.3.13.2 +x-revision: 1 synopsis: Servant swagger ui category: Web, Servant, Swagger description: Provide embedded swagger UI for servant and swagger (i.e. servant-swagger) -homepage: https://github.com/phadej/servant-swagger-ui -bug-reports: https://github.com/phadej/servant-swagger-ui/issues +homepage: https://github.com/haskell-servant/servant-swagger-ui +bug-reports: https://github.com/haskell-servant/servant-swagger-ui/issues author: Oleg Grenrus -maintainer: Oleg Grenrus +maintainer: haskell-servant-maintainers@googlegroups.com license: BSD3 license-file: LICENSE build-type: Simple @@ -28,7 +29,7 @@ extra-source-files: source-repository head type: git - location: https://github.com/phadej/servant-swagger-ui + location: https://github.com/haskell-servant/servant-swagger-ui library hs-source-dirs: @@ -42,8 +43,8 @@ library base >=4.7 && <4.12 , bytestring >=0.10.4.0 && <0.11 , file-embed-lzma >=0 && <0.1 - , servant >=0.4.4.5 && <0.14 - , servant-server >=0.4.4.5 && <0.14 + , servant >=0.4.4.5 && <0.15 + , servant-server >=0.4.4.5 && <0.15 , swagger2 >=2.0.1 && <2.3 , text >=1.2.0.6 && <1.3 exposed-modules: