Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
226 changes: 136 additions & 90 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.3.20190313
# version: 0.7.20191124
#
language: c
dist: xenial

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'
Expand All @@ -25,119 +24,166 @@ 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:
include:
- compiler: "ghc-8.6.4"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.6.4], sources: [hvr-ghc]}}
- compiler: "ghc-8.4.4"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-8.4.4], 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-7.10.3"
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.4,ghc-7.10.3], sources: [hvr-ghc]}}
- compiler: "ghc-head"
env: GHCHEAD=true
addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}

- compiler: ghc-8.8.1
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.8.1","cabal-install-3.0"]}}
- compiler: ghc-8.6.5
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
- compiler: ghc-8.4.4
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.4.4","cabal-install-3.0"]}}
- compiler: ghc-8.2.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.2.2","cabal-install-3.0"]}}
- compiler: ghc-8.0.2
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-8.0.2","cabal-install-3.0"]}}
- compiler: ghc-7.10.3
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-7.10.3","cabal-install-3.0"]}}
- compiler: ghc-head
addons: {"apt":{"sources":["hvr-ghc"],"packages":["ghc-head","cabal-install-head"]}}
allow_failures:
- compiler: "ghc-head"

- compiler: ghc-head
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+markoutput"
- set -o pipefail
- |
echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
echo 'BEGIN { state = "output"; }' >> .colorful.awk
echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
echo ' if (state == "cabal") {' >> .colorful.awk
echo ' print blue($0)' >> .colorful.awk
echo ' } else {' >> .colorful.awk
echo ' print $0' >> .colorful.awk
echo ' }' >> .colorful.awk
echo '}' >> .colorful.awk
- cat .colorful.awk
- |
color_cabal_output () {
awk -f $TOP/.colorful.awk
}
- echo text | color_cabal_output
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
# Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage
- HEADHACKAGE=false
- if [ $HCNUMVER -gt 80801 ] ; then HEADHACKAGE=true ; fi
- rm -f $CABALHOME/config
- |
if $GHCHEAD; then
sed -i 's/-- allow-newer: .*/allow-newer: *:base/' $CABALHOME/config
for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" $CABALHOME/config; done

echo 'repository head.hackage' >> $CABALHOME/config
echo ' url: http://head.hackage.haskell.org/' >> $CABALHOME/config
echo ' secure: True' >> $CABALHOME/config
echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> $CABALHOME/config
echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> $CABALHOME/config
echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> $CABALHOME/config
echo ' key-threshold: 3' >> $CABALHOME.config

grep -Ev -- '^\s*--' $CABALHOME/config | grep -Ev '^\s*$'

