-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest.cabal
115 lines (106 loc) · 3.49 KB
/
test.cabal
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
cabal-version: 2.2
name: test
version: 0.1
build-type: Simple
-- Set this flag when building on the Artemis production server.
-- This flag is needed as cabal tries to build all specified libraries
-- even though some of them are not needed to run the executable
-- and in our case are not even available on the server.
Flag Prod
Description: Enable production mode to avoid compilation of unneeded libraries
Default: False
Manual: True
-- dependencies for all targets
common common-all
default-language: Haskell2010
build-depends:
base == 4.*,
QuickCheck == 2.*,
array == 0.*,
containers == 0.*,
unordered-containers == 0.*,
binary == 0.*,
bytestring == 0.*,
hashable == 1.*,
text == 1.*
ghc-options: -O2
-- dependencies for test targets
common common-tests
import: common-all
hs-source-dirs: test/hs/
other-modules: Interface, Generators
build-depends:
tasty == 1.*,
tasty-smallcheck == 0.*,
smallcheck == 1.*,
tasty-quickcheck == 0.*,
QuickCheck == 2.*,
quickcheck-assertions == 0.*,
tasty-hunit == 0.*,
tasty-ant-xml == 1.*,
solution
mixins:
-- rename module exported by the solution to avoid a naming conflict
solution (Exercise09_Efficient as Solution),
solution (Types_Efficient as TypesSolution)
ghc-options:
-main-is Test
-- this flag is necessary as it allows interrupts of non-allocating loops
-- https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/bugs.html#bugs-in-ghc
-fno-omit-yields
if flag(Prod)
cpp-options: -DPROD
-- build a submission
library submission
import: common-all
-- enables safe Haskell mode; that is, disallow unsafe features -- see https://wiki.haskell.org/Safe_Haskell
default-extensions: Safe
-- The base package by Haskell can be trusted.
-- See https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/safe_haskell.html#package-trust
-- for a description of the flags.
ghc-options: -fpackage-trust -trust base -trust QuickCheck -trust random -trust array -trust containers -trust unordered-containers -trust binary -trust bytestring -trust hashable -trust text -pgmP nonExistentCPP
hs-source-dirs: assignment/src
exposed-modules: Exercise09, Types
-- build the local template
library template
import: common-all
-- There is no template folder on the production server, but cabal tries to build all executables
-- without exception (https://github.com/commercialhaskell/stack/issues/3486).
-- We hence disable the build explicitly with a flag.
if flag(Prod)
buildable: False
else
hs-source-dirs: template/src
exposed-modules: Exercise09, Types
-- build the solution
library solution
import: common-all
hs-source-dirs: solution/src
exposed-modules: Exercise09_Efficient, Types_Efficient
-- run tests for a submission
executable test
import: common-tests
build-depends: submission
main-is: Test.hs
cpp-options: -DTEST
-- run tests for local template
executable test-template
import: common-tests
build-depends: template
main-is: Test.hs
if flag(Prod)
buildable: False
cpp-options: -DTESTTEMPLATE
-- run tests for solution locally
executable test-solution
import: common-tests
main-is: Test.hs
mixins:
-- use solution as both submission and solution
solution (Exercise09_Efficient as Exercise09),
solution (Exercise09_Efficient as Solution),
solution (Types_Efficient as Types),
solution (Types_Efficient as TypesSolution)
if flag(Prod)
buildable: False
cpp-options: -DTESTSOLUTION