rust-anything 2.0.1 → 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,13 +6,14 @@
|
|
|
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 ·
|
|
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>
|
|
13
13
|
<a href="https://www.npmjs.com/package/rust-anything"><img src="https://img.shields.io/npm/v/rust-anything?color=E2862A&label=npm" alt="npm version"></a>
|
|
14
14
|
<a href="https://github.com/erkamyaman/rust-anything/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/erkamyaman/rust-anything/ci.yml?branch=main&label=tests" alt="Tests"></a>
|
|
15
15
|
<a href="https://github.com/erkamyaman/rust-anything"><img src="https://img.shields.io/github/stars/erkamyaman/rust-anything?style=social" alt="GitHub stars"></a>
|
|
16
|
+
<a href="https://github.com/AIshihzong/awesome-reverse-engineer-anything"><img src="https://img.shields.io/badge/Featured%20in-Awesome%20REA-f0b429" alt="Featured in Awesome REA"></a>
|
|
16
17
|
</p>
|
|
17
18
|
|
|
18
19
|
<p align="center">
|
|
@@ -52,7 +53,7 @@
|
|
|
52
53
|
</table>
|
|
53
54
|
|
|
54
55
|
**Rewrite your whole app in Rust, one piece at a time.** rust-anything records what your
|
|
55
|
-
Node.js (TypeScript/JavaScript), Python, C, Go, Ruby or
|
|
56
|
+
Node.js (TypeScript/JavaScript), Python, C, Go, Ruby, Java or Kotlin app does today, then checks every piece of the
|
|
56
57
|
Rust rewrite against that recording before it moves on, until the app is pure Rust. CLIs, HTTP
|
|
57
58
|
servers and libraries; your coding agent (or you) writes the Rust. It can only catch what the
|
|
58
59
|
recording covers: see [What it can't catch](docs/how-it-works.md#what-it-cant-catch). Whole tools
|
|
@@ -194,17 +195,36 @@ Same output is not enough. Record what the app sends too, and a rewrite that mai
|
|
|
194
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 |
|
|
195
196
|
| Ruby | file or folder of module functions | a magnus extension under the original modules | a generated Ruby driver |
|
|
196
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` |
|
|
197
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`) |
|
|
198
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`) |
|
|
199
201
|
|
|
200
202
|
Every language except C also gets batch classes (`--batch`): the items cross once and stay in
|
|
201
203
|
Rust, and each call runs over all of them on all cores.
|
|
202
204
|
|
|
203
|
-
The language is detected from the repository (`go.mod`, `pom.xml`,
|
|
204
|
-
`pyproject.toml`, `Gemfile`, `composer.json`, `package.json`, else the most
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
as
|
|
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.
|
|
208
228
|
|
|
209
229
|
For PHP, `analyze` plans a PHP app (Composer packages and PSR-4 autoloading, risks
|
|
210
230
|
such as loose comparison and integer overflow into floats, Composer packages mapped to crates),
|
|
@@ -246,7 +266,7 @@ comes next.
|
|
|
246
266
|
<a href="https://github.com/sponsors/erkamyaman">
|
|
247
267
|
<picture>
|
|
248
268
|
<source media="(prefers-color-scheme: dark)" srcset="docs/assets/sponsors/sponsors-dark.svg">
|
|
249
|
-
<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ş">
|
|
250
270
|
</picture>
|
|
251
271
|
</a>
|
|
252
272
|
</p>
|
|
Binary file
|
|
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
|
|
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",
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"codex"
|
|
15
15
|
],
|
|
16
16
|
"license": "MIT",
|
|
17
|
+
"mcpName": "io.github.erkamyaman/rust-anything",
|
|
17
18
|
"repository": {
|
|
18
19
|
"type": "git",
|
|
19
20
|
"url": "git+https://github.com/erkamyaman/rust-anything.git"
|