rust-anything 2.0.2 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  <p align="center"><b>Rewrite your app in Rust, and prove it still behaves the same.</b></p>
8
8
 
9
- <p align="center">New in 2.0: <a href="docs/real-world.md#prettier">Prettier, ported to Rust</a>. 19x faster · 17,224 recorded runs · 0 mismatches</p>
9
+ <p align="center">New in 2.0: <a href="docs/real-world.md#prettier">Prettier, ported to Rust</a>. 19x faster · 15,837 of 17,224 recorded runs fully in Rust · every run byte-identical</p>
10
10
 
11
11
  <p align="center">
12
12
  <a href="https://crates.io/crates/rust-anything"><img src="https://img.shields.io/crates/v/rust-anything?color=E2862A&label=crates.io" alt="crates.io version"></a>
@@ -53,7 +53,7 @@
53
53
  </table>
54
54
 
55
55
  **Rewrite your whole app in Rust, one piece at a time.** rust-anything records what your
56
- Node.js (TypeScript/JavaScript), Python, C, Go, Ruby or Java app does today, then checks every piece of the
56
+ Node.js (TypeScript/JavaScript), Python, C, Go, Ruby, Java or Kotlin app does today, then checks every piece of the
57
57
  Rust rewrite against that recording before it moves on, until the app is pure Rust. CLIs, HTTP
58
58
  servers and libraries; your coding agent (or you) writes the Rust. It can only catch what the
59
59
  recording covers: see [What it can't catch](docs/how-it-works.md#what-it-cant-catch). Whole tools
@@ -195,17 +195,36 @@ Same output is not enough. Record what the app sends too, and a rewrite that mai
195
195
  | Go | package | typed cgo calls and a generated binary wire, in a package with the original API | a generated Go driver, built as its own module |
196
196
  | Ruby | file or folder of module functions | a magnus extension under the original modules | a generated Ruby driver |
197
197
  | Java | package of `public static` methods | typed JNI and a generated binary wire, in wrapper classes with the original methods | a generated reflection driver |
198
+ | Kotlin | Gradle module of top-level functions and `@JvmStatic` methods | the Java bridge: typed JNI in Java wrapper classes calling the compiled Kotlin statics | a generated reflection driver, with the Kotlin sources compiled by `kotlinc` |
198
199
  | PHP | folder of functions and `public static` methods | coming next: PHP FFI over a C ABI | whole apps today: `app record`, `app replay` and the front door, for CLIs and servers (`php -S`) |
199
200
  | C# | folder of `public static` methods | coming next: P/Invoke over a C ABI | whole apps today: `app record`, `app replay` and the front door, for CLIs and ASP.NET servers (`dotnet <app>.dll`) |
200
201
 
201
202
  Every language except C also gets batch classes (`--batch`): the items cross once and stay in
202
203
  Rust, and each call runs over all of them on all cores.
203
204
 
204
- The language is detected from the repository (`go.mod`, `pom.xml`, a `.csproj` or `.sln`,
205
- `pyproject.toml`, `Gemfile`, `composer.json`, `package.json`, else the most common source files);
206
- `--lang` overrides it. Types come from the source: TS types, Python hints, C, Go, Java and C#
207
- signatures, Ruby YARD tags, PHP types and phpdoc; untyped parameters used as numbers are inferred
208
- as numbers.
205
+ The language is detected from the repository (`go.mod`, `pom.xml`, `build.gradle`/`build.gradle.kts`,
206
+ a `.csproj` or `.sln`, `pyproject.toml`, `Gemfile`, `composer.json`, `package.json`, else the most
207
+ common source files); a Gradle module with `.kt` sources and no `.java` sources is Kotlin, mixed
208
+ modules stay Java. `--lang` overrides it. Types come from the source: TS types, Python hints, C, Go,
209
+ Java, Kotlin and C# signatures, Ruby YARD tags, PHP types and phpdoc; untyped parameters used as
210
+ numbers are inferred as numbers.
211
+
212
+ For Android, `rust-anything build <crate> --profile android` builds the same JNI library with the
213
+ NDK for `arm64-v8a`, `armeabi-v7a` and `x86_64` (or the `--abi` values you pass) and installs it
214
+ into `<crate>/jniLibs/<abi>/`; `--api` sets the API level (minimum 26, which the generated Java
215
+ runtime needs). It finds the NDK from `ANDROID_NDK_HOME`/`ANDROID_NDK_ROOT` or the SDK, needs the
216
+ Rust targets (`rustup target add aarch64-linux-android armv7-linux-androideabi
217
+ x86_64-linux-android`), links 64-bit libraries with 16 KB page alignment, and checks that every
218
+ JNI entry point is exported. Gradle looks in `src/main/jniLibs` by default, so pass
219
+ `--jni-libs app/src/main/jniLibs` or add `<crate>/jniLibs` to `sourceSets.main.jniLibs.srcDirs`.
220
+ `rust-anything record <crate> --profile android` runs the original Kotlin unit under ART on a
221
+ connected device (adb), dexes the generated driver with `d8` from the SDK's build-tools, and pulls
222
+ the results back as the same `cases.jsonl`; `diff <crate> --profile android` replays them against
223
+ the `.so` built for the device's ABI. Both need `adb`, a device, `kotlinc`, an SDK with build-tools
224
+ and a platform, and `--device <serial>` when more than one device is connected. The profile covers
225
+ logic units: Activity/Compose/XML UI, lifecycle and SDK-only classes stay in Kotlin, and each call
226
+ crosses JNI, so prefer the generated batch wrappers for hot loops. On a host, `record` and `diff`
227
+ keep using the desktop JVM.
209
228
 
210
229
  For PHP, `analyze` plans a PHP app (Composer packages and PSR-4 autoloading, risks
211
230
  such as loose comparison and integer overflow into floats, Composer packages mapped to crates),
@@ -247,7 +266,7 @@ comes next.
247
266
  <a href="https://github.com/sponsors/erkamyaman">
248
267
  <picture>
249
268
  <source media="(prefers-color-scheme: dark)" srcset="docs/assets/sponsors/sponsors-dark.svg">
250
- <img src="docs/assets/sponsors/sponsors-light.svg" width="800" alt="Sponsors: Ali Yilmaz, Ashley Hunter, Fatih Uzuntaş">
269
+ <img src="docs/assets/sponsors/sponsors-light.svg" width="800" alt="Sponsors: Santosh Yadav, Hakan Soytürk, Ali Yilmaz, Ashley Hunter, Fatih Uzuntaş">
251
270
  </picture>
252
271
  </a>
253
272
  </p>
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rust-anything",
3
- "version": "2.0.2",
3
+ "version": "2.1.0",
4
4
  "description": "Rewrite your app in Rust, one piece at a time, checked against the original's recorded behavior at every step. TypeScript, Python, C, Go, Ruby, Java.",
5
5
  "keywords": [
6
6
  "rust",