Skip to content

Commit

Permalink
Batect: Introduce a config variable to enable Gradle build scans
Browse files Browse the repository at this point in the history
Unfortunately, Batect's expressions [1] are not yet powerful enough [2]
to elegantly map booleans to strings, so a rather lengthy `sed`
construct has to be used. Gradle build scans are disabled by default. In
order to enable them, run `./batect --config-var gradle_build_scan=true`.

[1]: https://batect.dev/docs/reference/config/expressions
[2]: batect/batect#990

Signed-off-by: Sebastian Schuberth <sschuberth@gmail.com>
  • Loading branch information
sschuberth committed Sep 27, 2022
1 parent acc9d64 commit e6381b3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion batect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
forbid_telemetry: true

config_variables:
gradle_build_scan:
description: Enabling of Gradle build scans
# Supported values: "true", "false"
default: false
gradle_console:
description: Gradle console mode
# Supported values: "auto", "plain", "rich", "verbose"
Expand All @@ -35,6 +39,7 @@ config_variables:
environment:
GRADLE_OPTS: -Dorg.gradle.console=<gradle_console -Dorg.gradle.daemon=false -Dkotest.assertions.multi-line-diff=<kotest_diff
GRADLE_RO_DEP_CACHE: /home/ort/.gradle-ro-dep-cache
GRADLE_BUILD_SCAN: <gradle_build_scan
volumes:
# Mount any Gradle caches present on the host as read-only into the container to speed up the build.
- local: ~/.gradle/caches
Expand Down Expand Up @@ -92,5 +97,5 @@ tasks:
- buildFunTest
run:
container: run
command: "'./gradlew funTest jacocoFunTestReport -p analyzer'"
command: "'./gradlew funTest jacocoFunTestReport -p analyzer $(sed \"s/true/--scan/;s/false//\" <<< \"$GRADLE_BUILD_SCAN\")'"
entrypoint: /bin/bash --login -c

0 comments on commit e6381b3

Please sign in to comment.