| 1 | #!/bin/sh |
| 2 | set -eu |
| 3 | cd "$(dirname "$0")/.." |
| 4 | # Use a pinned Kotlin installation, or an explicitly selected cached Gradle library. |
| 5 | if command -v kotlinc >/dev/null 2>&1; then |
| 6 | kotlinc android/PetSim.kt android/Conformance.kt -include-runtime -d android/conformance.jar |
| 7 | kotlin_classpath=android/conformance.jar |
| 8 | elif [ -n "${PET_KOTLIN_LIB:-}" ]; then |
| 9 | java -cp "$PET_KOTLIN_LIB/*" org.jetbrains.kotlin.cli.jvm.K2JVMCompiler -no-stdlib -no-reflect -classpath "$PET_KOTLIN_LIB/kotlin-stdlib-2.3.0.jar" -d android/conformance.jar android/PetSim.kt android/Conformance.kt |
| 10 | kotlin_classpath="android/conformance.jar:$PET_KOTLIN_LIB/kotlin-stdlib-2.3.0.jar" |
| 11 | else |
| 12 | printf '%s\n' 'Kotlin compiler missing: install Kotlin 2.3.0 or set PET_KOTLIN_LIB to its cached Gradle lib directory.' >&2 |
| 13 | exit 1 |
| 14 | fi |
| 15 | for expression in v1 v2; do |
| 16 | for tape in tape.tsv tapes/edge-cases.tsv; do |
| 17 | case "$tape" in tape.tsv) name=baseline ;; *) name=edge-cases ;; esac |
| 18 | for mode in animated reduced-motion; do |
| 19 | set -- |
| 20 | if [ "$mode" = reduced-motion ]; then set -- --reduced-motion; fi |
| 21 | if [ "$expression" = v1 ]; then set -- "$@" --legacy; fi |
| 22 | java -cp "$kotlin_classpath" codewhale.pet.ConformanceKt whale-points.tsv "$@" < "$tape" > "conformance-results/$expression-$name-$mode-kotlin.txt" |
| 23 | diff -u "conformance-results/$expression-$name-$mode-ts.txt" "conformance-results/$expression-$name-$mode-kotlin.txt" |
| 24 | printf 'PASS Kotlin %s %s %s\n' "$expression" "$name" "$mode" |
| 25 | done |
| 26 | done |
| 27 | done |
| 28 |