Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build.rs is misused and invoked on any change to sources #101

Closed
murlakatamenka opened this issue Mar 12, 2024 · 1 comment · May be fixed by #102
Closed

build.rs is misused and invoked on any change to sources #101

murlakatamenka opened this issue Mar 12, 2024 · 1 comment · May be fixed by #102

Comments

@murlakatamenka
Copy link

Current build.rs is misused and slows down iteration time, because it only builds docs and doesn't need to run on any change to sources.

In my case, for around ~3 seconds while I work on #95 and #100

Solutions are well known:

  • rerun-if-changed for docs/*.scd files
  • or to use environment variable to trigger building man pages:
// build.rs
fn main() {
    if std::env::var("BUILD_DOCS").is_err() {
        std::process::exit(0);
    }

    // build docs if env var is set
}
BUILD_DOCS=1 cargo build --release
murlakatamenka added a commit to murlakatamenka/wayshot that referenced this issue Mar 12, 2024
Fixes waycrate#101

Why?

- no build.rs that is invoked on _any_ `cargo build/run`
- no extra dev dependency
- no intermediate `docs/*.out` files
- 3 lines of bash instead
- maximum gzip compression (-9/--best)
- docs will be built only when needed,
    i.e. on `make docs` or `make install`

To quickly check:

```sh
make TARGET_DIR=/tmp/wayshot MAN{1,7}_DIR=/tmp/wayshot install
```
murlakatamenka added a commit to murlakatamenka/wayshot that referenced this issue Mar 14, 2024
Fixes waycrate#101

Why?

- no build.rs that is invoked on _any_ `cargo build/run`
- no extra dev dependency
- no intermediate `docs/*.out` files
- 3 lines of bash instead
- maximum gzip compression (-9/--best)
- docs will be built only when needed,
    i.e. on `make docs` or `make install`

To quickly check:

```sh
make TARGET_DIR=/tmp/wayshot MAN{1,7}_DIR=/tmp/wayshot install
```
@Shinyzenith
Copy link
Member

Hi this has been fixed in our dev branch thanks to @murlakatamenka . Will land in main branch soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants