-
Notifications
You must be signed in to change notification settings - Fork 402
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
Commits on Oct 25, 2020
-
$(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.
Configuration menu - View commit details
-
Copy full SHA for f3d1552 - Browse repository at this point
Copy the full SHA f3d1552View commit details -
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.
Configuration menu - View commit details
-
Copy full SHA for e37b492 - Browse repository at this point
Copy the full SHA e37b492View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6f5dbca - Browse repository at this point
Copy the full SHA 6f5dbcaView commit details -
add run_in_execroot flag to cargo_build_script()
Re discussion on bazelbuild#461 (review)
Configuration menu - View commit details
-
Copy full SHA for 41484f5 - Browse repository at this point
Copy the full SHA 41484f5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 14e4b8b - Browse repository at this point
Copy the full SHA 14e4b8bView commit details -
Configuration menu - View commit details
-
Copy full SHA for cb10fec - Browse repository at this point
Copy the full SHA cb10fecView commit details
Commits on Oct 26, 2020
-
Configuration menu - View commit details
-
Copy full SHA for 95fd967 - Browse repository at this point
Copy the full SHA 95fd967View commit details -
Configuration menu - View commit details
-
Copy full SHA for 8158d14 - Browse repository at this point
Copy the full SHA 8158d14View commit details -
Configuration menu - View commit details
-
Copy full SHA for 362b166 - Browse repository at this point
Copy the full SHA 362b166View commit details
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.