Skip to content

Commit 2364483

Browse files
committed
test-dev: gate behind cabal flag (default off)
Adds a 'test-dev' manual cabal flag (default False) and conditionally makes the test-dev stanza buildable only when the flag is set. Protects against 'cabal build all --enable-tests' or 'cabal test all' picking up the duplicate src-compile. make live-test-dev passes -f test-dev under the hood.
1 parent cf8db3f commit 2364483

3 files changed

Lines changed: 24 additions & 3 deletions

File tree

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ live-test-reload-all:
4444
TEST_MATCH ?=
4545
live-test-dev:
4646
USE_EXTERNAL_DB=true LOG_LEVEL=attention \
47-
ghcid --command 'cabal repl monoscope:test:test-dev --ghc-options="-osuf dyn_o -hisuf dyn_hi -O0" --with-compiler=$(GHC)' \
47+
ghcid --command 'cabal repl monoscope:test:test-dev -f test-dev --ghc-options="-osuf dyn_o -hisuf dyn_hi -O0" --with-compiler=$(GHC)' \
4848
--test ':main $(if $(TEST_MATCH),--match=$(TEST_MATCH))' --warnings 2>&1 | tee build-test-dev.log
4949

5050
hot-reload:

monoscope.cabal

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,12 @@ custom-setup
135135
, base
136136
, proto-lens-setup
137137

138+
flag test-dev
139+
description: Build the test-dev test-suite (lib + integration as ONE GHCi target). Off by default so CI's `cabal build all` skips it; opt in for local iteration via `cabal build -f test-dev` or `make live-test-dev`.
140+
141+
manual: True
142+
default: False
143+
138144
library
139145
exposed-modules:
140146
BackgroundJobs
@@ -1097,6 +1103,8 @@ test-suite test-dev
10971103
, yaml
10981104
, zlib
10991105
default-language: GHC2024
1106+
if !flag(test-dev)
1107+
buildable: False
11001108

11011109
test-suite unit-tests
11021110
type: exitcode-stdio-1.0

package.yaml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ copyright: '2021-2026 Monoscope'
99
language: GHC2024
1010
spec-version: 0.36.0
1111

12+
flags:
13+
test-dev:
14+
description: >
15+
Build the test-dev test-suite (lib + integration as ONE GHCi target).
16+
Off by default so CI's `cabal build all` skips it; opt in for local
17+
iteration via `cabal build -f test-dev` or `make live-test-dev`.
18+
default: false
19+
manual: true
20+
1221
build-type: Custom
1322
custom-setup:
1423
dependencies:
@@ -318,9 +327,13 @@ tests:
318327
- vector
319328
- time
320329
# test-dev: lib + integration tests as ONE GHCi target (Jade's cabal test-dev trick).
321-
# Use via `make live-test-dev`. Library deps come from hpack-includes/lib-deps.yaml
322-
# (shared with `library`); integration-only extras listed inline. Not run by `make test` / CI.
330+
# Gated off by default via the `test-dev` cabal flag so `cabal build all` in CI
331+
# skips it. Use via `make live-test-dev` (passes -f test-dev under the hood).
332+
# Library deps come from hpack-includes/lib-deps.yaml (shared with `library`).
323333
test-dev:
334+
when:
335+
- condition: '!flag(test-dev)'
336+
buildable: false
324337
main: Main.hs
325338
source-dirs:
326339
- src

0 commit comments

Comments
 (0)