Skip to content

Commit 9190d96

Browse files
feat(sdks): standardize useLocalNatives toggle + fix Flutter/RN PR triggers
Two things: 1. Standardize the local-vs-remote toggle across all 5 client SDKs on the name `useLocalNatives`. Previously each SDK had its own name: Swift `useLocalBinaries`, Kotlin `runanywhere.testLocal`, Flutter `testLocal`, RN `runanywhere.testLocal`. Now: - Swift: Package.swift `let useLocalNatives` + build-swift.sh uses the new name end to end. - Kotlin: gradle.properties `runanywhere.useLocalNatives` (primary) with `runanywhere.testLocal` accepted as a legacy fallback that emits a deprecation warning. Top-level + both module gradles updated. - Flutter: binary_config.gradle declares `useLocalNatives` as the canonical ext var; `testLocal` is set to the same value as an alias so existing references keep working. All 4 package configs (runanywhere, runanywhere_llamacpp, runanywhere_onnx, runanywhere_genie) updated. Podspec headers relabeled. - React Native: android/build.gradle prefers `runanywhere.useLocalNatives`, falls back to the legacy `runanywhere.testLocal`. All 3 package gradles updated. Podspecs relabeled. External SPM/Gradle consumers of these SDKs are unaffected — they don't reference these toggles. 2. Fix Flutter + React Native SDK PR-build triggering in pr-build.yml. Previously they fired only on their own SDK-path changes. But both consume iOS AND Android natives, so they should also fire whenever either native-build job succeeds. Matches the Swift/Kotlin/Web pattern already in place. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 0cf0976 commit 9190d96

19 files changed

Lines changed: 137 additions & 71 deletions

File tree

.github/workflows/pr-build.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -354,8 +354,15 @@ jobs:
354354
run: npm run typecheck
355355

356356
sdk_flutter:
357-
needs: detect
358-
if: needs.detect.outputs.sdk_flutter == 'true'
357+
# Flutter consumes BOTH iOS and Android natives, so fire whenever either
358+
# native-build job succeeded on this run, OR when Flutter SDK paths changed.
359+
needs: [detect, native_ios, native_android]
360+
if: |
361+
always() && (
362+
needs.detect.outputs.sdk_flutter == 'true' ||
363+
needs.native_ios.result == 'success' ||
364+
needs.native_android.result == 'success'
365+
)
359366
runs-on: ubuntu-latest
360367
timeout-minutes: 25
361368
steps:
@@ -374,8 +381,15 @@ jobs:
374381
done
375382
376383
sdk_react_native:
377-
needs: detect
378-
if: needs.detect.outputs.sdk_react_native == 'true'
384+
# React Native consumes BOTH iOS and Android natives, so fire whenever either
385+
# native-build job succeeded on this run, OR when RN SDK paths changed.
386+
needs: [detect, native_ios, native_android]
387+
if: |
388+
always() && (
389+
needs.detect.outputs.sdk_react_native == 'true' ||
390+
needs.native_ios.result == 'success' ||
391+
needs.native_android.result == 'success'
392+
)
379393
runs-on: ubuntu-latest
380394
timeout-minutes: 25
381395
steps:

Package.swift

Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,35 @@ import Foundation
2525
// BINARY TARGET CONFIGURATION
2626
// =============================================================================
2727
//
28-
// useLocalBinaries = true → Use local XCFrameworks from sdk/runanywhere-swift/Binaries/
29-
// For local development. Run first-time setup:
30-
// cd sdk/runanywhere-swift && ./scripts/build-swift.sh --setup
28+
// useLocalNatives = true → Use local XCFrameworks from sdk/runanywhere-swift/Binaries/
29+
// For local development. Run first-time setup:
30+
// cd sdk/runanywhere-swift && ./scripts/build-swift.sh --setup
3131
//
32-
// useLocalBinaries = false → Download XCFrameworks from GitHub releases (PRODUCTION)
33-
// For external users via SPM. No setup needed.
32+
// useLocalNatives = false → Download XCFrameworks from GitHub releases (PRODUCTION)
33+
// For external users via SPM. No setup needed.
3434
//
3535
// To toggle this value, use:
36-
// ./scripts/build-swift.sh --set-local (sets useLocalBinaries = true)
37-
// ./scripts/build-swift.sh --set-remote (sets useLocalBinaries = false)
36+
// ./scripts/build-swift.sh --set-local (sets useLocalNatives = true)
37+
// ./scripts/build-swift.sh --set-remote (sets useLocalNatives = false)
3838
//
39+
// Historical name: this used to be called `useLocalBinaries`. The concept is
40+
// the same — it's been renamed to `useLocalNatives` for consistency with the
41+
// equivalent toggle in the other client SDKs (Kotlin, Flutter, React Native).
3942
// =============================================================================
40-
let useLocalBinaries = false // Toggle: true for local dev, false for release
43+
let useLocalNatives = false // Toggle: true for local dev, false for release
4144

