Move SSD activity duration formatting to typed Kotlin
ober
cd9b60fdb7a0064ed230e2503e222215e5e4b22b
--- a/.build.yml +++ b/.build.yml @@ -5,7 +5,7 @@ packages: - make=4.4.1-r4 sources: # Build dependency: full immutable commit, mirrored in dependencies.lock.json. - - "https://git.sr.ht/~lisp/jerboa#3ca97777bfaf7f5fe3088b345288221279ec6253" + - "https://git.sr.ht/~lisp/jerboa#031db15b86a0d3f86caf64241531bd9be37013fe" # The second source is the build subject selected by the SourceHut submitter. - https://git.sr.ht/~lisp/jerboa-android tasks: @@ -14,6 +14,6 @@ tasks: test "$(apk info -v chez-scheme)" = chez-scheme-10.3.0-r2 test "$(apk info -v git)" = git-2.54.0-r0 test "$(apk info -v make)" = make-4.4.1-r4 - test "$(git -C ../jerboa rev-parse HEAD)" = 3ca97777bfaf7f5fe3088b345288221279ec6253 - test "$(git -C ../jerboa rev-parse 'HEAD^{tree}')" = ea0bcbac7405ab38dc9fa9339d5597154ab002b7 + test "$(git -C ../jerboa rev-parse HEAD)" = 031db15b86a0d3f86caf64241531bd9be37013fe + test "$(git -C ../jerboa rev-parse 'HEAD^{tree}')" = 1c3786138585442c273e05a00daaa50c287af6d8 JERBOA="chez --libdirs .:../jerboa/lib --script" make test --- a/dependencies.lock.json +++ b/dependencies.lock.json @@ -11,8 +11,8 @@ "generator_runtime": { "name": "jerboa", "repository": "https://git.sr.ht/~lisp/jerboa", - "commit": "3ca97777bfaf7f5fe3088b345288221279ec6253", - "tree": "ea0bcbac7405ab38dc9fa9339d5597154ab002b7" + "commit": "031db15b86a0d3f86caf64241531bd9be37013fe", + "tree": "1c3786138585442c273e05a00daaa50c287af6d8" }, "assurance_tools": { "osv_scanner": { --- a/scripts/verify-supply-chain.sh +++ b/scripts/verify-supply-chain.sh @@ -3,8 +3,8 @@ set -eu repo=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd -P) lock="$repo/dependencies.lock.json" -jerboa_commit=3ca97777bfaf7f5fe3088b345288221279ec6253 # gitsafe:ignore -jerboa_tree=ea0bcbac7405ab38dc9fa9339d5597154ab002b7 # gitsafe:ignore +jerboa_commit=031db15b86a0d3f86caf64241531bd9be37013fe # gitsafe:ignore +jerboa_tree=1c3786138585442c273e05a00daaa50c287af6d8 # gitsafe:ignore gradle_sha=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78 jdk_macos_sha=8fa1eff40bb637a33613b2ccb8b12c70dc3661cc22cf8e784943715769a05336 jdk_linux_sha=d8afc263758141a66e0e3aafc321e783f7016696f4eaea067d340a269037d331 --- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -476,7 +476,8 @@ (typed-kotlin-file "com/sfb/ssdreview/UiTextHelpers.kt" (typed-library (com sfb ssdreview) (export normalizeFiringArc normalizeLabel isGenericGuessLabel isSsdPdfName - sourceBaseName canonicalSourceName isUsefulGuessLabel isErrorStatus) + sourceBaseName canonicalSourceName isUsefulGuessLabel isErrorStatus + formatActivityDuration) (def (normalizeFiringArc (value : String)) : String (string-uppercase (string-trim value))) (def (normalizeLabel (value : String)) : String @@ -519,7 +520,18 @@ (or (or (string-contains? lower "failed") (string-contains? lower "error")) (or (string-contains? lower "exception") - (string-contains? lower "rejected"))))))) + (string-contains? lower "rejected"))))) + (def (formatActivityDuration (ms : Int)) : String + (let ((safe (if (< ms (int 0)) (int 0) ms))) + (if (< safe (int 1000)) + (string-append (int->string safe) " ms") + (let ((seconds (/ safe (int 1000))) + (tenths (mod (/ safe (int 100)) (int 10)))) + (string-append + (int->string seconds) + (string-append + "." + (string-append (int->string tenths) " s"))))))))) (typed-kotlin-file "com/sfb/ssdreview/PathSafety.kt" (typed-library (com sfb ssdreview)