-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Optional (dev) build.rs
#4511
Comments
Aren't the environment variables enough for that? Cargo sets environment variables |
As for me, an environment variable isn't enough: library users don't need such check even for the One more thing: build script is a really powerful thing that can be used for different purposes. As a third-party crate user I need to analyze why it is needed. If there is a separate |
I've made a package called This would still hit them in debug mode. I'm going to experiment with solutions, probably a feature flag that is required to run skeptic, but as @DarkEld3r says, it would be nice to have a canonical solution to this problem. |
It seems I have a use case for this (or #12552?). At https://github.com/NomicFoundation/slang, we're using Cargo to generate a final package to be published using a custom build pipeline - the generated code is checked-in (easier to review/audit) and verified that it's up to date by the CI (as a side-note, we're also generating tests but that's orthogonal). However, to ensure that the package is re-built correctly by Cargo when working locally, we need to include a build script (that we don't actually want to publish). We're currently working around that by including a build script that checks a marker env var and does local codegen if it's needed but that's somewhat of a workaround and we also need to run a custom Another workaround is to use a See NomicFoundation/slang#597 (comment) for a more in-depth write-up about our use case. |
build.rs
can be used for optional checks such as skeptic. In that case it isn't convenient (especially for the library) to run it each time. So it will be useful to have "dev"build.rs
similar todev-dependencies
.The text was updated successfully, but these errors were encountered: