Move SSD race key helper to typed Kotlin
ober
80c2cbc976bd65173a20a51330dd5f8d0d53cdf7
--- 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#42cdf9570d7e13fc7d728d7109e9465a1a5d16ba" + - "https://git.sr.ht/~lisp/jerboa#f45108d14ad656e9d8ca9b8e1e62fa3c13737550" # 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)" = 42cdf9570d7e13fc7d728d7109e9465a1a5d16ba - test "$(git -C ../jerboa rev-parse 'HEAD^{tree}')" = 4b8530cc73186492d38a7cf1ce6d7b4834c02d01 + test "$(git -C ../jerboa rev-parse HEAD)" = f45108d14ad656e9d8ca9b8e1e62fa3c13737550 + test "$(git -C ../jerboa rev-parse 'HEAD^{tree}')" = e67c73e5e76814eba949ec49ac02ea0162ce7c02 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": "42cdf9570d7e13fc7d728d7109e9465a1a5d16ba", - "tree": "4b8530cc73186492d38a7cf1ce6d7b4834c02d01" + "commit": "f45108d14ad656e9d8ca9b8e1e62fa3c13737550", + "tree": "e67c73e5e76814eba949ec49ac02ea0162ce7c02" }, "assurance_tools": { "osv_scanner": { --- a/full-kotlin.md +++ b/full-kotlin.md @@ -43,7 +43,7 @@ The vendored Jerboa tree already has the right starting point: Do not fork that model inside `jandroid.ss`. General Kotlin backend work belongs in Jerboa. Android project and Android DSL work belongs in `jerboa-android`. -Version caveat: this repository now pins Jerboa commit `42cdf9570d7e13fc7d728d7109e9465a1a5d16ba`, tree `4b8530cc73186492d38a7cf1ce6d7b4834c02d01`. Before editing compiler APIs, check out the exact pinned commit (or the intended replacement commit), rerun the typed parser/checker/core inventory, and record any differences. Do not assume two Jerboa snapshots expose identical IR. +Version caveat: this repository now pins Jerboa commit `f45108d14ad656e9d8ca9b8e1e62fa3c13737550`, tree `e67c73e5e76814eba949ec49ac02ea0162ce7c02`. Before editing compiler APIs, check out the exact pinned commit (or the intended replacement commit), rerun the typed parser/checker/core inventory, and record any differences. Do not assume two Jerboa snapshots expose identical IR. ### 2.3 `~/sfb` source requirements --- 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=42cdf9570d7e13fc7d728d7109e9465a1a5d16ba # gitsafe:ignore -jerboa_tree=4b8530cc73186492d38a7cf1ce6d7b4834c02d01 # gitsafe:ignore +jerboa_commit=f45108d14ad656e9d8ca9b8e1e62fa3c13737550 # gitsafe:ignore +jerboa_tree=e67c73e5e76814eba949ec49ac02ea0162ce7c02 # gitsafe:ignore gradle_sha=20f1b1176237254a6fc204d8434196fa11a4cfb387567519c61556e8710aed78 jdk_macos_sha=8fa1eff40bb637a33613b2ccb8b12c70dc3661cc22cf8e784943715769a05336 jdk_linux_sha=d8afc263758141a66e0e3aafc321e783f7016696f4eaea067d340a269037d331 --- a/templates/ssd-review.ss +++ b/templates/ssd-review.ss @@ -200,6 +200,33 @@ (string-pad-start (int32->string page) (int32 4) #\0) (string-append "-d" (int32->string dpi)))))))) + (typed-kotlin-file "com/sfb/ssdreview/RaceKey.kt" + (typed-library (com sfb ssdreview) + (export raceKey) + (def (raceKey (text : String)) : String + (let ((lower (string-lowercase text))) + (if (or (string-contains? lower "andromedan") + (or (string-contains? lower "module_c3") + (string-contains? lower "module c3"))) + "andromedan" + (if (string-contains? lower "federation") + "federation" + (if (string-contains? lower "klingon") + "klingon" + (if (string-contains? lower "romulan") + "romulan" + (if (string-contains? lower "gorn") + "gorn" + (if (string-contains? lower "kzinti") + "kzinti" + (if (string-contains? lower "lyran") + "lyran" + (if (string-contains? lower "tholian") + "tholian" + (if (string-contains? lower "hydran") + "hydran" + ""))))))))))))) + (typed-kotlin-file "com/sfb/ssdreview/NativeDetection.kt" (typed-library (com sfb ssdreview) (export make-NativeDetection NativeDetection? @@ -541,22 +568,6 @@ " rx < 0.30f -> \"shield-6\"" " else -> \"shield\"" " }" - "" - " private fun raceKey(text: String): String {" - " val lower = text.lowercase()" - " return when {" - " lower.contains(\"andromedan\") || lower.contains(\"module_c3\") || lower.contains(\"module c3\") -> \"andromedan\"" - " lower.contains(\"federation\") -> \"federation\"" - " lower.contains(\"klingon\") -> \"klingon\"" - " lower.contains(\"romulan\") -> \"romulan\"" - " lower.contains(\"gorn\") -> \"gorn\"" - " lower.contains(\"kzinti\") -> \"kzinti\"" - " lower.contains(\"lyran\") -> \"lyran\"" - " lower.contains(\"tholian\") -> \"tholian\"" - " lower.contains(\"hydran\") -> \"hydran\"" - " else -> \"\"" - " }" - " }" "}" "" )) @@ -3186,22 +3197,6 @@ " .replace(Regex(\"\\\\s+\"), \" \")" "" " private fun compact(value: String): String = value.lowercase().filter { it.isLetterOrDigit() }" - "" - " private fun raceKey(text: String): String {" - " val lower = text.lowercase()" - " return when {" - " lower.contains(\"andromedan\") || lower.contains(\"module_c3\") || lower.contains(\"module c3\") -> \"andromedan\"" - " lower.contains(\"federation\") -> \"federation\"" - " lower.contains(\"klingon\") -> \"klingon\"" - " lower.contains(\"romulan\") -> \"romulan\"" - " lower.contains(\"gorn\") -> \"gorn\"" - " lower.contains(\"kzinti\") -> \"kzinti\"" - " lower.contains(\"lyran\") -> \"lyran\"" - " lower.contains(\"tholian\") -> \"tholian\"" - " lower.contains(\"hydran\") -> \"hydran\"" - " else -> \"\"" - " }" - " }" "}" )) (kotlin-file-lines "com/sfb/ssdreview/SsdReviewView.kt"