${CABAL} new-update head.hackage -v
echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
echo "remote-build-reporting: anonymous" >> $CABALHOME/config
echo "write-ghc-environment-files: always" >> $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
echo " secure: True" >> $CABALHOME/config
echo " key-threshold: 3" >> $CABALHOME/config
echo " root-keys:" >> $CABALHOME/config
echo " fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0" >> $CABALHOME/config
echo " 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42" >> $CABALHOME/config
echo " 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3" >> $CABALHOME/config
echo " 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d" >> $CABALHOME/config
echo " 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921" >> $CABALHOME/config
- |
if $HEADHACKAGE; then
echo "allow-newer: $($HCPKG list --simple-output | sed -E 's/([a-zA-Z-]+)-[0-9.]+/*:\1/g')" >> $CABALHOME/config
echo "repository head.hackage.ghc.haskell.org" >> $CABALHOME/config
echo " url: https://ghc.gitlab.haskell.org/head.hackage/" >> $CABALHOME/config
echo " secure: True" >> $CABALHOME/config
echo " root-keys: 7541f32a4ccca4f97aea3b22f5e593ba2c0267546016b992dfadcd2fe944e55d" >> $CABALHOME/config
echo " 26021a13b401500c8eb2761ca95c61f2d625bfef951b939a8124ed12ecf07329" >> $CABALHOME/config
echo " f76d08be13e9a61a377a85e2fb63f4c5435d40f8feb3e12eb05905edb8cdea89" >> $CABALHOME/config
echo " key-threshold: 3" >> $CABALHOME/config
fi
- 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: \"./ghc-dump-core\"\\n' >> cabal.project"
- "printf 'packages: \"./ghc-dump-util\"\\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 -- '^(ghc-dump-core|ghc-dump-util)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- |
echo "packages: ./ghc-dump-core" >> cabal.project
echo "packages: ./ghc-dump-util" >> cabal.project
- |
echo "source-repository-package" >> cabal.project
echo " type: git" >> cabal.project
echo " location: https://github.com/haskell-hvr/regex-tdfa.git" >> cabal.project
echo " tag: 69c140365dc9a4be1fe55fe9239dbcb17a1569fd" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(ghc-dump-core|ghc-dump-util)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- cat cabal.project || true
- cat cabal.project.local || true
- if [ -f "./ghc-dump-core/configure.ac" ]; then (cd "./ghc-dump-core" && autoreconf -i); fi
- if [ -f "./ghc-dump-util/configure.ac" ]; then (cd "./ghc-dump-util" && 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.* "./ghc-dump-core"/dist "./ghc-dump-util"/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} | color_cabal_output
- "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
- rm cabal.project.freeze
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
script:
# test that source-distributions can be generated
- ${CABAL} new-sdist all
- DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
# Packaging...
- ${CABAL} v2-sdist all | color_cabal_output
# 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_ghc_dump_core="$(find . -maxdepth 1 -type d -regex '.*/ghc-dump-core-[0-9.]*')"
- PKGDIR_ghc_dump_util="$(find . -maxdepth 1 -type d -regex '.*/ghc-dump-util-[0-9.]*')"
# Generate cabal.project
- rm -rf cabal.project cabal.project.local cabal.project.freeze
- touch cabal.project
- "printf 'packages: \"ghc-dump-core-*/*.cabal\"\\n' >> cabal.project"
- "printf 'packages: \"ghc-dump-util-*/*.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 -- '^(ghc-dump-core|ghc-dump-util)$' | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
- |
echo "packages: ${PKGDIR_ghc_dump_core}" >> cabal.project
echo "packages: ${PKGDIR_ghc_dump_util}" >> cabal.project
- |
echo "source-repository-package" >> cabal.project
echo " type: git" >> cabal.project
echo " location: https://github.com/haskell-hvr/regex-tdfa.git" >> cabal.project
echo " tag: 69c140365dc9a4be1fe55fe9239dbcb17a1569fd" >> cabal.project
- "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(ghc-dump-core|ghc-dump-util)$' || 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 | color_cabal_output
# Building with tests and benchmarks...
# build & run tests, build benchmarks
- ${CABAL} new-build -w ${HC} ${TEST} ${BENCH} all

