mirror of
https://github.com/ilyakooo0/elm-bridge.git
synced 2024-10-03 16:57:10 +03:00
Version 0.7.0
Support for GHC 9.0
This commit is contained in:
parent
28400342b1
commit
e40e3997f8
157
.travis.yml
157
.travis.yml
@ -2,19 +2,26 @@
|
||||
#
|
||||
# haskell-ci 'elm-bridge.cabal' '--output' '.travis.yml'
|
||||
#
|
||||
# To regenerate the script (for example after adjusting tested-with) run
|
||||
#
|
||||
# haskell-ci regenerate
|
||||
#
|
||||
# For more information, see https://github.com/haskell-CI/haskell-ci
|
||||
#
|
||||
# version: 0.13.20210806
|
||||
#
|
||||
version: ~> 1.0
|
||||
language: c
|
||||
dist: xenial
|
||||
|
||||
os: linux
|
||||
dist: bionic
|
||||
git:
|
||||
submodules: false # whether to recursively clone submodules
|
||||
|
||||
# whether to recursively clone submodules
|
||||
submodules: false
|
||||
cache:
|
||||
directories:
|
||||
- $HOME/.cabal/packages
|
||||
- $HOME/.cabal/store
|
||||
|
||||
- $HOME/.hlint
|
||||
before_cache:
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
|
||||
# remove files that are regenerated by 'cabal update'
|
||||
@ -23,88 +30,108 @@ before_cache:
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
|
||||
- rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
|
||||
|
||||
- rm -rfv $CABALHOME/packages/head.hackage
|
||||
|
||||
matrix:
|
||||
jobs:
|
||||
include:
|
||||
- compiler: "ghc-8.4.1"
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.1], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.2.2"
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.2.2], sources: [hvr-ghc]}}
|
||||
- compiler: "ghc-8.0.2"
|
||||
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.0.2], sources: [hvr-ghc]}}
|
||||
|
||||
- compiler: ghc-9.0.1
|
||||
addons: {"apt":{"packages":["ghc-9.0.1","cabal-install-3.4"],"sources":[{"key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286","sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu bionic main"}]}}
|
||||
os: linux
|
||||
before_install:
|
||||
- HC=/opt/ghc/bin/${CC}
|
||||
- HCPKG=${HC/ghc/ghc-pkg}
|
||||
- HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
|
||||
- WITHCOMPILER="-w $HC"
|
||||
- HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
|
||||
- HCPKG="$HC-pkg"
|
||||
- unset CC
|
||||
- CABAL=/opt/ghc/bin/cabal
|
||||
- CABALHOME=$HOME/.cabal
|
||||
- export PATH="$CABALHOME/bin:$PATH"
|
||||
- ROOTDIR=$(pwd)
|
||||
- HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))
|
||||
- TOP=$(pwd)
|
||||
- "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
|
||||
- echo $HCNUMVER
|
||||
|
||||
- CABAL="$CABAL -vnormal+nowrap"
|
||||
- set -o pipefail
|
||||
- TEST=--enable-tests
|
||||
- BENCH=--enable-benchmarks
|
||||
- HEADHACKAGE=false
|
||||
- rm -f $CABALHOME/config
|
||||
- |
|
||||
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
|
||||
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
|
||||
echo "write-ghc-environment-files: never" >> $CABALHOME/config
|
||||
echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
|
||||
echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
|
||||
echo "world-file: $CABALHOME/world" >> $CABALHOME/config
|
||||
echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
|
||||
echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
|
||||
echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
|
||||
echo "install-dirs user" >> $CABALHOME/config
|
||||
echo " prefix: $CABALHOME" >> $CABALHOME/config
|
||||
echo "repository hackage.haskell.org" >> $CABALHOME/config
|
||||
echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
|
||||
install:
|
||||
- ${CABAL} --version
|
||||
- echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
|
||||
- TEST=--enable-tests
|
||||
- BENCH=--enable-benchmarks
|
||||
- GHCHEAD=${GHCHEAD-false}
|
||||
- travis_retry ${CABAL} update -v
|
||||
- sed -i.bak 's/^jobs:/-- jobs:/' $CABALHOME/config
|
||||
- rm -fv cabal.project cabal.project.local
|
||||
- grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'
|
||||
- rm -f cabal.project
|
||||
- |
|
||||
echo "program-default-options" >> $CABALHOME/config
|
||||
echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
|
||||
- cat $CABALHOME/config
|
||||
- rm -fv cabal.project cabal.project.local cabal.project.freeze
|
||||
- travis_retry ${CABAL} v2-update -v
|
||||
# Generate cabal.project
|
||||
- rm -rf cabal.project cabal.project.local cabal.project.freeze
|
||||
- touch cabal.project
|
||||
- "printf 'packages: \".\"\\n' >> cabal.project"
|
||||
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
|
||||
- touch cabal.project.local
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(elm-bridge)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- |
|
||||
echo "packages: ." >> cabal.project
|
||||
- echo 'package elm-bridge' >> cabal.project
|
||||
- "echo ' ghc-options: -Werror=missing-methods' >> cabal.project"
|
||||
- ""
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(elm-bridge)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
- if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
|
||||
- rm -f cabal.project.freeze
|
||||
- ${CABAL} new-freeze -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dry
|
||||
- "cat \"cabal.project.freeze\" | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||
- rm "cabal.project.freeze"
|
||||
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all
|
||||
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks --project-file="cabal.project" --dep -j2 all
|
||||
- rm -rf .ghc.environment.* "."/dist
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
|
||||
# Here starts the actual work to be performed for the package under test;
|
||||
# any command which exits with a non-zero exit code causes the build to fail.
|
||||
- ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH}
|
||||
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
|
||||
- rm cabal.project.freeze
|
||||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all
|
||||
- travis_wait 40 ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all
|
||||
script:
|
||||
# test that source-distributions can be generated
|
||||
- ${CABAL} new-sdist all
|
||||
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
|
||||
# Packaging...
|
||||
- ${CABAL} v2-sdist all
|
||||
# Unpacking...
|
||||
- mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
|
||||
- cd ${DISTDIR} || false
|
||||
- find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;
|
||||
- rm -f cabal.project
|
||||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
|
||||
- find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
|
||||
- PKGDIR_elm_bridge="$(find . -maxdepth 1 -type d -regex '.*/elm-bridge-[0-9.]*')"
|
||||
# Generate cabal.project
|
||||
- rm -rf cabal.project cabal.project.local cabal.project.freeze
|
||||
- touch cabal.project
|
||||
- "printf 'packages: \"elm-bridge-*/*.cabal\"\\n' >> cabal.project"
|
||||
- "printf 'write-ghc-environment-files: always\\n' >> cabal.project"
|
||||
- touch cabal.project.local
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | grep -vE -- '^(elm-bridge)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- |
|
||||
echo "packages: ${PKGDIR_elm_bridge}" >> cabal.project
|
||||
- echo 'package elm-bridge' >> cabal.project
|
||||
- "echo ' ghc-options: -Werror=missing-methods' >> cabal.project"
|
||||
- ""
|
||||
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(elm-bridge)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
|
||||
- cat cabal.project || true
|
||||
- cat cabal.project.local || true
|
||||
# Building...
|
||||
# this builds all libraries and executables (without tests/benchmarks)
|
||||
- ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all
|
||||
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
|
||||
# Building with tests and benchmarks...
|
||||
# build & run tests, build benchmarks
|
||||
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all
|
||||
- if [ "x$TEST" = "x--enable-tests" ]; then ${CABAL} new-test -w ${HC} ${TEST} ${BENCH} all; fi
|
||||
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all --write-ghc-environment-files=always
|
||||
# Testing...
|
||||
- ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all --test-show-details=direct
|
||||
# cabal check...
|
||||
- (cd ${PKGDIR_elm_bridge} && ${CABAL} -vnormal check)
|
||||
# haddock...
|
||||
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all
|
||||
# Building without installed constraints for packages in global-db...
|
||||
- rm -f cabal.project.local
|
||||
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all
|
||||
|
||||
# cabal check
|
||||
- (cd elm-bridge-* && ${CABAL} check)
|
||||
|
||||
# haddock
|
||||
- ${CABAL} new-haddock -w ${HC} ${TEST} ${BENCH} all
|
||||
|
||||
# Build without installed constraints for packages in global-db
|
||||
- rm -f cabal.project.local; ${CABAL} new-build -w ${HC} --disable-tests --disable-benchmarks all;
|
||||
|
||||
# REGENDATA ["elm-bridge.cabal","--output",".travis.yml"]
|
||||
# REGENDATA ("0.13.20210806",["elm-bridge.cabal","--output",".travis.yml"])
|
||||
# EOF
|
||||
|
@ -1,3 +1,7 @@
|
||||
# v0.7.0
|
||||
|
||||
* Support for GHC 9
|
||||
|
||||
# v0.6.0
|
||||
|
||||
* Support for Elm 0.19
|
||||
|
@ -1,5 +1,5 @@
|
||||
name: elm-bridge
|
||||
version: 0.6.1
|
||||
version: 0.7.0
|
||||
synopsis: Derive Elm types and Json code from Haskell types, using aeson's options
|
||||
description: Building the bridge from Haskell to Elm and back. Define types once,
|
||||
and derive the aeson and elm functions at the same time, using any aeson
|
||||
@ -13,7 +13,7 @@ copyright: (c) 2015 - 2016 Alexander Thiemann and contributors
|
||||
category: Web, Compiler, Language
|
||||
build-type: Simple
|
||||
cabal-version: >=1.10
|
||||
tested-with: GHC==8.4.1, GHC==8.2.2, GHC==8.0.2
|
||||
tested-with: GHC==9.0.1
|
||||
|
||||
extra-source-files:
|
||||
README.md
|
||||
@ -32,7 +32,7 @@ library
|
||||
Elm.TyRep
|
||||
Elm.Versions
|
||||
other-modules: Elm.Utils
|
||||
build-depends: base >= 4.9 && < 5,
|
||||
build-depends: base >= 4.15 && < 5,
|
||||
template-haskell,
|
||||
aeson >= 1
|
||||
default-language: Haskell2010
|
||||
|
@ -94,7 +94,7 @@ optSumType se =
|
||||
TaggedObject tn cn -> [|SumEncoding' (TaggedObject tn cn)|]
|
||||
UntaggedValue -> [|SumEncoding' UntaggedValue|]
|
||||
|
||||
runDerive :: Name -> [TyVarBndr] -> (Q Exp -> Q Exp) -> Q [Dec]
|
||||
runDerive :: Name -> [TyVarBndr ()] -> (Q Exp -> Q Exp) -> Q [Dec]
|
||||
runDerive name vars mkBody =
|
||||
liftM (:[]) elmDefInst
|
||||
where
|
||||
@ -122,10 +122,10 @@ runDerive name vars mkBody =
|
||||
argNames =
|
||||
flip map vars $ \v ->
|
||||
case v of
|
||||
PlainTV tv -> tv
|
||||
KindedTV tv _ -> tv
|
||||
PlainTV tv _ -> tv
|
||||
KindedTV tv _ _ -> tv
|
||||
|
||||
deriveAlias :: Bool -> A.Options -> Name -> [TyVarBndr] -> [VarStrictType] -> Q [Dec]
|
||||
deriveAlias :: Bool -> A.Options -> Name -> [TyVarBndr ()] -> [VarStrictType] -> Q [Dec]
|
||||
deriveAlias isNewtype opts name vars conFields =
|
||||
runDerive name vars $ \typeName ->
|
||||
[|ETypeAlias (EAlias $typeName $fields omitNothing isNewtype unwrapUnary)|] -- default to no newtype
|
||||
@ -140,7 +140,7 @@ deriveAlias isNewtype opts name vars conFields =
|
||||
fldName = A.fieldLabelModifier opts $ nameBase fname
|
||||
fldType = compileType ftype
|
||||
|
||||
deriveSum :: A.Options -> Name -> [TyVarBndr] -> [Con] -> Q [Dec]
|
||||
deriveSum :: A.Options -> Name -> [TyVarBndr ()] -> [Con] -> Q [Dec]
|
||||
deriveSum opts name vars constrs =
|
||||
runDerive name vars $ \typeName ->
|
||||
[|ETypeSum (ESum $typeName $sumOpts $sumEncOpts omitNothing allNullary)|]
|
||||
@ -164,7 +164,7 @@ deriveSum opts name vars constrs =
|
||||
in [|STC b n (Named $tyArgs)|]
|
||||
_ -> fail ("Can't derive this sum: " ++ show c)
|
||||
|
||||
deriveSynonym :: A.Options -> Name -> [TyVarBndr] -> Type -> Q [Dec]
|
||||
deriveSynonym :: A.Options -> Name -> [TyVarBndr ()] -> Type -> Q [Dec]
|
||||
deriveSynonym _ name vars otherT =
|
||||
runDerive name vars $ \typeName ->
|
||||
[|ETypePrimAlias (EPrimAlias $typeName $otherType)|]
|
||||
|
@ -10,7 +10,6 @@ import Data.Typeable (TyCon, TypeRep, Typeable, splitTyConApp,
|
||||
|
||||
import Data.Aeson.Types (SumEncoding (..))
|
||||
import Data.Maybe (fromMaybe)
|
||||
import Data.Monoid ((<>))
|
||||
|
||||
-- | Type definition, including constructors.
|
||||
data ETypeDef
|
||||
|
Loading…
Reference in New Issue
Block a user