@@ -99,43 +99,49 @@ All examples live in `tests/binary` and are compiled to JVM bytecode & run/teste
9999git clone https://github.com/IntegralPilot/rustc_codegen_jvm.git
100100cd rustc_codegen_jvm
101101
102- # Build everything
103- make all
102+ # Build all components using the build script.
103+ # This single command handles all dependencies and recompiles only what's necessary.
104+
105+ # On Linux or macOS:
106+ ./build.py all
107+
108+ # On Windows, or if the above gives a "permission denied" error:
109+ python3 build.py all
104110```
105111
106- This will compile :
112+ This will intelligently build all necessary components in the correct order :
107113
108- - ` rustc_codegen_jvm ` backend library
109- - ` java-linker `
110- - Kotlin shim for ` core ` (once core support is reached, this will no longer be needed)
111- - Generate ` config.toml ` & ` jvm-unknown-unknown.json `
114+ - The Kotlin library shim (` library/ ` )
115+ - The shim metadata file (` core.json ` )
116+ - The ` java-linker ` executable
117+ - The ` rustc_codegen_jvm ` backend library
118+ - Configuration files (` config.toml ` , ` jvm-unknown-unknown.json ` )
119+ - Vendored dependencies like R8
112120
113- If you relocate the repo, re-run:
114- ``` bash
115- make gen-files
116- ```
121+ The script uses timestamp checking, so subsequent runs of ` ./build.py ` will be very fast, only rebuilding parts of the project that have changed.
117122
118123---
119124
120125## 🚀 Usage
121126
122- 1 . ** Configure your project**
123- In * your* Rust project directory, create or update ` .cargo/config.toml ` by copying the generated template (will be at the root of this repo after running make ). Also, your ` Cargo.toml ` needs to contain the following (used to pass flags differentiating between debug and release builds to the linker):
127+ 1 . ** Configure your project**
128+ In * your* Rust project directory, create or update ` .cargo/config.toml ` by copying the generated template (it will be at the root of this repository after running the build script ). Also, your ` Cargo.toml ` needs to contain the following (used to pass flags differentiating between debug and release builds to the linker):
124129
125- ``` toml
126- cargo-features = [" profile-rustflags" ]
127- ```
130+ ``` toml
131+ cargo-features = [" profile-rustflags" ]
132+ ```
128133
129- 2 . ** Build with Cargo**
130- ``` bash
131- cargo build # debug
132- cargo build --release # optimized
133- ```
134+ 2. **Build with Cargo**
135+ ```bash
136+ cargo build # debug
137+ cargo build --release # optimized
138+ ```
134139
135- 3 . ** Run the ` .jar ` **
136- ``` bash
137- java -jar target/debug/deps/your_crate* .jar
138- ```
140+ 3. **Run the `.jar`**
141+ ```bash
142+ java -jar target/debug/deps/your_crate*.jar # debug
143+ java -jar target/release/deps/your_crate*.jar # release
144+ ```
139145
140146---
141147
@@ -144,16 +150,21 @@ make gen-files
144150Ensure the toolchain is built:
145151
146152```bash
147- make all
148- # If you moved the repo:
149- make gen-files
153+ # On Linux/macOS:
154+ ./build.py all
155+
156+ # On Windows:
157+ python3 build.py all
150158```
151159
152- Then:
160+ Then, run the test suite :
153161
154162``` bash
163+ # Run tests in debug mode
155164python3 Tester.py
156- # or with --release for release‑mode tests
165+
166+ # Run tests in release mode
167+ python3 Tester.py --release
157168```
158169
159170Look for ` ✅ All tests passed! ` or inspect ` .generated ` files on failure.
@@ -164,21 +175,20 @@ Look for `✅ All tests passed!` or inspect `.generated` files on failure.
164175
165176```
166177.
167- ├── src/ # rustc_codegen_jvm backend
178+ ├── src/ # rustc_codegen_jvm backend
168179│ ├── lib.rs
169- │ ├── lower1.rs # MIR → OOMIR
170- │ ├── lower2.rs # OOMIR → JVM bytecode
171- │ └── oomir.rs # OOMIR definitions
172- ├── java-linker/ # Bundles .class files into .jar
173- ├── tests/binary/ # Integration tests
174- ├── library/ # Kotlin shim for Rust core library
175- ├── shim-metadata-gen/ # Generates core.json metadata
176- ├── proguard/ # .pro rules used for r8
177- ├── Makefile # build & gen-files
180+ │ ├── lower1.rs # MIR → OOMIR
181+ │ ├── lower2.rs # OOMIR → JVM bytecode
182+ │ └── oomir.rs # OOMIR definitions
183+ ├── java-linker/ # Bundles .class files into .jar
184+ ├── tests/binary/ # Integration tests
185+ ├── library/ # Kotlin shim for Rust core library
186+ ├── shim-metadata-gen/ # Generates core.json metadata
187+ ├── proguard/ # .pro rules used for r8
188+ ├── build.py # Main build script (replaces Makefile)
178189├── config.toml.template
179190├── jvm-unknown-unknown.json.template
180- ├── Tester.py # test runner
181- ├── GenerateFiles.py # regenerates config & target spec
191+ ├── Tester.py # Test runner script
182192└── LICENSE, LICENSE-Apache
183193```
184194
@@ -192,6 +202,6 @@ Contributions, issues & PRs welcome! :)
192202
193203## 📄 License
194204
195- Dual‑licensed under ** MIT** OR ** Apache 2.0** at your option:
196- < https://opensource.org/licenses/MIT >
197- < https://www.apache.org/licenses/LICENSE-2.0 >
205+ Dual‑licensed under ** MIT** OR ** Apache 2.0** at your option:
206+ < https://opensource.org/licenses/MIT >
207+ < https://www.apache.org/licenses/LICENSE-2.0 >
0 commit comments