-
Notifications
You must be signed in to change notification settings - Fork 671
[robotpy] Add copybara scripts #8368
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
Open
pjreiniger
wants to merge
1
commit into
wpilibsuite:2027
Choose a base branch
from
bzlmodRio:copybara_scripts
base: 2027
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+556
−3
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
|
|
@@ -258,3 +258,6 @@ bazel_auth.rc | |
|
|
||
| # Meson | ||
| .meson-subproject* | ||
|
|
||
| # Copybara user config | ||
| shared/bazel/copybara/.copybara.json | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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,249 @@ | ||
| MOSTROBOTPY_PROJECTS = [ | ||
| struct( | ||
| wpilib_name = "apriltag", | ||
| robotpy_name = "robotpy-apriltag", | ||
| native_robotpy_name = "robotpy-native-apriltag", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "datalog", | ||
| robotpy_name = "robotpy-wpilog", | ||
| native_robotpy_name = "robotpy-native-datalog", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "hal", | ||
| robotpy_name = "robotpy-hal", | ||
| native_robotpy_name = "robotpy-native-wpihal", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "ntcore", | ||
| robotpy_name = "pyntcore", | ||
| native_robotpy_name = "robotpy-native-ntcore", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "romiVendordep", | ||
| robotpy_name = "robotpy-romi", | ||
| native_robotpy_name = "robotpy-native-romi", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "wpilibc", | ||
| robotpy_name = "robotpy-wpilib", | ||
| native_robotpy_name = "robotpy-native-wpilib", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "wpimath", | ||
| robotpy_name = "robotpy-wpimath", | ||
| native_robotpy_name = "robotpy-native-wpimath", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "wpinet", | ||
| robotpy_name = "robotpy-wpinet", | ||
| native_robotpy_name = "robotpy-native-wpinet", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "wpiutil", | ||
| robotpy_name = "robotpy-wpiutil", | ||
| native_robotpy_name = "robotpy-native-wpiutil", | ||
| has_tests = True, | ||
| ), | ||
| struct( | ||
| wpilib_name = "xrpVendordep", | ||
| robotpy_name = "robotpy-xrp", | ||
| native_robotpy_name = "robotpy-native-xrp", | ||
| has_tests = True, | ||
| ), | ||
| ] | ||
|
|
||
| IGNORED_MOSTROBOTPY_PROJECTS = [ | ||
| "subprojects/robotpy-cscore", | ||
| "subprojects/robotpy-halsim-ds-socket", | ||
| "subprojects/robotpy-halsim-gui", | ||
| "subprojects/robotpy-halsim-ws", | ||
| ] | ||
|
|
||
| def define_mostrobotpy_to_allwpilib(): | ||
| origin_files = [] | ||
| destination_files = [] | ||
| transformations = [] | ||
|
|
||
| rename_transforms = [] | ||
| rename_transforms.append(core.replace( | ||
| before = 'version = "${version}"', | ||
| after = 'version = "0.0.0"', | ||
| regex_groups = {"version": ".*"}, | ||
| paths = glob(["**/*.toml"]), | ||
| )) | ||
|
|
||
| EXCLUDES = ["**/meson.build", "**/.gitignore", "**/requirements.txt", "**/.gittrack", "**/.gittrackexclude", "**/run_tests.py"] | ||
|
|
||
| for project_info in MOSTROBOTPY_PROJECTS: | ||
| origin_files += glob([ | ||
| "subprojects/" + project_info.robotpy_name + "/**", | ||
| ], exclude = EXCLUDES) | ||
|
|
||
| rename_transforms.append(core.replace( | ||
| before = '"' + project_info.robotpy_name + '==${version}"', | ||
| after = '"{}==0.0.0"'.format(project_info.robotpy_name), | ||
| regex_groups = {"version": ".*"}, | ||
| paths = glob(["**/*.toml"]), | ||
| )) | ||
|
|
||
| if project_info.native_robotpy_name: | ||
| origin_files += glob([ | ||
| "subprojects/" + project_info.native_robotpy_name + "/pyproject.toml", | ||
| ], exclude = EXCLUDES) | ||
|
|
||
| rename_transforms.append(core.replace( | ||
| before = '"' + project_info.native_robotpy_name + '==${version}"', | ||
| after = '"{}==0.0.0"'.format(project_info.native_robotpy_name), | ||
| regex_groups = {"version": ".*"}, | ||
| paths = glob(["**/*.toml"]), | ||
| )) | ||
|
|
||
| destination_files += glob([ | ||
| project_info.wpilib_name + "/src/main/python/**", | ||
| project_info.wpilib_name + "/src/test/python/**", | ||
| ], exclude = []) | ||
|
|
||
| if project_info.has_tests: | ||
| transformations.append(core.move("subprojects/" + project_info.robotpy_name + "/tests", project_info.wpilib_name + "/src/test/python")) | ||
| if project_info.native_robotpy_name: | ||
| transformations.append(core.move("subprojects/" + project_info.native_robotpy_name + "/pyproject.toml", "subprojects/" + project_info.native_robotpy_name + "/native-pyproject.toml")) | ||
| transformations.append(core.move("subprojects/" + project_info.robotpy_name, project_info.wpilib_name + "/src/main/python")) | ||
| if project_info.native_robotpy_name: | ||
| transformations.append(core.move("subprojects/" + project_info.native_robotpy_name + "/native-pyproject.toml", project_info.wpilib_name + "/src/main/python/native-pyproject.toml")) | ||
|
|
||
| rename_transforms.append(core.replace( | ||
| before = '"wpilib==${version}"', | ||
| after = '"wpilib==0.0.0"', | ||
| regex_groups = {"version": ".*"}, | ||
| paths = glob(["**/*.toml"]), | ||
| )) | ||
|
|
||
| rename_transforms.append(core.replace( | ||
| before = 'version = "0.0.0"', | ||
| after = 'version = "0.0.1"', | ||
| paths = ["subprojects/robotpy-wpiutil/tests/cpp/pyproject.toml"], | ||
| )) | ||
| rename_transforms.append(core.replace( | ||
| before = 'version = "0.0.0"', | ||
| after = 'version = "0.1"', | ||
| paths = ["subprojects/robotpy-wpimath/tests/cpp/pyproject.toml"], | ||
| )) | ||
|
|
||
| transformations = [core.transform(rename_transforms, noop_behavior = "IGNORE_NOOP", reversal = [])] + transformations | ||
|
|
||
| core.workflow( | ||
| name = "mostrobotpy_to_allwpilib", | ||
| origin = git.origin( | ||
| url = "https://github.com/robotpy/mostrobotpy.git", | ||
| ref = "2027", | ||
| ), | ||
| destination = git.destination( | ||
| url = "https://github.com/OVERRIDE_ME/OVERRIDE_ME", | ||
| fetch = "2027", | ||
| push = "copybara_mostrobotpy_to_allwpilib", | ||
| ), | ||
| destination_files = destination_files, | ||
| origin_files = origin_files, | ||
| authoring = authoring.pass_thru("Default email <[email protected]>"), | ||
| transformations = transformations, | ||
| ) | ||
|
|
||
| def define_allwpilib_to_mostrobotpy(): | ||
| ignored_project_exclude = [p + "/**" for p in IGNORED_MOSTROBOTPY_PROJECTS] | ||
| origin_files = [] | ||
| destination_files = glob(["**"], exclude = ["*", ".github/**", "docs/**", "**/.gitignore", "**/meson.build", "**/requirements.txt", "devtools/**", "examples/**", "**/run_tests.py"] + ignored_project_exclude) | ||
| transformations = [] | ||
|
|
||
| for project_info in MOSTROBOTPY_PROJECTS: | ||
| origin_files += glob([ | ||
| project_info.wpilib_name + "/src/main/python/**", | ||
| project_info.wpilib_name + "/src/test/python/**", | ||
| ], exclude = []) | ||
|
|
||
| if project_info.has_tests: | ||
| transformations.append(core.move(project_info.wpilib_name + "/src/test/python", "subprojects/" + project_info.robotpy_name + "/tests")) | ||
| transformations.append(core.move(project_info.wpilib_name + "/src/main/python", "subprojects/" + project_info.robotpy_name)) | ||
| transformations.append(core.move("subprojects/" + project_info.robotpy_name + "/native-pyproject.toml", "subprojects/" + project_info.native_robotpy_name + "/pyproject.toml")) | ||
|
|
||
| core.workflow( | ||
| name = "allwpilib_to_mostrobotpy", | ||
| origin = git.origin( | ||
| url = "https://github.com/wpilibsuite/allwpilib.git", | ||
| ref = "2027", | ||
| ), | ||
| destination = git.github_destination( | ||
| url = "https://github.com/OVERRIDE_ME/OVERRIDE_ME", | ||
| fetch = "2027", | ||
| push = "copybara_allwpilib_to_mostrobotpy", | ||
| ), | ||
| destination_files = destination_files, | ||
| origin_files = origin_files, | ||
| authoring = authoring.pass_thru("Default email <[email protected]>"), | ||
| transformations = transformations, | ||
| ) | ||
|
|
||
| def define_robotpy_commandsv2_to_allwpilib(): | ||
| origin_files = glob(["commands2/**", "tests/**"], exclude = ["tests/run_tests.py", "tests/requirements.txt"]) | ||
| destination_files = glob(["commandsv2/src/main/python/**", "commandsv2/src/test/python/**"]) | ||
| transformations = [] | ||
|
|
||
| transformations.append(core.move("commands2/", "commandsv2/src/main/python/commands2/")) | ||
| transformations.append(core.move("tests/", "commandsv2/src/test/python/")) | ||
|
|
||
| core.workflow( | ||
| name = "commandsv2_to_allwpilib", | ||
| origin = git.origin( | ||
| url = "https://github.com/robotpy/robotpy-commands-v2.git", | ||
| ref = "2027", | ||
| ), | ||
| destination = git.destination( | ||
| url = "https://github.com/OVERRIDE_ME/OVERRIDE_ME", | ||
| fetch = "2027", | ||
| push = "copybara_commandsv2_to_allwpilib", | ||
| ), | ||
| destination_files = destination_files, | ||
| origin_files = origin_files, | ||
| authoring = authoring.pass_thru("Default email <[email protected]>"), | ||
| transformations = transformations, | ||
| ) | ||
|
|
||
| def define_allwpilib_to_robotpy_commandsv2(): | ||
| ignored_project_exclude = [p + "/**" for p in IGNORED_MOSTROBOTPY_PROJECTS] | ||
| origin_files = glob(["commandsv2/src/main/python/**", "commandsv2/src/test/python/**"]) | ||
| destination_files = glob(["**"], exclude = ["*", ".github/**", "**/run_tests.py", "docs/**", "tests/requirements.txt"]) | ||
| transformations = [] | ||
|
|
||
| transformations.append(core.move("commandsv2/src/main/python/", "")) | ||
| transformations.append(core.move("commandsv2/src/test/python", "tests")) | ||
|
|
||
| core.workflow( | ||
| name = "allwpilib_to_commandsv2", | ||
| origin = git.origin( | ||
| url = "https://github.com/wpilibsuite/allwpilib.git", | ||
| ref = "2027", | ||
| ), | ||
| destination = git.github_destination( | ||
| url = "https://github.com/OVERRIDE_ME/OVERRIDE_ME", | ||
| fetch = "2027", | ||
| push = "copybara_allwpilib_to_commandsv2", | ||
| ), | ||
| destination_files = destination_files, | ||
| origin_files = origin_files, | ||
| authoring = authoring.pass_thru("Default email <[email protected]>"), | ||
| transformations = transformations, | ||
| ) | ||
|
|
||
| define_mostrobotpy_to_allwpilib() | ||
| define_allwpilib_to_mostrobotpy() | ||
|
|
||
| define_robotpy_commandsv2_to_allwpilib() | ||
| define_allwpilib_to_robotpy_commandsv2() | ||
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a good reason to maintain the robotpy-commands-v2 repo in the first place? It's pure-Python, so we could just build and publish it from here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess that is a good question. IT shouldn't be hard to add the wheel creation and figure out how to get it pushed to pypi. I think that should be a @virtuald decision though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's two separate problems with pushing it from here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was thinking we could make it a manually triggered workflow (
workflow_dispatch). Alternatively we could have that workflow trigger on a different tag naming convention. Either way seems like a solvable problem.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either way I say punt kill the source of truth for commandsv-2 while the dust settles on this mirroring effort