Skip to content
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

Modernize Codebase #18

Draft
wants to merge 35 commits into
base: master
Choose a base branch
from
Draft

Conversation

TheMrSheldon
Copy link
Member

@TheMrSheldon TheMrSheldon commented Apr 18, 2024

The age of the codebase is quite apparent in some places (e.g. boost::filesystem instead of std::filesystem and similar for optional and others). This pull-request aims to improve on this by modernizing the CMake build files, integrating protobuffs and antrl into the CMake build process instead of providing separate scripts, and updating the code to use C++23 features.

  • Modernize the CMake configuration to be compiler-agnostic and use CMake to manage include-directories and linking of dependencies
    • For netspeak
    • For tests
    • For python bindings
  • Integrate protobuffs and gRPC with CMake
  • Integrate antrl4 with CMake
  • Replace C Code with C++ Code
    • Use limits instead of UINT32_MAX and co
    • Remove macros (e.g., using constexpr)
    • Replace NULL with nullptr
    • Replace raw pointers with smart pointers
  • Replace boost dependencies that since have been standardized
    • Replace boost::filesystem with std::filesystem
    • Replace boost::optional with std::optional
    • *Replace boost::regex with std::regex (may not work due to minor implementation differences)
    • Replace boost::posix_time with std::chrono
  • Remove deprecated C++ features
    • Remove std::unary_function
    • Remove std::binary_function
    • Replace std::bind2nd with std::bind
    • Remove <codecvt>
    • Remove throw declarations and replace throw() with noexcept
  • Replace code that has cleaner alternatives in std
    • *Replace pair, triple, etc with std::tuple
    • Refactor util::Mut since its semantics are unclear Mut::Lock can be replaced with std::shared_ptr<std::lock_guard> and aliasing
    • *Refactor (or replace) FileDescriptor.hpp using std::filesystem
  • (Maybe) replace boost::program_options with CLI11 (more readable API; supports configuration files and environment variables; supports subcommands)
  • *Could JsonWriter be replaced with nlohmann/json (or rapid json if efficiency is desired)?
  • Replace is_valid_utf8 with is_valid from utf8cpp and similar for number_of_utf8_bytes
  • Migrate from Boost.Test to more modern systems like Catch2 or googletest
  • Use GitHub Actions
    • To test the code
    • Enforce codestyle
    • Check linters
    • To build and publish a docker container for netspeak
    • To build and deploy documentation
    • To report code coverage
    • *For automatic benchmarks
  • Miscellaneous Styling
    • Unify file naming scheme
    • Disallow all-caps -- only preprocessor definitions may (and must) be all-caps

Some of these points require more elaborate unit testing and separate pull requests and issues to recognize the work necessary and ensure compatibility. These are marked with an *.

@TheMrSheldon
Copy link
Member Author

std::filesystem, std::ifstream, std::ofstream, and std::optional are currently used as drop-in replacements for their boost counterparts. This should hold in large parts but may have introduced minor differences.

@TheMrSheldon TheMrSheldon added the enhancement New feature or request label Apr 18, 2024
@TheMrSheldon TheMrSheldon self-assigned this Apr 18, 2024
@TheMrSheldon TheMrSheldon added this to the v5.0.0 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant