Skip to content

Conversation

@pjreiniger
Copy link
Contributor

@pjreiniger pjreiniger commented Sep 27, 2025

This performs the majority of the user facing changes listed in the reorg doc. This was performed by this script, which has more details on the process.

Whats included

This effort attempts to cover as much of the reorg spreadsheet as possible without major build system changes and without major code changes

Things covered in the script:

  • All subprojects but glass have been moved into their new folders
  • Java package renames (and paths in repo)
  • C++ file moves, as well as a vast change to using .hpp instead of .h as noted here
    • NOTE, A bulk assumption was made that all files, unless the files explicitly had _c in their name was to change the file. This might be incorrect.
  • C++ namespaces
  • Change maven coordinates
  • While not explicitly denoted in the spreadsheet, the C++ files were moved to attempt to match the java file moves.

Things NOT covered in the script, which I think are outside the scope of this initial effort

  • Separate glassApp from glasslib. This is a build system change so it will be done in a follow up PR.
  • Combine wpilibc and wpilibj into a common project. Again, build system change, follow up PR
  • Move C++ units into the wpiunits project. Again, build system
  • Some of the suggested file moves denoted in the spreadsheet are across project boundaries and need dependency chains broken before they can move
  • Per an offline conversation, the serde project might not bring a whole lot of benefit, so it has been left in wpiutil with namespaces / include paths unchanged.

Process

  1. Preprocess C++ and Java files to determine file moves, and calculate their
    respective changes to other files, i.e. how to change C++ include paths, or
    java package / import renames
    1b. Additional renames are applied as per this document https://docs.google.com/spreadsheets/d/1NXgby1njo7oZ9_Ezk8q6ez5VzPTXeLAVRSnB3M1TqR4/edit?gid=1323156307#gid=1323156307
    Note, some of the proposed renames require substantial build file modifications or need dependencies broken, and therefore are not covered with this script.
  2. Apply the pre-processed renames and include / import fixups
    3-N. Apply some manual fixes, as well as run scripts like the linters, upstream utils, pregenerated files, etc
    N-M. Apply namespace changes. This is a combination of automated find/replace as well as hand fixes.

An intermediate file, refactor_layout_pp.json is created to track the file moves and namespace / import changes. This file can be repurposed in a simpler script to help with the upgrade process for vendors / teams

Other notes

The namespace changes were non-trivial. Since some projects (wpiutil, wpinet shared wpi::, wpimath, wpilibc shared frc::) you cannot trivially do a bulk replacement and differentiate between what belongs to what new nested namespace. Furthermore, there is no consistency in C++ if files have using namespace XXX; vs namespace XXX {}. Also there was no consistency between when fully qualified names were used vs non fully qualified.

To address these things a couple of function / types are defined a prior to get replaced before bulk actions happen. In addition, everything, in both .cpp files and .h files will use fully qualified namespaces, regardless of the fact that they all now share a common wpi:: prefix.

Some of the regex's could probably be combined / simplified / more robust, but it works for a temporary script.

The script is not intended to be located inside of allwpilib, but I thought this would be the best way to review it.

@pjreiniger pjreiniger requested review from a team as code owners September 27, 2025 15:42
@github-actions
Copy link
Contributor

This PR modifies commands. Please open a corresponding PR in Python Commands and include a link to this PR.

@github-actions github-actions bot added component: ntcore NetworkTables library component: cscore CameraServer library component: wpilibj WPILib Java component: wpilibc WPILib C++ component: hal Hardware Abstraction Layer component: command-based WPILib Command Based Library component: glass Glass app and backend component: outlineviewer OutlineViewer app component: datalogtool DataLog Tool component: apriltag AprilTag library component: examples component: sysid SysId app component: epilogue Annotation-based logging library 2027 2027 target component: wpical WPIcal labels Sep 27, 2025
@pjreiniger pjreiniger force-pushed the big_refactor_public_full branch from 4652273 to e4fa5fd Compare October 5, 2025 01:58
@github-actions github-actions bot removed the component: wpilibj WPILib Java label Oct 5, 2025
@pjreiniger pjreiniger force-pushed the big_refactor_public_full branch from e4fa5fd to 4607920 Compare October 9, 2025 00:44
@pjreiniger pjreiniger force-pushed the big_refactor_public_full branch from 4607920 to b5eb113 Compare October 16, 2025 04:53
@pjreiniger pjreiniger force-pushed the big_refactor_public_full branch 2 times, most recently from c15b5f3 to 4288a48 Compare November 4, 2025 01:09
@daltzctr
Copy link
Contributor

daltzctr commented Nov 4, 2025

Can a summary/list of the changes in this reorg be added to the PR description or the comment? Just to make it a bit easier when updating dependent references

@pjreiniger pjreiniger force-pushed the big_refactor_public_full branch from 4288a48 to 51d4a4b Compare November 8, 2025 02:13
@PeterJohnson PeterJohnson merged commit 2109161 into wpilibsuite:2027 Nov 8, 2025
32 of 34 checks passed
@sciencewhiz
Copy link
Contributor

I'm also hoping to make a watered down version of the script that can hopefully handle the vast majority of the renames for vendors and teams

The vscode importer does regex replacements, so if it's possible to describe the changes that way, teams wouldn't need to run a separate script.

@pjreiniger pjreiniger deleted the big_refactor_public_full branch November 11, 2025 02:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2027 2027 target component: apriltag AprilTag library component: command-based WPILib Command Based Library component: cscore CameraServer library component: datalogtool DataLog Tool component: epilogue Annotation-based logging library component: examples component: glass Glass app and backend component: hal Hardware Abstraction Layer component: ntcore NetworkTables library component: outlineviewer OutlineViewer app component: sysid SysId app component: wpical WPIcal component: wpilibc WPILib C++

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants