Skip to content
This repository has been archived by the owner on May 19, 2022. It is now read-only.

Support finding assets in Cargo's OUT_DIR #154

Closed
nirvdrum opened this issue Nov 11, 2020 · 2 comments
Closed

Support finding assets in Cargo's OUT_DIR #154

nirvdrum opened this issue Nov 11, 2020 · 2 comments

Comments

@nirvdrum
Copy link
Contributor

nirvdrum commented Nov 11, 2020

First off, thanks for this awesome project. It's amazing being able to build a .deb file with very little configuration.

Recently, I've been looking to add in shell completions for my small CLI app. A common approach I've found is using a build.rs script to generate the shell completions from Clap. However, there doesn't seem to be a way to reference those files in the package.metadata.deb assets list. Since build scripts are limited to writing to Cargo's OUT_DIR, it'd be very helpful if that location was another candidate in the search path for listed assets.

I think adding support for this would address part of the problem in #67. ripgrep is another project I came across that can't build a deb via cargo deb directly, relying on a separate script to stage the data before the command can be run. Unless I'm mistaken, it'd also allow this project's example build script to adhere to the restrictions in the Rust docs on build scripts: "Build scripts may save any output files in the directory specified in the OUT_DIR environment variable. Scripts should not modify any files outside of that directory."

Of course, this all presupposes that there's a way for OUT_DIR to be exposed to cargo-deb. If not, I'm sorry for the noise.

@kornelski
Copy link
Collaborator

kornelski commented Nov 12, 2020

It would be an awesome feature. Unfortunately, I don't think this location is exposed outside of Cargo.

I've asked about it before rust-lang/cargo#5457 and the larger issue is completely stalled rust-lang/cargo#545

There was an attempt to replace build tasks with xtask, but xtask has chosen a design that is also a black box from outside, so it's incompatible with cargo-deb matklad/cargo-xtask#10

@nirvdrum
Copy link
Contributor Author

Thanks for those links. I spent a while searching for information, but I was mostly limiting the search to cargo-deb. It's an unfortunate situation without a great solution. The simplest approach, like the one taken in the example build script, is subject to breaking without notification. Trying to find the "out" directory is tedious and error-prone.

Since it looks like you've already extensively investigated this and there's a limitation in Cargo, please feel free to close this issue as you see fit.

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

No branches or pull requests

2 participants