summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCsaba Hruska <csaba.hruska@gmail.com>2016-11-07 12:46:40 +0100
committerCsaba Hruska <csaba.hruska@gmail.com>2016-11-07 12:46:40 +0100
commitd052fdc20bf4de1e5bf160ad94723f6e46654c4b (patch)
tree21887ea32a69525df7e9f402432f51c3e0f35aff
parent0926ee8c49e52a7cd0b1fa3187f46df4305c97c5 (diff)
refactor cabal flags, by default only library and lc command line tool is built
-rw-r--r--lambdacube-compiler.cabal107
-rwxr-xr-xrun-test-suite.sh4
2 files changed, 69 insertions, 42 deletions
diff --git a/lambdacube-compiler.cabal b/lambdacube-compiler.cabal
index dc220732..9be9c4c3 100644
--- a/lambdacube-compiler.cabal
+++ b/lambdacube-compiler.cabal
@@ -21,14 +21,31 @@ Data-Files:
21 lc/Internals.lc 21 lc/Internals.lc
22 lc/Prelude.lc 22 lc/Prelude.lc
23 23
24Flag onlytestsuite 24-- flags explanation (Y-Yes,N-No,X-no effect)
25 Description: Only compiles the library and testsuit 25-- executables/flags: | default, cli, testsuite, coverage, alltest, profiling
26 Default: False 26-- lc Y Y X X X X
27-- lambdacube-compiler-unit-tests N X X X Y X
28-- lambdacube-compiler-test-suite N X Y X Y X
29-- lambdacube-compiler-performance-report N X X X Y X
30-- lambdacube-backend-test-server N X X X Y X
31-- lambdacube-compiler-coverage-test-suite N X X Y X X
32
33Flag cli
34 Description: Compiles 'lc' command line tool
35 Default: True
27 36
28Flag profiling 37Flag profiling
29 Description: Enable profiling 38 Description: Enable profiling
30 Default: False 39 Default: False
31 40
41Flag alltest
42 Description: Additionally compiles the testsuite, unit tests, backend test server, performance report (useful for development)
43 Default: False
44
45Flag testsuite
46 Description: Compiles the library and testsuite
47 Default: False
48
32Flag coverage 49Flag coverage
33 Description: Enable coverage reporting 50 Description: Enable coverage reporting
34 Default: False 51 Default: False
@@ -97,12 +114,39 @@ library
97 if flag(profiling) 114 if flag(profiling)
98 GHC-Options: -fprof-auto -rtsopts 115 GHC-Options: -fprof-auto -rtsopts
99 116
117executable lc
118 hs-source-dirs: tool
119 main-is: Compiler.hs
120 default-language: Haskell2010
121
122 if flag(cli)
123 Buildable: True
124 else
125 Buildable: False
126
127 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
128 build-depends:
129 base < 4.10,
130 lambdacube-compiler,
131 optparse-applicative >=0.12 && <0.14,
132 aeson >=0.9 && <0.12,
133 bytestring == 0.10.*,
134 filepath >=1.4 && <1.5
135
136------------------------
137-- tests for development
138------------------------
100 139
101executable lambdacube-compiler-unit-tests 140executable lambdacube-compiler-unit-tests
102 hs-source-dirs: test 141 hs-source-dirs: test
103 main-is: UnitTests.hs 142 main-is: UnitTests.hs
104 default-language: Haskell2010 143 default-language: Haskell2010
105 144
145 if flag(alltest)
146 Buildable: True
147 else
148 Buildable: False
149
106 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository 150 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
107 build-depends: 151 build-depends:
108 base < 4.10, 152 base < 4.10,
@@ -114,16 +158,21 @@ executable lambdacube-compiler-unit-tests
114 tasty >= 0.11 && <0.12, 158 tasty >= 0.11 && <0.12,
115 tasty-quickcheck >=0.8 && <0.9 159 tasty-quickcheck >=0.8 && <0.9
116 160
117 if flag(onlytestsuite)
118 Buildable: False
119 else
120 Buildable: True
121
122executable lambdacube-compiler-test-suite 161executable lambdacube-compiler-test-suite
123 hs-source-dirs: test 162 hs-source-dirs: test
124 main-is: runTests.hs 163 main-is: runTests.hs
125 default-language: Haskell2010 164 default-language: Haskell2010
126 165
166 if flag(alltest) || flag(testsuite)
167 Buildable: True
168 else
169 Buildable: False
170
171 if flag(profiling)
172 GHC-Options: -fprof-auto -rtsopts
173 else
174 GHC-Options: -rtsopts
175
127 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository 176 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
128 build-depends: 177 build-depends:
129 aeson >=0.9 && <0.12, 178 aeson >=0.9 && <0.12,
@@ -147,16 +196,16 @@ executable lambdacube-compiler-test-suite
147 lambdacube-ir == 0.4.*, 196 lambdacube-ir == 0.4.*,
148 vector >= 0.11 && <0.12 197 vector >= 0.11 && <0.12
149 198
150 if flag(profiling)
151 GHC-Options: -fprof-auto -rtsopts
152 else
153 GHC-Options: -rtsopts
154
155executable lambdacube-compiler-performance-report 199executable lambdacube-compiler-performance-report
156 hs-source-dirs: test 200 hs-source-dirs: test
157 main-is: PerfReport.hs 201 main-is: PerfReport.hs
158 default-language: Haskell2010 202 default-language: Haskell2010
159 203
204 if flag(alltest)
205 Buildable: True
206 else
207 Buildable: False
208
160 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository 209 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
161 build-depends: 210 build-depends:
162 base < 4.10, 211 base < 4.10,
@@ -165,26 +214,6 @@ executable lambdacube-compiler-performance-report
165 containers >=0.5 && <0.6, 214 containers >=0.5 && <0.6,
166 optparse-applicative >=0.12 && <0.14 215 optparse-applicative >=0.12 && <0.14
167 216
168
169executable lc
170 hs-source-dirs: tool
171 main-is: Compiler.hs
172 default-language: Haskell2010
173
174 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
175 build-depends:
176 base < 4.10,
177 lambdacube-compiler,
178 optparse-applicative >=0.12 && <0.14,
179 aeson >=0.9 && <0.12,
180 bytestring == 0.10.*,
181 filepath >=1.4 && <1.5
182
183 if flag(onlytestsuite)
184 Buildable: False
185 else
186 Buildable: True
187
188executable lambdacube-backend-test-server 217executable lambdacube-backend-test-server
189 hs-source-dirs: backendtest 218 hs-source-dirs: backendtest
190 main-is: TestServer.hs 219 main-is: TestServer.hs
@@ -192,6 +221,11 @@ executable lambdacube-backend-test-server
192 other-modules: EditorExamplesTest 221 other-modules: EditorExamplesTest
193 TestData 222 TestData
194 223
224 if flag(alltest)
225 Buildable: True
226 else
227 Buildable: False
228
195 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository 229 -- CAUTION: When the build-depends change, please bump the git submodule in lambdacube-docker repository
196 build-depends: 230 build-depends:
197 base < 4.10, 231 base < 4.10,
@@ -213,12 +247,6 @@ executable lambdacube-backend-test-server
213 vector >= 0.11 && <0.12, 247 vector >= 0.11 && <0.12,
214 process >= 1.2 248 process >= 1.2
215 249
216 if flag(onlytestsuite)
217 Buildable: False
218 else
219 Buildable: True
220
221
222executable lambdacube-compiler-coverage-test-suite 250executable lambdacube-compiler-coverage-test-suite
223 hs-source-dirs: src, test 251 hs-source-dirs: src, test
224 main-is: runTests.hs 252 main-is: runTests.hs
@@ -256,4 +284,3 @@ executable lambdacube-compiler-coverage-test-suite
256 text >= 1.2 && <1.3, 284 text >= 1.2 && <1.3,
257 time >= 1.5 && <1.7, 285 time >= 1.5 && <1.7,
258 vector >= 0.11 && <0.12 286 vector >= 0.11 && <0.12
259
diff --git a/run-test-suite.sh b/run-test-suite.sh
index f7e051c6..d2173427 100755
--- a/run-test-suite.sh
+++ b/run-test-suite.sh
@@ -5,7 +5,7 @@ UNIT_TEST_PARAMS="--quickcheck-max-size 30 --quickcheck-tests 100"
5if [ "$1" == "--profile" ] ; then 5if [ "$1" == "--profile" ] ; then
6 shift 6 shift
7 cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling 7 cabal install --only-dependencies --enable-library-profiling --enable-executable-profiling
8 cabal configure --flags "profiling onlytestsuite" --enable-library-profiling --enable-executable-profiling 8 cabal configure --flags "profiling testsuite -cli" --enable-library-profiling --enable-executable-profiling
9 set +e 9 set +e
10 RESULT_UNITTESTS=0 10 RESULT_UNITTESTS=0
11 cabal run lambdacube-compiler-test-suite -- -r -iperformance -i.ignore $@ +RTS -p 11 cabal run lambdacube-compiler-test-suite -- -r -iperformance -i.ignore $@ +RTS -p
@@ -14,7 +14,7 @@ elif [ "$1" == "--coverage" ] ; then
14 shift 14 shift
15 set +e 15 set +e
16 cabal install --only-dependencies 16 cabal install --only-dependencies
17 cabal configure --flags "coverage" 17 cabal configure --flags "coverage alltest"
18 cabal run lambdacube-compiler-unit-tests -- $UNIT_TEST_PARAMS 18 cabal run lambdacube-compiler-unit-tests -- $UNIT_TEST_PARAMS
19 RESULT_UNITTESTS=`echo $?` 19 RESULT_UNITTESTS=`echo $?`
20 cabal run lambdacube-compiler-coverage-test-suite -- -iperformance -i.ignore -r $@ 20 cabal run lambdacube-compiler-coverage-test-suite -- -iperformance -i.ignore -r $@