git.iko.soy/typeable/haskell-stack-trace-plugin
on master help sign in
Merge pull request #2 from waddlaw/tweak
14ff8deShinya Yamaguchi
.travis.ymlnew file+155
@@ -0,0 +1,155 @@
1+# This Travis job script has been generated by a script via
2+#
3+# haskell-ci 'haskell-stack-trace-plugin.cabal' '--output' '.travis.yml'
4+#
5+# For more information, see https://github.com/haskell-CI/haskell-ci
6+#
7+# version: 0.8
8+#
9+version: ~> 1.0
10+language: c
11+os: linux
12+dist: xenial
13+git:
14+ # whether to recursively clone submodules
15+ submodules: false
16+cache:
17+ directories:
18+ - $HOME/.cabal/packages
19+ - $HOME/.cabal/store
20+ - $HOME/.hlint
21+before_cache:
22+ - rm -fv $CABALHOME/packages/hackage.haskell.org/build-reports.log
23+ # remove files that are regenerated by 'cabal update'
24+ - rm -fv $CABALHOME/packages/hackage.haskell.org/00-index.*
25+ - rm -fv $CABALHOME/packages/hackage.haskell.org/*.json
26+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.cache
27+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar
28+ - rm -fv $CABALHOME/packages/hackage.haskell.org/01-index.tar.idx
29+ - rm -rfv $CABALHOME/packages/head.hackage
30+jobs:
31+ include:
32+ - compiler: ghc-8.6.5
33+ addons: {"apt":{"sources":[{"sourceline":"deb http://ppa.launchpad.net/hvr/ghc/ubuntu xenial main","key_url":"https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x063dab2bdc0b3f9fcebc378bff3aeacef6f88286"}],"packages":["ghc-8.6.5","cabal-install-3.0"]}}
34+ os: linux
35+before_install:
36+ - HC=$(echo "/opt/$CC/bin/ghc" | sed 's/-/\//')
37+ - WITHCOMPILER="-w $HC"
38+ - HADDOCK=$(echo "/opt/$CC/bin/haddock" | sed 's/-/\//')
39+ - HCPKG="$HC-pkg"
40+ - unset CC
41+ - CABAL=/opt/ghc/bin/cabal
42+ - CABALHOME=$HOME/.cabal
43+ - export PATH="$CABALHOME/bin:$PATH"
44+ - TOP=$(pwd)
45+ - "HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\\d+)\\.(\\d+)\\.(\\d+)(\\.(\\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')"
46+ - echo $HCNUMVER
47+ - CABAL="$CABAL -vnormal+nowrap+markoutput"
48+ - set -o pipefail
49+ - |
50+ echo 'function blue(s) { printf "\033[0;34m" s "\033[0m " }' >> .colorful.awk
51+ echo 'BEGIN { state = "output"; }' >> .colorful.awk
52+ echo '/^-----BEGIN CABAL OUTPUT-----$/ { state = "cabal" }' >> .colorful.awk
53+ echo '/^-----END CABAL OUTPUT-----$/ { state = "output" }' >> .colorful.awk
54+ echo '!/^(-----BEGIN CABAL OUTPUT-----|-----END CABAL OUTPUT-----)/ {' >> .colorful.awk
55+ echo ' if (state == "cabal") {' >> .colorful.awk
56+ echo ' print blue($0)' >> .colorful.awk
57+ echo ' } else {' >> .colorful.awk
58+ echo ' print $0' >> .colorful.awk
59+ echo ' }' >> .colorful.awk
60+ echo '}' >> .colorful.awk
61+ - cat .colorful.awk
62+ - |
63+ color_cabal_output () {
64+ awk -f $TOP/.colorful.awk
65+ }
66+ - echo text | color_cabal_output
67+install:
68+ - ${CABAL} --version
69+ - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"
70+ - TEST=--enable-tests
71+ - BENCH=--enable-benchmarks
72+ - HEADHACKAGE=false
73+ - rm -f $CABALHOME/config
74+ - |
75+ echo "verbose: normal +nowrap +markoutput" >> $CABALHOME/config
76+ echo "remote-build-reporting: anonymous" >> $CABALHOME/config
77+ echo "write-ghc-environment-files: always" >> $CABALHOME/config
78+ echo "remote-repo-cache: $CABALHOME/packages" >> $CABALHOME/config
79+ echo "logs-dir: $CABALHOME/logs" >> $CABALHOME/config
80+ echo "world-file: $CABALHOME/world" >> $CABALHOME/config
81+ echo "extra-prog-path: $CABALHOME/bin" >> $CABALHOME/config
82+ echo "symlink-bindir: $CABALHOME/bin" >> $CABALHOME/config
83+ echo "installdir: $CABALHOME/bin" >> $CABALHOME/config
84+ echo "build-summary: $CABALHOME/logs/build.log" >> $CABALHOME/config
85+ echo "store-dir: $CABALHOME/store" >> $CABALHOME/config
86+ echo "install-dirs user" >> $CABALHOME/config
87+ echo " prefix: $CABALHOME" >> $CABALHOME/config
88+ echo "repository hackage.haskell.org" >> $CABALHOME/config
89+ echo " url: http://hackage.haskell.org/" >> $CABALHOME/config
90+ echo " secure: True" >> $CABALHOME/config
91+ echo " key-threshold: 3" >> $CABALHOME/config
92+ echo " root-keys:" >> $CABALHOME/config
93+ echo " fe331502606802feac15e514d9b9ea83fee8b6ffef71335479a2e68d84adc6b0" >> $CABALHOME/config
94+ echo " 1ea9ba32c526d1cc91ab5e5bd364ec5e9e8cb67179a471872f6e26f0ae773d42" >> $CABALHOME/config
95+ echo " 2c6c3627bd6c982990239487f1abd02e08a02e6cf16edb105a8012d444d870c3" >> $CABALHOME/config
96+ echo " 0a5c7ea47cd1b15f01f5f51a33adda7e655bc0f0b0615baa8e271f4c3351e21d" >> $CABALHOME/config
97+ echo " 51f0161b906011b52c6613376b1ae937670da69322113a246a09f807c62f6921" >> $CABALHOME/config
98+ - |
99+ echo "program-default-options" >> $CABALHOME/config
100+ echo " ghc-options: $GHCJOBS +RTS -M6G -RTS" >> $CABALHOME/config
101+ - cat $CABALHOME/config
102+ - rm -fv cabal.project cabal.project.local cabal.project.freeze
103+ - travis_retry ${CABAL} v2-update -v
104+ # Generate cabal.project
105+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
106+ - touch cabal.project
107+ - |
108+ echo "packages: ." >> cabal.project
109+ - |
110+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(haskell-stack-trace-plugin)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
111+ - cat cabal.project || true
112+ - cat cabal.project.local || true
113+ - if [ -f "./configure.ac" ]; then (cd "." && autoreconf -i); fi
114+ - ${CABAL} v2-freeze $WITHCOMPILER ${TEST} ${BENCH} | color_cabal_output
115+ - "cat cabal.project.freeze | sed -E 's/^(constraints: *| *)//' | sed 's/any.//'"
116+ - rm cabal.project.freeze
117+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} --dep -j2 all | color_cabal_output
118+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks --dep -j2 all | color_cabal_output
119+script:
120+ - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)
121+ # Packaging...
122+ - ${CABAL} v2-sdist all | color_cabal_output
123+ # Unpacking...
124+ - mv dist-newstyle/sdist/*.tar.gz ${DISTDIR}/
125+ - cd ${DISTDIR} || false
126+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec tar -xvf '{}' \;
127+ - find . -maxdepth 1 -type f -name '*.tar.gz' -exec rm '{}' \;
128+ - PKGDIR_haskell_stack_trace_plugin="$(find . -maxdepth 1 -type d -regex '.*/haskell-stack-trace-plugin-[0-9.]*')"
129+ # Generate cabal.project
130+ - rm -rf cabal.project cabal.project.local cabal.project.freeze
131+ - touch cabal.project
132+ - |
133+ echo "packages: ${PKGDIR_haskell_stack_trace_plugin}" >> cabal.project
134+ - |
135+ - "for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/-[^-]*$//' | (grep -vE -- '^(haskell-stack-trace-plugin)$' || true) | sed 's/^/constraints: /' | sed 's/$/ installed/' >> cabal.project.local; done"
136+ - cat cabal.project || true
137+ - cat cabal.project.local || true
138+ # Building...
139+ # this builds all libraries and executables (without tests/benchmarks)
140+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
141+ # Building with tests and benchmarks...
142+ # build & run tests, build benchmarks
143+ - ${CABAL} v2-build $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
144+ # Testing...
145+ - ${CABAL} v2-test $WITHCOMPILER ${TEST} ${BENCH} all | color_cabal_output
146+ # cabal check...
147+ - (cd ${PKGDIR_haskell_stack_trace_plugin} && ${CABAL} -vnormal check)
148+ # haddock...
149+ - ${CABAL} v2-haddock $WITHCOMPILER --with-haddock $HADDOCK ${TEST} ${BENCH} all | color_cabal_output
150+ # Building without installed constraints for packages in global-db...
151+ - rm -f cabal.project.local
152+ - ${CABAL} v2-build $WITHCOMPILER --disable-tests --disable-benchmarks all | color_cabal_output
153+
154+# REGENDATA ("0.8",["haskell-stack-trace-plugin.cabal","--output",".travis.yml"])
155+# EOF
LICENSE+1−1
@@ -1,4 +1,4 @@
1−Copyright (c) 2018 Shinya Yamaguchi
1+Copyright (c) 2018-2020 Shinya Yamaguchi
2
2
3Permission is hereby granted, free of charge, to any person obtaining
3Permission is hereby granted, free of charge, to any person obtaining
4a copy of this software and associated documentation files (the
4a copy of this software and associated documentation files (the
haskell-stack-trace-plugin.cabal+39−3
@@ -8,17 +8,22 @@ license: MIT
8license-file: LICENSE
8license-file: LICENSE
9author: Shinya Yamaguchi
9author: Shinya Yamaguchi
10maintainer: ingronze@gmail.com
10maintainer: ingronze@gmail.com
11−copyright: 2018 Shinya Yamaguchi
11+copyright: 2018-2020 Shinya Yamaguchi
12category: Compiler Plugin, Development, Debug
12category: Compiler Plugin, Development, Debug
13build-type: Simple
13build-type: Simple
14extra-source-files: CHANGELOG.md, Readme.md
14extra-source-files: CHANGELOG.md, Readme.md
15cabal-version: >=1.10
15cabal-version: >=1.10
16−tested-with: GHC == 8.6.2
16+tested-with: GHC == 8.6.5
17
17
18source-repository head
18source-repository head
19 type: git
19 type: git
20 location: git://github.com/waddlaw/haskell-stack-trace-plugin
20 location: git://github.com/waddlaw/haskell-stack-trace-plugin
21
21
22+flag dev
23+ description: Turn on development settings.
24+ manual: True
25+ default: False
26+
22library
27library
23 hs-source-dirs: src
28 hs-source-dirs: src
24 build-depends:
29 build-depends:
@@ -28,7 +33,38 @@ library
28 exposed-modules:
33 exposed-modules:
29 StackTrace.Plugin
34 StackTrace.Plugin
30
35
36+ if flag(dev)
37+ ghc-options: -Wall -Werror -Wcompat
38+ -- -Wincomplete-record-updates
39+ -Wincomplete-uni-patterns
40+ -Wnoncanonical-monad-instances
41+ -Wnoncanonical-monadfail-instances
42+ -Wno-missing-home-modules
43+ else
44+ ghc-options: -O2 -Wall
31− default-language: Haskell2010
45+ default-language: Haskell2010
46+
47+test-suite test
48+ main-is: Spec.hs
49+ hs-source-dirs: test
50+ type: exitcode-stdio-1.0
51+ build-depends:
52+ base >=4.12 && <4.13,
53+ bytestring >= 0.10.8 && <0.11,
54+ hspec >= 2.7 && <2.8,
55+ typed-process >= 0.2.6 && <0.2.9
56+
57+ build-tool-depends:
58+ hspec-discover:hspec-discover >= 2.7 && <2.8
59+
60+ other-modules: StackTrace.PluginSpec
61+
62+ if flag(dev)
63+ ghc-options: -Wall -Werror
64+ else
65+ ghc-options: -O2 -Wall
66+
67+ default-language: Haskell2010
32
68
33executable example
69executable example
34 main-is: Main.hs
70 main-is: Main.hs
test/Spec.hsnew file+1
@@ -0,0 +1 @@
1+{-# OPTIONS_GHC -F -pgmF hspec-discover #-}
test/StackTrace/PluginSpec.hsnew file+21
@@ -0,0 +1,21 @@
1+{-# LANGUAGE OverloadedStrings #-}
2+module StackTrace.PluginSpec (spec) where
3+
4+import Data.ByteString.Lazy (ByteString)
5+import qualified Data.ByteString.Lazy as BL
6+import Test.Hspec
7+import System.Process.Typed
8+
9+spec :: Spec
10+spec = do
11+ output <- runIO exe
12+ expected <- runIO $ BL.readFile "test/resource/ghc86.output"
13+ it "integration test" $ output `shouldBe` expected
14+
15+
16+exe :: IO ByteString
17+exe = do
18+ runProcess_ $ shell "cabal install exe:example --installdir=./dist"
19+ err <- readProcessStderr_ $ shell "./dist/example || true"
20+ runProcess_ $ shell "rm -rf ./dist"
21+ return err
test/resource/ghc86.outputnew file+13
@@ -0,0 +1,13 @@
1+example: fError
2+CallStack (from HasCallStack):
3+ error, called at example/Main.hs:41:10 in main:Main
4+ fError, called at example/Main.hs:37:11 in main:Main
5+ f8, called at example/Main.hs:33:16 in main:Main
6+ f7, called at example/Main.hs:29:11 in main:Main
7+ f6, called at example/Main.hs:25:15 in main:Main
8+ f5, called at example/Main.hs:21:8 in main:Main
9+ f4, called at example/Main.hs:17:6 in main:Main
10+ f3, called at example/Main.hs:13:6 in main:Main
11+ f2, called at example/Main.hs:10:6 in main:Main
12+ f1, called at example/Main.hs:7:14 in main:Main
13+ main, called at example/Main.hs:7:1 in main:Main