# cabal check
- (cd ghc-dump-core-* && ${CABAL} check)
- (cd ghc-dump-util-* && ${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 ["-o",".travis.yml","--ghc-head","cabal.project"]
- ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
# cabal check...
- (cd ${PKGDIR_ghc_dump_core} && ${CABAL} -vnormal check)
- (cd ${PKGDIR_ghc_dump_util} && ${CABAL} -vnormal check)
# haddock...
- ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
# Building without installed constraints for packages in global-db...
- rm -f cabal.project.local
- ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output

# REGENDATA ("0.7.20191124",["-o",".travis.yml","--ghc-head","cabal.project"])
# EOF
1 change: 1 addition & 0 deletions ghc-dump-core/GhcDump/Ast.hs
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ data Lit = MachChar Char
| MachLabel T.Text
| LitInteger Integer
| LitNatural Integer
| LitRubbish
deriving (Eq, Ord, Generic, Show)
instance Serialise Lit

Expand Down
22 changes: 18 additions & 4 deletions ghc-dump-core/GhcDump/Convert.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import qualified Data.Text as T
import qualified Data.Text.Encoding as TE

import Literal (Literal(..))
#if MIN_VERSION_ghc(8,6,0)
import qualified Literal
#endif
import Var (Var)
import qualified Var
import Id (isFCallId)
Expand Down Expand Up @@ -193,9 +195,22 @@ cvtAltCon DEFAULT = Ast.AltDefault
cvtLit :: Literal -> Ast.Lit
cvtLit l =
case l of
#if MIN_VERSION_ghc(8,8,0)
Literal.LitChar x -> Ast.MachChar x
Literal.LitString x -> Ast.MachStr x
Literal.LitNullAddr -> Ast.MachNullAddr
Literal.LitFloat x -> Ast.MachFloat x
Literal.LitDouble x -> Ast.MachDouble x
Literal.LitLabel x _ _ -> Ast.MachLabel $ fastStringToText x
Literal.LitRubbish -> Ast.LitRubbish
#else
Literal.MachChar x -> Ast.MachChar x
Literal.MachStr x -> Ast.MachStr x
Literal.MachNullAddr -> Ast.MachNullAddr
Literal.MachFloat x -> Ast.MachFloat x
Literal.MachDouble x -> Ast.MachDouble x
Literal.MachLabel x _ _ -> Ast.MachLabel $ fastStringToText x
#endif
#if MIN_VERSION_ghc(8,6,0)
Literal.LitNumber numty n _ ->
case numty of
Expand All @@ -212,9 +227,6 @@ cvtLit l =
Literal.MachWord64 x -> Ast.MachWord64 x
Literal.LitInteger x _ -> Ast.LitInteger x
#endif
Literal.MachFloat x -> Ast.MachFloat x
Literal.MachDouble x -> Ast.MachDouble x
Literal.MachLabel x _ _ -> Ast.MachLabel $ fastStringToText x

cvtModule :: String -> ModGuts -> Ast.SModule
cvtModule phase guts =
Expand All @@ -234,7 +246,9 @@ cvtType t
cvtType (Type.TyVarTy v) = Ast.VarTy (cvtVar v)
cvtType (Type.AppTy a b) = Ast.AppTy (cvtType a) (cvtType b)
cvtType (Type.TyConApp tc tys) = Ast.TyConApp (cvtTyCon tc) (map cvtType tys)
#if MIN_VERSION_ghc(8,2,0)
#if MIN_VERSION_ghc(8,8,0)
cvtType (Type.ForAllTy (Var.Bndr b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t)
#elif MIN_VERSION_ghc(8,2,0)
cvtType (Type.ForAllTy (Var.TvBndr b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t)
#elif MIN_VERSION_ghc(8,0,0)
cvtType (Type.ForAllTy (Named b _) t) = Ast.ForAllTy (cvtBinder b) (cvtType t)
Expand Down
2 changes: 2 additions & 0 deletions ghc-dump-core/GhcDump/Plugin.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import Data.Maybe
import qualified Data.ByteString.Lazy as BSL
import qualified Codec.Serialise as Ser
import GhcPlugins hiding (TB)
#if !MIN_VERSION_ghc(8,8,0)
import CoreMonad (pprPassDetails)
#endif
import ErrUtils (showPass)
import Text.Printf
import System.FilePath
Expand Down
12 changes: 8 additions & 4 deletions ghc-dump-core/ghc-dump-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ maintainer: [email protected]
copyright: (c) 2017 Ben Gamari
category: Development
build-type: Simple
tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.4
tested-with: GHC==7.10.3, GHC==8.0.2, GHC==8.2.2, GHC==8.4.4, GHC==8.6.5, GHC==8.8.1
cabal-version: >=1.10

source-repository head
Expand All @@ -38,16 +38,20 @@ library
exposed-modules: GhcDump.Convert, GhcDump.Ast, GhcDump.Plugin
ghc-options: -Wall
other-extensions: GeneralizedNewtypeDeriving
build-depends: base >=4.8 && <4.13,
build-depends: base >=4.8 && <4.14,
bytestring >= 0.10,
text >=1.2 && <1.3,
filepath >= 1.4,
serialise >= 0.2 && <0.3,
ghc >= 7.10 && < 8.8,
ghc >= 7.10 && < 8.9,
directory < 1.4
default-language: Haskell2010
if impl(ghc >= 8.0)
ghc-options: -Wcompat -Wnoncanonical-monad-instances -Wnoncanonical-monadfail-instances
ghc-options: -Wcompat
if impl(ghc < 8.8)
ghc-options:
-Wnoncanonical-monad-instances
-Wnoncanonical-monadfail-instances
else
-- provide/emulate `Control.Monad.Fail` and `Data.Semigroups` API for pre-GHC8
build-depends: fail == 4.9.*, semigroups == 0.18.*
2 changes: 1 addition & 1 deletion ghc-dump-util/Main.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import qualified Text.PrettyPrint.ANSI.Leijen as PP

import Text.Regex.TDFA
import Text.Regex.TDFA.Common (Regex)
import Text.Regex.TDFA.Text
import Text.Regex.TDFA.Text ()

import GhcDump.Pretty
import GhcDump.Util
Expand Down
Loading