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

Support expanding locations in rustc_env and build_script_env #461

Closed
wants to merge 9 commits into from

Commits on Oct 25, 2020

  1. $(location ...) expansion and runtime data support for build scripts

    - rustc_env now expands $(rootpath //package:target), for passing
    the location of files or tools that are needed at compile time
    - build_script_env now expands $(execpath //package:target), for
    passing the location of files or tools that are needed at build
    script runtime
    - cargo_script_build() now passes the data argument to the build
    script runner, so the data is available at runtime
    
    Ideally both build and run would work with execpath/location, but
    the approach of walking back to the root folder that cargo_build_script()
    is using doesn't seem to be possible at compile time, as ${pwd} is being
    substituted after the starlark code is executed. So at compile time,
    we use the relative rootpath instead.
    dae committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    f3d1552 View commit details
    Browse the repository at this point in the history
  2. rely on build script to locate bazel-out parent

    Rust on Windows seems to struggle with relative pathnames in this case
    - I suspect due to the fact that symlinks are being used.
    
    fs::read_to_string("../../../path/to/somewhere")
    
    gives an error
    
    as does calling .canonicalize() on the above. Switching to \ as a
    path separator does not seem to help.
    
    If the parent directory references are handled separately, eg
    
    Path::new("../../..").canonicalize(), then the path/to/somewhere
    can be joined onto the folder and the file can be read. So instead
    of automatically adjusting the path, we just return execroot verbatim,
    and rely on the build script to do their own path manipulation.
    dae committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    e37b492 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    6f5dbca View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    41484f5 View commit details
    Browse the repository at this point in the history
  5. Regenerate documentation

    dae committed Oct 25, 2020
    Configuration menu
    Copy the full SHA
    14e4b8b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    cb10fec View commit details
    Browse the repository at this point in the history

Commits on Oct 26, 2020

  1. Configuration menu
    Copy the full SHA
    95fd967 View commit details
    Browse the repository at this point in the history
  2. Regenerate documentation

    dae committed Oct 26, 2020
    Configuration menu
    Copy the full SHA
    8158d14 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    362b166 View commit details
    Browse the repository at this point in the history