Skip to content

Conversation

@ilyvion
Copy link
Contributor

@ilyvion ilyvion commented Aug 3, 2022

To avoid having to rebuild dependencies (and thus also all their dependents!) with generated .rs files, we have to avoid touching .rs files under target. Thus we specify src explicitly as the path to find.

@ilyvion
Copy link
Contributor Author

ilyvion commented Aug 3, 2022

Second build with `find src ...` (i.e. with my changes) (31.60s)

link to CI

Step 13/18 : RUN find src -name "*.rs" -exec touch {} \; && cargo build --release
 ---> Running in d4a814bb75fa
   Compiling rustlang_discord_mod_bot v0.1.0 (/tmp/source)
warning: unreachable expression
  --> src/jobs.rs:23:13
   |
16 | /             loop {
17 | |                 unban_users(&cx, db.clone()).await?;
18 | |                 clear_command_history(&cx).await?;
19 | |
20 | |                 sleep(Duration::new(HOUR, 0)).await;
21 | |             }
   | |_____________- any code following this expression is unreachable
22 | 
23 |               Ok::<_, Error>(())
   |               ^^^^^^^^^^^^^^^^^^ unreachable expression
   |
   = note: `#[warn(unreachable_code)]` on by default

warning: `rustlang_discord_mod_bot` (bin "rustlang_discord_mod_bot") generated 1 warning
    Finished release [optimized] target(s) in 31.60s
Second build with `find ...` (i.e. before my changes) (2m 17s)

link to CI

Step 13/18 : RUN find -name "*.rs" -exec touch {} \; && cargo build --release
 ---> Running in ec44f0a0f9a2
   Compiling typenum v1.12.0
   Compiling proc-macro-nested v0.1.4
   Compiling generic-array v0.14.4
   Compiling digest v0.9.0
   Compiling block-buffer v0.9.0
   Compiling crypto-mac v0.10.1
   Compiling sha-1 v0.9.1
   Compiling md-5 v0.9.1
   Compiling sha2 v0.9.8
   Compiling hmac v0.10.1
   Compiling futures-util v0.3.16
   Compiling mime_guess v2.0.3
   Compiling tungstenite v0.11.1
   Compiling futures-executor v0.3.16
   Compiling h2 v0.3.3
   Compiling futures v0.3.16
   Compiling async-tungstenite v0.11.0
   Compiling sqlx-core v0.5.7
   Compiling hyper v0.14.4
   Compiling sqlx-macros v0.5.7
   Compiling hyper-tls v0.5.0
   Compiling hyper-rustls v0.22.1
   Compiling reqwest v0.11.4
   Compiling serenity v0.10.8
   Compiling sqlx v0.5.7
   Compiling rustlang_discord_mod_bot v0.1.0 (/tmp/source)
warning: unreachable expression
  --> src/jobs.rs:23:13
   |
16 | /             loop {
17 | |                 unban_users(&cx, db.clone()).await?;
18 | |                 clear_command_history(&cx).await?;
19 | |
20 | |                 sleep(Duration::new(HOUR, 0)).await;
21 | |             }
   | |_____________- any code following this expression is unreachable
22 | 
23 |               Ok::<_, Error>(())
   |               ^^^^^^^^^^^^^^^^^^ unreachable expression
   |
   = note: `#[warn(unreachable_code)]` on by default

warning: field is never read: `version`
  --> src/crates.rs:18:5
   |
18 |     version: String,
   |     ^^^^^^^^^^^^^^^
   |
   = note: `#[warn(dead_code)]` on by default
note: `Crate` has a derived impl for the trait `Debug`, but this is intentionally ignored during dead code analysis
  --> src/crates.rs:13:10
   |
13 | #[derive(Debug, Deserialize)]
   |          ^^^^^
   = note: this warning originates in the derive macro `Debug` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `rustlang_discord_mod_bot` (bin "rustlang_discord_mod_bot") generated 2 warnings
    Finished release [optimized] target(s) in 2m 17s

(the added warning compared to the "fixed" version comes from a change made in that particular PR; all the older builds on the master branch were too old to have retained their logs)

As you can see, this simple fix shaves off about 1 minute and 45 seconds on the "rebuild" with the real source, which makes both local development much less tedious and it improves CI build times. Win-win all around.

@ilyvion ilyvion force-pushed the only-touch-src-rs branch from b1de948 to 27925ee Compare August 3, 2022 11:07
@ilyvion ilyvion changed the title Only touch *.rs under src Only touch *.rs under src and migrations Aug 3, 2022
To avoid having to rebuild dependencies (and thus also all their dependents) with generated `.rs` files, we have to avoid touching `.rs` files under `target`.
@ilyvion ilyvion force-pushed the only-touch-src-rs branch from 27925ee to a6e27d1 Compare August 3, 2022 11:11
@ilyvion ilyvion changed the title Only touch *.rs under src and migrations Only touch *.rs under src Aug 3, 2022
@technetos technetos merged commit 0a9869d into technetos:master Aug 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants