Skip to content

No per-crate way to retain files in the build script directory/override build script environment settings #3802

@Walter-Reactor

Description

@Walter-Reactor

This seems like an oversight, since build.rs files can have arbitrary useful outputs.

In my case, I'm trying to wrap the intel_tex_2 crate, which appears to require that the build script is run in the same directory that compilation happens.

Specifically, it writes an absolute path to an env_var via cargo:rustc-env=ISPC_OUT_DIR, which means that variable can't be overridden by
either rustc_env, or build_script_rustc_env.

That path is then used inside a macro during compilation, so I must either

  1. Set the build script run directory to the execroot for the package which winds up with the rather brittle external/rules_rust++crate+crates__intel_tex_2-0.5.0 so that the path when running the build script matches the basic symlink
    or
  2. Use cargo_manifest_dir_filename_suffixes_to_retain and globally retain .rs files

There's a variety of possible solutions here, but the one I think would be best is probably allowing per-crate overrides of the retain list.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions