File tree 2 files changed +10
-18
lines changed
2 files changed +10
-18
lines changed Original file line number Diff line number Diff line change 1
1
{
2
+ // This is used to prevent `build.rs` from running every time you make a change to a file.
3
+ "rust-analyzer.check.extraEnv" : {
4
+ "IS_RUST_ANALYZER" : " true"
5
+ },
2
6
// The linter in the CI is quite strict, so running `cargo fmt` on save is probably a good idea!
3
7
"editor.formatOnSave" : true ,
4
8
"files.autoSave" : " onFocusChange" ,
Original file line number Diff line number Diff line change @@ -21,25 +21,13 @@ fn main() -> std::io::Result<()> {
21
21
// Uncomment this line if you want faster builds during development
22
22
// return Ok(());
23
23
const BROWSER_ROOT : & str = "../browser/" ;
24
- let dirs: Dirs = {
25
- Dirs {
26
- js_dist_source : PathBuf :: from ( "../browser/data-browser/dist" ) ,
27
- js_dist_tmp : PathBuf :: from ( "./assets_tmp" ) ,
28
- src_browser : PathBuf :: from ( "../browser/data-browser/src" ) ,
29
- browser_root : PathBuf :: from ( BROWSER_ROOT ) ,
30
- }
31
- } ;
32
- println ! ( "cargo:rerun-if-changed={}" , BROWSER_ROOT ) ;
33
- // Check if we're likely running in a check-like context
34
- let opt_level = std:: env:: var ( "OPT_LEVEL" ) . unwrap_or_else ( |_| "0" . to_string ( ) ) ;
35
- let profile = std:: env:: var ( "PROFILE" ) . unwrap_or_else ( |_| "release" . to_string ( ) ) ;
36
-
37
- let is_check_like = profile == "debug" && opt_level == "0" ;
24
+ // Env is set in .vscode/settings.json when rust-analyzer runs
25
+ let is_rust_analyzer = !std:: env:: var ( "IS_RUST_ANALYZER" )
26
+ . unwrap_or_default ( )
27
+ . is_empty ( ) ;
38
28
39
- if is_check_like {
40
- println ! ( "cargo:rerun-if-changed=build.rs" ) ;
41
- // Skip the heavy logic
42
- println ! ( "Skipping build.rs logic for cargo check/clippy." ) ;
29
+ if is_rust_analyzer {
30
+ p ! ( "Skipping build.rs logic to keep rust-analyzer fast. If you see this message in some other context: the JS build not run!" ) ;
43
31
} else {
44
32
const BROWSER_ROOT : & str = "../browser/" ;
45
33
println ! ( "cargo:rerun-if-changed={}" , BROWSER_ROOT ) ;
You can’t perform that action at this time.
0 commit comments