-
Notifications
You must be signed in to change notification settings - Fork 613
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
7 changed files
with
1,884 additions
and
0 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
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,33 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# Copyright (c) FIRST and other WPILib contributors. | ||
# Open Source Software; you can modify and/or share it under the terms of | ||
# the WPILib BSD license file in the root directory of this project. | ||
import os.path | ||
import subprocess | ||
import sys | ||
from glob import glob | ||
|
||
if __name__ == "__main__": | ||
proto_files = glob("wpilibj/src/main/proto/*.proto") | ||
for path in proto_files: | ||
absolute_filename = os.path.abspath(path) | ||
absolute_dir, filename = os.path.split(absolute_filename) | ||
subprocess.run( | ||
[ | ||
sys.argv[1], | ||
f"--plugin=protoc-gen-quickbuf={sys.argv[2]}", | ||
f"--quickbuf_out=allocation=lazymsg,gen_descriptors=true:{os.path.abspath('./wpilibj/src/generated/main/java')}", | ||
f"-I{absolute_dir}", | ||
absolute_filename, | ||
] | ||
) | ||
java_files = glob("wpilibj/src/generated/main/java/edu/wpi/first/wpilibj/proto/*.java") | ||
for java_file in java_files: | ||
with open(java_file) as file: | ||
content = file.read() | ||
with open(java_file, "tw") as file: | ||
file.write( | ||
"// Copyright (c) FIRST and other WPILib contributors.\n// Open Source Software; you can modify and/or share it under the terms of\n// the WPILib BSD license file in the root directory of this project.\n" | ||
+ content | ||
) |
Oops, something went wrong.