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

Override the target directory #436

Closed
SimonSapin opened this issue Aug 25, 2014 · 12 comments
Closed

Override the target directory #436

SimonSapin opened this issue Aug 25, 2014 · 12 comments

Comments

@SimonSapin
Copy link
Contributor

Cargo writes build results to a target directory next Cargo.toml. I’d like to have a configuration key in .cargo/config to override this location. Ideally, this configuration would be a template based on the project name or path to the source directory: target_dir = "~/tmp/cargo/{}" would expand to /home/simon/tmp/cargo/rust-url or /home/simon/tmp/cargo/home/simon/projects/rust-url.

(Motivation: ~/tmp is ignored in my backups. Ignoring all directories named target is risky as they’re not necessarily from Cargo build results. For what it’s worth, my ~/tmp/servo-build is currently 2.2 GB (although not using Cargo.))

@SimonSapin
Copy link
Contributor Author

As a work-around, I can make target (the one next to Cargo.toml) a symlink. Not as nice as a system-wide config that would get automatically applied to every project, but good enough to not make this request as pressing.

@SimonSapin
Copy link
Contributor Author

Closing, since I’m happy with symlinks. (Especially now that Servo has upgraded to a Rust version that fixes rust-lang/rust#16496.)

@paul-hammant
Copy link

Actually, I think the Cargo.toml file itself could name where the target directory is.

@SimonSapin
Copy link
Contributor Author

SimonSapin commented Sep 21, 2017

For what it’s worth, these days Servo’s build system as configuration to set the CARGO_TARGET_DIR environment variable, which is how Cargo allows that location to be overridden.

@paul-hammant
Copy link

If so, a one-liner could be similar to:

CARGO_TARGET_DIR=foo; cargo run args

Cool.

cargo --target-dir=foo run args

Would be more unix-like, but I'll settle for the former :)

@SimonSapin
Copy link
Contributor Author

CARGO_TARGET_DIR=foo; cargo run args

Without the semi-colon, in order to set the variable for that command only.

@paul-hammant
Copy link

Yes, you're right.

@mcandre
Copy link

mcandre commented Mar 14, 2018

Closing, since I’m happy with symlinks.

Unsatisfactory for Windows.

CARGO_TARGET_DIR

Unsatisfactory for scripting; this value should be configurable from the Cargo.toml file itself.

@kpcyrd
Copy link

kpcyrd commented Apr 16, 2018

I think Cargo.toml is a bad place for this, given that this file is committed to git and shared across multiple computers. I think this should go into $HOME/.cargo/config.

This feature would help a lot for backups, I currently have to exclude every target/ folder manually.

@sfackler
Copy link
Member

Windows supports symlinks.

@mcandre
Copy link

mcandre commented Apr 19, 2018

I think Cargo.toml is a bad place for this, given that this file is committed to git and shared across multiple computers. I think this should go into $HOME/.cargo/config.

That would be worse for per-project configurations.

@sfackler
Copy link
Member

You can put a .cargo/config in the repository.

bors added a commit that referenced this issue Nov 7, 2019
… r=alexcrichton

Update crossbeam-utils requirement from 0.6 to 0.7

Updates the requirements on [crossbeam-utils](https://github.com/crossbeam-rs/crossbeam) to permit the latest version.
<details>
<summary>Changelog</summary>

*Sourced from [crossbeam-utils's changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md).*

> # Version 0.7.0
>
> - Remove `ArcCell`, `MsQueue`, and `TreiberStack`.
> - Change the interface of `ShardedLock` to match `RwLock`.
> - Add `SegQueue::len()`.
> - Rename `SegQueue::try_pop()` to `SegQueue::pop()`.
> - Change the return type of `SegQueue::pop()` to `Result`.
> - Introduce `ArrayQueue`.
> - Update dependencies.
>
> # Version 0.6.0
>
> - Update dependencies.
>
> # Version 0.5.0
>
> - Update `crossbeam-channel` to 0.3.
> - Update `crossbeam-utils` to 0.6.
> - Add `AtomicCell`, `SharedLock`, and `WaitGroup`.
>
> # Version 0.4.1
>
> - Fix a double-free bug in `MsQueue` and `SegQueue`.
>
> # Version 0.4
>
> - Switch to the new implementation of epoch-based reclamation in
>   [`crossbeam-epoch`](https://github.com/crossbeam-rs/crossbeam-epoch), fixing numerous bugs in the
>   old implementation.  Its API is changed in a backward-incompatible way.
> - Switch to the new implementation of `CachePadded` and scoped thread in
>   [`crossbeam-utils`](https://github.com/crossbeam-rs/crossbeam-utils).  The scoped thread API is
>   changed in a backward-incompatible way.
> - Switch to the new implementation of Chase-Lev deque in
>   [`crossbeam-deque`](https://github.com/crossbeam-rs/crossbeam-deque).  Its API is changed in a
>   backward-incompatible way.
> - Export channel implemented in
>   [`crossbeam-channel`](https://github.com/crossbeam-rs/crossbeam-channel).
> - Remove `AtomicOption`.
> - Implement `Default` and `From` traits.
>
> # Version 0.3
>
> - Introduced `ScopedThreadBuilder` with the ability to name threads and set stack size
> - `Worker` methods in the Chase-Lev deque don't require mutable access anymore
> - Fixed a bug when unblocking `pop()` in `MsQueue`
> - Implemented `Drop` for `MsQueue`, `SegQueue`, and `TreiberStack`
> - Implemented `Default` for `TreiberStack`
> - Added `is_empty` to `SegQueue`
> - Renamed `mem::epoch` to `epoch`
> - Other bug fixes
></tr></table> ... (truncated)
</details>
<details>
<summary>Commits</summary>

- [`28ad2b7`](crossbeam-rs/crossbeam@28ad2b7) Update versions in readmes
- [`c98fea1`](crossbeam-rs/crossbeam@c98fea1) Merge [#444](https://github-redirect.dependabot.com/crossbeam-rs/crossbeam/issues/444)
- [`d953f49`](crossbeam-rs/crossbeam@d953f49) Add compatibility section to readme
- [`c76f145`](crossbeam-rs/crossbeam@c76f145) Prepare for the next release
- [`99762ee`](crossbeam-rs/crossbeam@99762ee) Merge [#442](https://github-redirect.dependabot.com/crossbeam-rs/crossbeam/issues/442)
- [`ebb6b5f`](crossbeam-rs/crossbeam@ebb6b5f) Do not perform superfluous bounds checks on drop
- [`d2ab7a5`](crossbeam-rs/crossbeam@d2ab7a5) Update LICENSE-APACHE
- [`f54db88`](crossbeam-rs/crossbeam@f54db88) Merge [#437](https://github-redirect.dependabot.com/crossbeam-rs/crossbeam/issues/437)
- [`caa52c4`](crossbeam-rs/crossbeam@caa52c4) Merge [#436](https://github-redirect.dependabot.com/crossbeam-rs/crossbeam/issues/436)
- [`af68803`](crossbeam-rs/crossbeam@af68803) Merge [#438](https://github-redirect.dependabot.com/crossbeam-rs/crossbeam/issues/438)
- Additional commits viewable in [compare view](crossbeam-rs/crossbeam@crossbeam-utils-0.6.0...crossbeam-utils-0.7.0)
</details>
<br />

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`.

[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)

---

<details>
<summary>Dependabot commands and options</summary>
<br />

You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
- `@dependabot use these labels` will set the current labels as the default for future PRs for this repo and language
- `@dependabot use these reviewers` will set the current reviewers as the default for future PRs for this repo and language
- `@dependabot use these assignees` will set the current assignees as the default for future PRs for this repo and language
- `@dependabot use this milestone` will set the current milestone as the default for future PRs for this repo and language
- `@dependabot badge me` will comment on this PR with code to add a "Dependabot enabled" badge to your readme

Additionally, you can set the following in your Dependabot [dashboard](https://app.dependabot.com):
- Update frequency (including time of day and day of week)
- Pull request limits (per update run and/or open at any time)
- Automerge options (never/patch/minor, and dev/runtime dependencies)
- Out-of-range updates (receive only lockfile updates, if desired)
- Security updates (receive only security updates, if desired)

</details>
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

No branches or pull requests

5 participants