-
Notifications
You must be signed in to change notification settings - Fork 543
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
158 additions
and
87 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
6.0.0 | ||
6.4.0 |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"""Copy a generated file to the source tree. | ||
Run like: | ||
copy_to_source path/to/generated_file path/to/source_file_to_overwrite | ||
""" | ||
|
||
import os | ||
import shutil | ||
import stat | ||
import sys | ||
from pathlib import Path | ||
|
||
|
||
def copy_to_source(generated_relative_path: Path, target_relative_path: Path) -> None: | ||
"""Copy the generated file to the target file path. | ||
Expands the relative paths by looking at Bazel env vars to figure out which absolute paths to use. | ||
""" | ||
# This script normally gets executed from the runfiles dir, so find the absolute path to the generated file based on that. | ||
generated_absolute_path = Path.cwd() / generated_relative_path | ||
|
||
# Similarly, the target is relative to the source directory. | ||
target_absolute_path = os.getenv("BUILD_WORKSPACE_DIRECTORY") / target_relative_path | ||
|
||
print(f"Copying {generated_absolute_path} to {target_absolute_path}") | ||
target_absolute_path.parent.mkdir(parents=True, exist_ok=True) | ||
shutil.copy(generated_absolute_path, target_absolute_path) | ||
|
||
target_absolute_path.chmod(0O664) | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 3: | ||
sys.exit("Usage: copy_to_source <generated_file> <target_file>") | ||
|
||
copy_to_source(Path(sys.argv[1]), Path(sys.argv[2])) |
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
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
Oops, something went wrong.