Skip to content

Commit 24ed0bf

Browse files
bravitFabianLars
andauthored
docs: Migrate the debugging guide to RustRover (tauri-apps#1800) (tauri-apps#1802)
* Migrate the debugging guide to RustRover (tauri-apps#1800) * Update the corresponding non-en pages * Apply suggestions from code review --------- Co-authored-by: Fabian-Lars <[email protected]>
1 parent 00dd216 commit 24ed0bf

28 files changed

+385
-273
lines changed

docs/guides/debugging/clion.md

-57
This file was deleted.

docs/guides/debugging/rustrover.md

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Debugging in RustRover
2+
3+
In this guide, we’ll be setting up JetBrains RustRover for debugging the [Core Process of your Tauri app].
4+
5+
## Setting up a Cargo project
6+
7+
Depending on which frontend stack is used in a project, the project directory may or may not be a Cargo project. By default, Tauri places the Rust project in a subdirectory called `src-tauri`. It creates a Cargo project in the root directory only if Rust is used for frontend development as well.
8+
9+
If there's no `Cargo.toml` file at the top level, you need to attach the project manually. Open the Cargo tool window (in the main menu, go to **View | Tool Windows | Cargo**), click **+** (**Attach Cargo Project**) on the toolbar, and select the `src-tauri/Cargo.toml` file.
10+
11+
Alternatively, you could create a top-level Cargo workspace manually by adding the following file to the project's root directory:
12+
13+
```toml title=Cargo.toml
14+
[workspace]
15+
members = ["src-tauri"]
16+
```
17+
18+
Before you proceed, make sure that your project is fully loaded. If the Cargo tool window shows all the modules and targets of the workspace, you’re good to go.
19+
20+
## Setting up Run Configurations
21+
22+
You will need to set up two separate Run/Debug configurations:
23+
* one for launching the Tauri app in debugging mode,
24+
* another one for running your frontend development server of choice.
25+
26+
### Tauri App
27+
28+
1. In the main menu, go to **Run | Edit Configurations**.
29+
2. In the **Run/Debug Configurations** dialog:
30+
* To create a new configuration, click **+** on the toolbar and select **Cargo**.
31+
32+
![Add Run/Debug Configuration](/img/guides/debugging/rustrover/add-cargo-config-light.png#gh-light-mode-only)
33+
![Add Run/Debug Configuration](/img/guides/debugging/rustrover/add-cargo-config-dark.png#gh-dark-mode-only)
34+
35+
With that created, we need to configure RustRover, so it instructs Cargo to build our app without any default features. This will tell Tauri to use your development server instead of reading assets from the disk. Normally this flag is passed by the Tauri CLI, but since we're completely sidestepping that here, we need to pass the flag manually.
36+
37+
![Add `--no-default-features` flag](/img/guides/debugging/rustrover/set-no-default-features-light.png#gh-light-mode-only)
38+
![Add `--no-default-features` flag](/img/guides/debugging/rustrover/set-no-default-features-dark.png#gh-dark-mode-only)
39+
40+
Now we can optionally rename the Run/Debug Configuration to something more memorable, in this example we called it "Run Tauri App", but you can name it whatever you want.
41+
42+
![Rename Configuration](/img/guides/debugging/rustrover/rename-configuration-light.png#gh-light-mode-only)
43+
![Rename Configuration](/img/guides/debugging/rustrover/rename-configuration-dark.png#gh-dark-mode-only)
44+
45+
### Development Server
46+
47+
The above configuration will use Cargo directly to build the Rust application and attach the debugger to it. This means we completely sidestep the Tauri CLI, so features like the `beforeDevCommand` and `beforeBuildCommand` will **not** be executed. We need to take care of that by running the development server manually.
48+
49+
To create the corresponding Run configuration, you need to check the actual development server in use. Look for the `src-tauri/tauri.conf.json` file and find the following line:
50+
51+
```json
52+
"beforeDevCommand": "pnpm dev"
53+
```
54+
55+
For `npm`, `pnpm`, or `yarn`, you could use the **npm** Run Configuration, for example:
56+
57+
![NPM Configuration](/img/guides/debugging/rustrover/npm-configuration-light.png#gh-light-mode-only)
58+
![NPM Configuration](/img/guides/debugging/rustrover/npm-configuration-dark.png#gh-dark-mode-only)
59+
60+
Make sure you have the correct values in the **Command**, **Scripts**, and **Package Manager** fields.
61+
62+
If your development server is `trunk` for Rust-based WebAssembly frontend frameworks, you could use the generic **Shell Script** Run Configuration:
63+
64+
![Trunk Serve Configuration](/img/guides/debugging/rustrover/trunk-configuration-light.png#gh-light-mode-only)
65+
![Trunk Serve Configuration](/img/guides/debugging/rustrover/trunk-configuration-dark.png#gh-dark-mode-only)
66+
67+
68+
## Launching a Debugging Session
69+
70+
To launch a debugging session, you first need to run your development server, and then start debugging the Tauri App by clicking the **Debug** button next to the Run Configurations Switcher. RustRover will automatically recognize breakpoints placed in any Rust file in your project and stop on the first one hit.
71+
72+
![Debug Session](/img/guides/debugging/rustrover/debug-session-light.png#gh-light-mode-only)
73+
![Debug Session](/img/guides/debugging/rustrover/debug-session-dark.png#gh-dark-mode-only)
74+
75+
From this point, you can explore the values of your variables, step further into the code, and check what's going at runtime in detail.
76+
77+
[core process of your tauri app]: ../../references/architecture/process-model.md#the-core-process

i18n/fr/docusaurus-plugin-content-docs/current/guides/debugging/clion.md

-54
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
# Debugging in RustRover
2+
3+
In this guide, we’ll be setting up JetBrains RustRover for debugging the [Core Process of your Tauri app].
4+
5+
## Setting up a Cargo project
6+
7+
Depending on which frontend stack is used in a project, the project directory may or may not be a Cargo project. By default, Tauri places the Rust project in a subdirectory called `src-tauri`. It creates a Cargo project in the root directory only if Rust is used for frontend development as well.
8+
9+
If there's no `Cargo.toml` file at the top level, you need to attach the project manually. Open the Cargo tool window (in the main menu, go to **View | Tool Windows | Cargo**), click **+** (**Attach Cargo Project**) on the toolbar, and select the `src-tauri/Cargo.toml` file.
10+
11+
Alternatively, you could create a top-level Cargo workspace manually by adding the following file to the project's root directory:
12+
13+
```toml title=Cargo.toml
14+
[workspace]
15+
members = ["src-tauri"]
16+
```
17+
18+
Before you proceed, make sure that your project is fully loaded. If the Cargo tool window shows all the modules and targets of the workspace, you’re good to go.
19+
20+
## Setting up Run Configurations
21+
22+
You will need to set up two separate Run/Debug configurations:
23+
* one for launching the Tauri app in debugging mode,
24+
* another one for running your frontend development server of choice.
25+
26+
### Tauri App
27+
28+
1. In the main menu, go to **Run | Edit Configurations**.
29+
2. In the **Run/Debug Configurations** dialog:
30+
* To create a new configuration, click **+** on the toolbar and select **Cargo**.
31+
32+
![Add Run/Debug Configuration](/img/guides/debugging/rustrover/add-cargo-config-light.png#gh-light-mode-only)
33+
![Add Run/Debug Configuration](/img/guides/debugging/rustrover/add-cargo-config-dark.png#gh-dark-mode-only)
34+
35+
With that created, we need to configure RustRover, so it instructs Cargo to build our app without any default features. This will tell Tauri to use your development server instead of reading assets from the disk. Normally this flag is passed by the Tauri CLI, but since we're completely sidestepping that here, we need to pass the flag manually.
36+
37+
![Add `--no-default-features` flag](/img/guides/debugging/rustrover/set-no-default-features-light.png#gh-light-mode-only)
38+
![Add `--no-default-features` flag](/img/guides/debugging/rustrover/set-no-default-features-dark.png#gh-dark-mode-only)
39+
40+
Now we can optionally rename the Run/Debug Configuration to something more memorable, in this example we called it "Run Tauri App", but you can name it whatever you want.
41+
42+
![Rename Configuration](/img/guides/debugging/rustrover/rename-configuration-light.png#gh-light-mode-only)
43+
![Rename Configuration](/img/guides/debugging/rustrover/rename-configuration-dark.png#gh-dark-mode-only)
44+
45+
### Development Server
46+
47+
The above configuration will use Cargo directly to build the Rust application and attach the debugger to it. This means we completely sidestep the Tauri CLI, so features like the `beforeDevCommand` and `beforeBuildCommand` will **not** be executed. We need to take care of that by running the development server manually.
48+
49+
To create the corresponding Run configuration, you need to check the actual development server in use. Look for the `src-tauri/tauri.conf.json` file and find the following line:
50+
51+
```json
52+
"beforeDevCommand": "pnpm dev"
53+
```
54+
55+
For `npm`, `pnpm`, or `yarn`, you could use the **npm** Run Configuration, for example:
56+
57+
![NPM Configuration](/img/guides/debugging/rustrover/npm-configuration-light.png#gh-light-mode-only)
58+
![NPM Configuration](/img/guides/debugging/rustrover/npm-configuration-dark.png#gh-dark-mode-only)
59+
60+
Make sure you have the correct values in the **Command**, **Scripts**, and **Package Manager** fields.
61+
62+
If your development server is `trunk` for Rust-based WebAssembly frontend frameworks, you could use the generic **Shell Script** Run Configuration:
63+
64+
![Trunk Serve Configuration](/img/guides/debugging/rustrover/trunk-configuration-light.png#gh-light-mode-only)
65+
![Trunk Serve Configuration](/img/guides/debugging/rustrover/trunk-configuration-dark.png#gh-dark-mode-only)
66+
67+
68+
## Launching a Debugging Session
69+
70+
To launch a debugging session, you first need to run your development server, and then start debugging the Tauri App by clicking the **Debug** button next to the Run Configurations Switcher. RustRover will automatically recognize breakpoints placed in any Rust file in your project and stop on the first one hit.
71+
72+
![Debug Session](/img/guides/debugging/rustrover/debug-session-light.png#gh-light-mode-only)
73+
![Debug Session](/img/guides/debugging/rustrover/debug-session-dark.png#gh-dark-mode-only)
74+
75+
From this point, you can explore the values of your variables, step further into the code, and check what's going at runtime in detail.
76+
77+
[core process of your tauri app]: ../../references/architecture/process-model.md#the-core-process

0 commit comments

Comments
 (0)