diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.sh index 35cddfb3b4..c3c873bcca 100755 --- a/.claude/hooks/session-start.sh +++ b/.claude/hooks/session-start.sh @@ -174,6 +174,43 @@ if [ -n "${CLAUDE_ENV_FILE:-}" ]; then echo "export PATH=\$PATH:$ANDROID_SDK_DIR/platform-tools" >> "$CLAUDE_ENV_FILE" fi +# --- Kotlin/Native: pre-install native dependencies (GCC sysroot, LLDB) --- +# The K/N compiler downloads these on first use, but that fails through the proxy. +# Pre-download them so K/N benchmarks and linuxX64 compilation work out of the box. +KONAN_DIR="/root/.konan" +KONAN_DEPS_URL="https://download.jetbrains.com/kotlin/native" +KONAN_DEPS_DIR="$KONAN_DIR/dependencies" + +install_konan_dep() { + local dep_name="$1" + local url="$2" # full download URL + # Already extracted? + if [ -d "$KONAN_DEPS_DIR/$dep_name" ]; then + return 0 + fi + local archive="$dep_name.tar.gz" + local cache_dir="$KONAN_DEPS_DIR/cache" + mkdir -p "$cache_dir" + if [ ! -f "$cache_dir/$archive" ]; then + echo "Downloading K/N dependency $dep_name..." + curl -fsSL "$url" -o "$cache_dir/$archive" || { + echo "Failed to download $dep_name" >&2; return 1 + } + fi + echo "Extracting $dep_name..." + tar -xzf "$cache_dir/$archive" -C "$KONAN_DEPS_DIR" +} + +# Dependencies for linuxX64 target (from konan.properties for Kotlin 2.3.20) +install_konan_dep "x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2" \ + "$KONAN_DEPS_URL/x86_64-unknown-linux-gnu-gcc-8.3.0-glibc-2.19-kernel-4.9-2.tar.gz" +install_konan_dep "lldb-4-linux" \ + "$KONAN_DEPS_URL/lldb-4-linux.tar.gz" +install_konan_dep "llvm-19-x86_64-linux-essentials-109" \ + "$KONAN_DEPS_URL/resources/llvm/19-x86_64-linux/llvm-19-x86_64-linux-essentials-109.tar.gz" +install_konan_dep "libffi-3.2.1-2-linux-x86-64" \ + "$KONAN_DEPS_URL/libffi-3.2.1-2-linux-x86-64.tar.gz" + cd "$CLAUDE_PROJECT_DIR" ./gradlew --version > /dev/null 2>&1 diff --git a/quartz/benchmarks/run_all.sh b/quartz/benchmarks/run_all.sh index 72fa418019..8442f327d0 100755 --- a/quartz/benchmarks/run_all.sh +++ b/quartz/benchmarks/run_all.sh @@ -82,26 +82,25 @@ fi echo "" # ============================================================================ -# 2. Kotlin/Native benchmark (Linux and macOS) +# 2. Kotlin/Native benchmark # ============================================================================ -echo "=== Running Kotlin/Native benchmark ===" -case "$OS_NAME" in - Linux) - KN_TARGET="linuxX64Test" - ;; - Darwin) - KN_TARGET="macosArm64Test" - ;; -esac +# macosArm64 target is blocked until negentropy-kmp publishes a macosArm64 +# artifact. Once unblocked, add: Darwin) KN_TARGET="macosArm64Test" ;; +if [ "$OS_NAME" = "Linux" ]; then + echo "=== Running Kotlin/Native benchmark ===" + KN_TARGET="linuxX64Test" -"$ROOT/gradlew" -p "$ROOT" ":quartz:$KN_TARGET" --tests "*.Secp256k1NativeBenchmark" \ - 2>/dev/null || true + "$ROOT/gradlew" -p "$ROOT" ":quartz:$KN_TARGET" --tests "*.Secp256k1NativeBenchmark" \ + 2>/dev/null || true -KN_XML="$ROOT/quartz/build/test-results/$KN_TARGET/TEST-${KN_TARGET}.com.vitorpamplona.quartz.utils.secp256k1.Secp256k1NativeBenchmark.xml" -if [ -f "$KN_XML" ]; then - sed -n '//p' "$KN_XML" | grep -v 'CDATA\|]]>' + KN_XML="$ROOT/quartz/build/test-results/$KN_TARGET/TEST-${KN_TARGET}.com.vitorpamplona.quartz.utils.secp256k1.Secp256k1NativeBenchmark.xml" + if [ -f "$KN_XML" ]; then + sed -n '//p' "$KN_XML" | grep -v 'CDATA\|]]>' + else + echo "K/Native benchmark XML not found." + fi else - echo "K/Native benchmark XML not found." + echo "=== Skipping Kotlin/Native benchmark (only linuxX64 target available) ===" fi echo "" diff --git a/quartz/build.gradle.kts b/quartz/build.gradle.kts index 1a852bca82..5d7d8ac194 100644 --- a/quartz/build.gradle.kts +++ b/quartz/build.gradle.kts @@ -87,7 +87,7 @@ kotlin { linuxX64() - macosArm64() + // macosArm64() — blocked until negentropy-kmp publishes a macosArm64 artifact // This makes sure that the resource file directory is visible for iOS tests. val rootDir = "${rootProject.rootDir.path}/quartz/src/commonTest/resources" @@ -299,23 +299,8 @@ kotlin { dependsOn(iosTest.get()) } - val macosMain = - create("macosMain") { - dependsOn(appleMain) - } - - val macosTest = - create("macosTest") { - dependsOn(appleTest) - } - - val macosArm64Main by getting { - dependsOn(macosMain) - } - - val macosArm64Test by getting { - dependsOn(macosTest) - } + // macosMain/macosTest source sets exist but are not wired until + // negentropy-kmp publishes a macosArm64 artifact. val linuxMain = create("linuxMain") {