42-
// Version for remote XCFrameworks (used when testLocal = false)
45+
// Version for remote XCFrameworks (used when useLocalNatives = false)
4346
// Updated automatically by CI/CD during releases
4447
let sdkVersion = "0.19.7"
4548

4649
// MetalRT remote binary availability flag.
4750
// Set to `false` until a real checksum for RABackendMetalRT-v<sdkVersion>.zip
4851
// has been published. When `false`, the MetalRT product/targets are only
49-
// exposed under `useLocalBinaries = true`, so SPM resolution will not fail
52+
// exposed under `useLocalNatives = true`, so SPM resolution will not fail
5053
// for external consumers due to a placeholder checksum.
5154
let metalrtRemoteBinaryAvailable = false
5255

53-
let includeMetalRT = useLocalBinaries || metalrtRemoteBinaryAvailable
56+
let includeMetalRT = useLocalNatives || metalrtRemoteBinaryAvailable
5457

5558
let package = Package(
5659
name: "runanywhere-sdks",
@@ -241,7 +244,7 @@ let package = Package(
241244
// with a real checksum. To avoid SPM resolution failures for external
242245
// consumers due to a placeholder zero-checksum binary target, the MetalRT
243246
// product and its dependent targets are only included when:
244-
// - `useLocalBinaries == true` (local dev with a checked-out xcframework), or
247+
// - `useLocalNatives == true` (local dev with a checked-out xcframework), or
245248
// - `metalrtRemoteBinaryAvailable == true` (once a real checksum is wired in).
246249
func metalRTProducts() -> [Product] {
247250
guard includeMetalRT else { return [] }
@@ -290,9 +293,9 @@ func metalRTTargets() -> [Target] {
290293
// =============================================================================
291294
// BINARY TARGET SELECTION
292295
// =============================================================================
293-
// Returns local or remote binary targets based on useLocalBinaries setting
296+
// Returns local or remote binary targets based on useLocalNatives setting
294297
func binaryTargets() -> [Target] {
295-
if useLocalBinaries {
298+
if useLocalNatives {
296299
// =====================================================================
297300
// LOCAL DEVELOPMENT MODE
298301
// Use XCFrameworks from sdk/runanywhere-swift/Binaries/

sdk/runanywhere-flutter/packages/runanywhere/android/binary_config.gradle

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,24 @@
22
// BINARY CONFIGURATION FOR RUNANYWHERE FLUTTER SDK - ANDROID (Core Package)
33
// =============================================================================
44
// This file controls whether to use local or remote native libraries (.so files).
5-
// Similar to Swift Package.swift's testLocal flag.
5+
// Matches Swift Package.swift's `useLocalNatives` and Kotlin gradle property
6+
// `runanywhere.useLocalNatives` — same semantics across all 5 SDKs.
67
//
78
// Set to `true` to use local binaries from android/src/main/jniLibs/
89
// Set to `false` to download binaries from GitHub releases (production mode)
10+
//
11+
// Legacy name `testLocal` is still accepted as an alias.
912
// =============================================================================
1013

1114
ext {
12-
// Set this to true for local development/testing
13-
// Set to false for production builds (downloads from GitHub releases)
14-
testLocal = false
15+
// Canonical name (matches Swift/Kotlin/RN).
16+
// Set this to true for local development/testing.
17+
// Set to false for production builds (downloads from GitHub releases).
18+
useLocalNatives = false
19+
20+
// Legacy alias — kept so existing code reading `testLocal` keeps working.
21+
// Prefer `useLocalNatives`.
22+
testLocal = useLocalNatives
1523

1624
// =============================================================================
1725
// Version Configuration (MUST match Swift Package.swift and Kotlin build.gradle.kts)

sdk/runanywhere-flutter/packages/runanywhere/ios/runanywhere.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ GITHUB_ORG = "RunanywhereAI"
2424
COMMONS_REPO = "runanywhere-sdks"
2525

2626
# =============================================================================
27-
# testLocal Toggle
27+
# useLocalNatives Toggle (canonical name; testLocal kept as legacy alias)
2828
# Set RA_TEST_LOCAL=1 or create .testlocal file to use local binaries
2929
# =============================================================================
3030
TEST_LOCAL = ENV['RA_TEST_LOCAL'] == '1' || File.exist?(File.join(__dir__, '.testlocal'))

sdk/runanywhere-flutter/packages/runanywhere_genie/android/binary_config.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
ext {
1212
// Set this to true for local development/testing
1313
// Set to false for production builds (downloads from GitHub releases)
14-
testLocal = false
14+
useLocalNatives = false
15+
testLocal = useLocalNatives // legacy alias
1516

1617
// =============================================================================
1718
// Version Configuration (MUST match Swift Package.swift and Kotlin build.gradle.kts)

sdk/runanywhere-flutter/packages/runanywhere_llamacpp/android/binary_config.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
ext {
1212
// Set this to true for local development/testing
1313
// Set to false for production builds (downloads from GitHub releases)
14-
testLocal = false
14+
useLocalNatives = false
15+
testLocal = useLocalNatives // legacy alias
1516

1617
// =============================================================================
1718
// Version Configuration (MUST match Swift Package.swift and Kotlin build.gradle.kts)

sdk/runanywhere-flutter/packages/runanywhere_llamacpp/ios/runanywhere_llamacpp.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ GITHUB_ORG = "RunanywhereAI"
2323
BINARIES_REPO = "runanywhere-sdks"
2424

2525
# =============================================================================
26-
# testLocal Toggle
26+
# useLocalNatives Toggle (canonical name; testLocal kept as legacy alias)
2727
# Set RA_TEST_LOCAL=1 or create .testlocal file to use local binaries
2828
# =============================================================================
2929
TEST_LOCAL = ENV['RA_TEST_LOCAL'] == '1' || File.exist?(File.join(__dir__, '.testlocal'))

sdk/runanywhere-flutter/packages/runanywhere_onnx/android/binary_config.gradle

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@
1111
ext {
1212
// Set this to true for local development/testing
1313
// Set to false for production builds (downloads from GitHub releases)
14-
testLocal = false
14+
useLocalNatives = false
15+
testLocal = useLocalNatives // legacy alias
1516

1617
// =============================================================================
1718
// Version Configuration (MUST match Swift Package.swift and Kotlin build.gradle.kts)

sdk/runanywhere-flutter/packages/runanywhere_onnx/ios/runanywhere_onnx.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ GITHUB_ORG = "RunanywhereAI"
2929
BINARIES_REPO = "runanywhere-sdks"
3030

3131
# =============================================================================
32-
# testLocal Toggle
32+
# useLocalNatives Toggle (canonical name; testLocal kept as legacy alias)
3333
# Set RA_TEST_LOCAL=1 or create .testlocal file to use local binaries
3434
# =============================================================================
3535
TEST_LOCAL = ENV['RA_TEST_LOCAL'] == '1' || File.exist?(File.join(__dir__, '.testlocal'))

sdk/runanywhere-kotlin/build.gradle.kts

Lines changed: 21 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,28 @@ version = resolvedVersion
5757
logger.lifecycle("RunAnywhere SDK version: $resolvedVersion (JitPack=$isJitPack)")
5858

5959
// JNI library mode:
60-
// testLocal=true → locally built libs from src/androidMain/jniLibs/ (run ./scripts/build-kotlin.sh --setup)
61-
// testLocal=false → download pre-built libs from GitHub releases
62-
// rootProject checked first to support composite builds (app's gradle.properties takes precedence)
63-
val testLocal: Boolean =
64-
rootProject.findProperty("runanywhere.testLocal")?.toString()?.toBoolean()
60+
// useLocalNatives=true → locally built libs from src/androidMain/jniLibs/ (run ./scripts/build-kotlin.sh --setup)
61+
// useLocalNatives=false → download pre-built libs from GitHub releases
62+
// rootProject checked first to support composite builds (app's gradle.properties takes precedence).
63+
// Legacy name `runanywhere.testLocal` still works as a fallback — emit a
64+
// deprecation warning so people migrate to the new name over time.
65+
val useLocalNatives: Boolean = run {
66+
val newValue = rootProject.findProperty("runanywhere.useLocalNatives")?.toString()?.toBoolean()
67+
?: project.findProperty("runanywhere.useLocalNatives")?.toString()?.toBoolean()
68+
if (newValue != null) return@run newValue
69+
val legacyValue = rootProject.findProperty("runanywhere.testLocal")?.toString()?.toBoolean()
6570
?: project.findProperty("runanywhere.testLocal")?.toString()?.toBoolean()
66-
?: false
71+
if (legacyValue != null) {
72+
logger.lifecycle(
73+
"DEPRECATION: `runanywhere.testLocal` is deprecated; use " +
74+
"`runanywhere.useLocalNatives` instead (same values)"
75+
)
76+
return@run legacyValue
77+
}
78+
false
79+
}
80+
// Alias kept so existing call sites below read the same value without churn.
81+
val testLocal: Boolean = useLocalNatives
6782

6883
// rebuildCommons=true → force rebuild of runanywhere-commons C++ code
6984
val rebuildCommons: Boolean =

0 commit comments

Comments
 (0)