-
Notifications
You must be signed in to change notification settings - Fork 176
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg_install: Add destdir attr & read rel paths. (#886)
Implementation notes: Relative paths are interpreted against BUILD_WORKSPACE_DIRECTORY, not BUILD_WORKING_DIRECTORY. This is for the following reasons: The TODO tag explicitly convey the intention of using BUILD_WORKSPACE_DIRECTORY for relative paths. If destdir is specified in the attribute of the pkg_install() target, interpreting it against BUILD_WORKSPACE_DIRECTORY is much stabler. That is, no matter where your current cwd is, the destdir attribute always refers to a path relative to the workspace root. For example: ``` pkg_install(name = "my_pkg_install", destdir = "out/dest") ``` ``` cd <workspace_root>/<some_subdir> bazel run //:my_pkg_install ``` This clearly conveys that the default destdir is <workspace_root>/out/dest regardless of where the user runs the command. The cost is that the --destdir command line argument becomes trickier to understand. For example, if one is not familiar with pkg_install, and below the workspace root they run: ``` cd <workspace_root>/out bazel run //:my_pkg_install -- --destdir dest ``` They may expect the destdir to be set to <workspace_root>/out/dest; but it is in fact `<workspace_root>/dest`. We could also interpret the target attribute & the command line argument separately (e.g. pkg_install(destdir_against_workspace)), but honestly I think that's even more confusing when they interpret relative paths differently. Please let me know if this is preferred by the maintainers. Co-authored-by: HONG Yifan <elsk@google.com>
- Loading branch information
Showing
2 changed files
with
61 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters