Skip to content

refactor: modernize build system, add tests, CI, and auto-versioning#1

Open
halfguru wants to merge 1 commit into
hapqe:mainfrom
halfguru:modernize
Open

refactor: modernize build system, add tests, CI, and auto-versioning#1
halfguru wants to merge 1 commit into
hapqe:mainfrom
halfguru:modernize

Conversation

@halfguru
Copy link
Copy Markdown

@halfguru halfguru commented May 15, 2026

Summary

Complete overhaul of the procon2droid Magisk module with modern tooling and practices.

Note: This PR was created with AI assistance.
Important: This has not been tested on actual hardware. The author will need to verify functionality on their Android device with a Nintendo Switch 2 Pro Controller.

Changes

Build System

  • Replace monolithic source files with CMake + Ninja build
  • Add CMakePresets.json for native (tests) and Android cross-compile
  • Auto-generate module.prop from CMake version via configure_file (single source of truth)

Code Quality

  • Restructure src/ into common/, enable/, rumble/
  • Modern C++20: constexpr, std::array, std::span, std::optional, std::copy
  • Use std::unique_ptr with custom deleter for DIR* RAII (no hand-rolled classes)
  • Add const correctness, standard EXIT_SUCCESS/EXIT_FAILURE return codes
  • Add file header comments explaining each component

Testing

  • Add 18 Catch2 tests for init sequence and haptic report
  • Tests run natively on Windows/macOS/Linux via CMake presets
  • Note: Tests cover pure logic only. Device interaction requires real hardware.

CI/CD

  • GitHub Actions: lint (clang-format + clang-tidy), test, Android cross-compile
  • Cross-compile for arm64-v8a and armeabi-v7a with NDK r27c
  • Auto-strip Android binaries, package Magisk zips on releases

Service Script

  • Replace pgrep substring matching with PID file tracking
  • Add timestamped logging, cleanup traps, binary sanity checks
  • Handle enable exit status and controller removal gracefully

Tooling

  • Add .clang-format (LLVM style), .clang-tidy with suppressions
  • Add .gitignore, .gitattributes with LF normalization

@halfguru halfguru force-pushed the modernize branch 3 times, most recently from 24a3977 to f107b78 Compare May 15, 2026 19:17
Complete overhaul of the procon2droid Magisk module with modern tooling:

Build System
- Replace monolithic source files with CMake + Ninja build
- Add CMakePresets.json for native (tests) and Android cross-compile
- Auto-generate module.prop from CMake version via configure_file

Code Quality
- Restructure src/ into common/, enable/, rumble/
- Modern C++20: constexpr, std::array, std::span, std::optional, std::copy
- Use std::unique_ptr with custom deleter for DIR* RAII
- Add const correctness, standard EXIT_SUCCESS/EXIT_FAILURE return codes
- Add file header comments explaining each component

Testing
- Add 18 Catch2 tests for init sequence and haptic report
- Tests run natively on Windows/macOS/Linux via CMake presets

CI/CD
- GitHub Actions: lint (clang-format + clang-tidy), test, Android cross-compile
- Use egor-tensin/setup-clang@v2 for consistent LLVM 22 tooling
- Cross-compile for arm64-v8a and armeabi-v7a with NDK r27c
- Auto-strip Android binaries, package Magisk zips on releases

Service Script
- Replace pgrep substring matching with PID file tracking
- Add timestamped logging, cleanup traps, binary sanity checks
- Handle enable exit status and controller removal gracefully

Tooling
- Add .clang-format (LLVM style), .clang-tidy with suppressions
- Add .gitignore, .gitattributes with LF normalization
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant