Skip to content

Ryan/feat/qnx support#4

Open
ryan-wong157 wants to merge 21 commits into
mainfrom
ryan/feat/qnx_support
Open

Ryan/feat/qnx support#4
ryan-wong157 wants to merge 21 commits into
mainfrom
ryan/feat/qnx_support

Conversation

@ryan-wong157

@ryan-wong157 ryan-wong157 commented Jun 11, 2026

Copy link
Copy Markdown
Member

Version Notes: v1.3.0

srpkg:

  • Added --linux and --qnx flags to srpkg create which adds a conditional compile statement to the top of the CMakeLists.txt. Defaults to qnx. This means when srbuild --qnx is called, it will ignore all linux packages.
  • Refactored to remove ugly globals and update docstrings

srbuild:

  • Added --linux and --qnx flags to srbuild all and srbuild target commands. This initialises cmake with qnx toolchain file or doesn't. Defaults to qnx.
  • srbuild now generates build/linux or build/qnx instead of just build
  • srbuild clean still deletes build/ and doesn't distinguish between linux and qnx
  • INSTALL_PREFIX is now deploy/{target_platform}. This results in both deploy/linunx and deploy/qnx being created if a user compiles for both.
  • Refactored to remove globals
  • Updated and added new pyests

common_helpers.py:

  • Renamed from srutils.py

ryan-wong157 and others added 17 commits June 9, 2026 23:24
…sts.txt . Refactored parser building, added test folder generation in package.
Removed src/ and core/ verification in repo root, now only requires .sunswift-evsn marker file. Also refactored REPO_ROOT and TARGET globals to be function arguments for clarity. Updated some docstrings. Fixed embarrasing syntax bug..
Changed all globals to be locals and arguments to functions to improve clarity. Factored out arg parsing, added flags for qnx and linux build support
srbuild clean now by default deletes both build/linux and build/qnx. However, adding a --qnx or --linux flag deletes just that build dir if it exists
… for neatness. Also isntall prefix is now either is deploy/qnx or deploy/qnx
Updated version number and added new flags to srpkg.
Copilot AI review requested due to automatic review settings June 11, 2026 17:22

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial QNX-vs-Linux platform targeting to the srpkg/srbuild toolchain and updates docs/tests to reflect the new behavior and refactors.

Changes:

  • Introduces --qnx / --linux flags and per-platform build/install output directories (build/{qnx|linux}, deploy/{qnx|linux}).
  • Refactors shared repo-root helpers into host/common_helpers.py and removes some prior repo-structure assumptions.
  • Updates integration tests and README for new package skeleton (adds test/, switches params to TOML, updates usage examples).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
README.md Updates version notes, CLI usage examples, and output directory documentation for platform support.
host/common_helpers.py Defines shared marker-root validation and shared compiler flag constants.
host/srpkg Adds platform flags for package creation, adds test/ folder, emits platform guard in generated CMakeLists, refactors globals out.
host/srbuild Adds platform flags, introduces per-platform build/install directories, refactors globals out, adds/updates clean logic.
host/tests/conftest.py Adds a configured_repo fixture to satisfy srbuild sanity checks.
host/tests/test_srpkg_integration.py Updates integration tests for new package layout and relaxed repo structure assumptions.
host/tests/test_srbuild_integration.py Expands integration coverage for flags, clean prompting, and sanity checks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment on lines 59 to 62
├── test/ # Unit tests
├── param/ # Parameter files
├── param/param.toml # Default parameter template
├── CMakeLists.txt # Build configuration template
Comment thread host/srbuild Outdated
Comment on lines 224 to 228
common_flags = argparse.ArgumentParser(add_help=False)
common_flags.add_argument("--jobs", "-j", default=8, type=int, help="Number of parallel jobs Make runs. Default=8")
common_flags.add_argument("--qnx", action="store_true", help="Build QNX packages")
common_flags.add_argument("--linux", action="store_true", help="Build Linux packages")

Comment thread host/srbuild
Comment on lines +110 to +112
if build_data.target_platform == "qnx":
cmd.append(f"-DCMAKE_TOOLCHAIN_FILE={build_data.repo_root / Path(QNX_TOOLCHAIN_PATH)}")

Comment thread host/srpkg
Comment on lines +223 to +226
command_create.add_argument("name", help="Name of package to create (snake_case)")
command_create.add_argument("--linux", action="store_true", help="Package to target Linux")
command_create.add_argument("--qnx", action="store_true", help="Package to target QNX")
command_info.add_argument("name", help="Name of package to get info on")

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually a good suggestion to implement

Comment thread README.md Outdated
Comment thread README.md Outdated
Comment thread README.md Outdated
Comment on lines +92 to +94
├── deploy/
│ ├── bin/ # Node executables
│ ├── param/
│ └── tools/ # srlaunch, srdds
│ ├── bin/ # Node executables
│ └── param/ # Runtime parameter files
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

@genryjiang genryjiang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head f346d209ff4120c7b109382fd1f38e8540f6e880.

I found one additional functional blocker in srpkg: package discovery still assumes packages live under src/, while this PR now allows creating them from any directory in the repo. That makes newly-created packages outside src/ invisible to info/list and allows duplicate target names outside src/.

The existing Copilot comments about srbuild not defining SR_TARGET_QNX/SR_TARGET_LINUX, non-mutually-exclusive platform flags, and clean --linux/--qnx being documented but rejected are also still valid on this head. I reproduced srbuild clean --linux failing at argparse and confirmed srbuild all --linux does not write any SR_TARGET_* variable into the CMake cache.

Tests: python3 -m pytest host/tests -q passes (29 passed), but the suite currently misses these edge cases.

Comment thread host/srpkg
Reverted directory checking changes: now requires src/ and core/ to be in repo_root before allowing srpkg and srbuild (logic common_helpers.py:validate_repo_root(). Reverted allowing creating of packages anywhere in repo, now restricts to src/ again due to duplication finding logic and srpkg list targeting the source directory only
@ryan-wong157

Copy link
Copy Markdown
Member Author

Changes listed in my latest commit

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Comments suppressed due to low confidence (1)

host/common_helpers.py:49

  • The PR description says srpkg no longer requires the repo root to have src/ and core/, but validate_repo_root still enforces both directories. Either the description needs updating, or srpkg/srbuild should use different validation rules (e.g., marker-only validation for srpkg, strict validation for srbuild).

Comment thread host/tests/conftest.py
Comment on lines +19 to +23
@pytest.fixture
def configured_repo(repo: Path) -> Path:
"""Repo that passes all srbuild sanity checks (has CMakeLists.txt)."""
(repo / "CMakeLists.txt").touch()
return repo
Comment thread host/srbuild
Comment on lines +101 to +112
cmd = [
"cmake",
"-S",
str(build_data.repo_root),
"-B",
str(build_data.build_dir_path),
f"-DCMAKE_INSTALL_PREFIX={build_data.install_prefix}"
]

if build_data.target_platform == "qnx":
cmd.append(f"-DCMAKE_TOOLCHAIN_FILE={build_data.repo_root / Path(QNX_TOOLCHAIN_PATH)}")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COPILOT ARE YOU STUPID. Ignore this comment. The toolchain file defines the cmake cache var, and the flags are not useless because it adds the conditional compile lines to top of cmakelsists.txtr and in srbuild it GIVES IT THE TOOLCHAIN FILE.

Comment thread host/srpkg Outdated
ryan-wong157 and others added 2 commits June 18, 2026 18:30
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
… on text in stdout or sterr which is fragile

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Comment thread host/srbuild

@genryjiang genryjiang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed current head d66492f.

I still see one functional blocker: srbuild all --linux does not set SR_TARGET_LINUX, while srpkg create generates package guards that rely on SR_TARGET_LINUX / SR_TARGET_QNX. I reproduced this with a minimal repo containing one QNX package and one Linux package: srbuild all --linux configured, built, and installed both packages, and build/linux/CMakeCache.txt contained neither SR_TARGET_LINUX nor SR_TARGET_QNX. If Linux builds are supposed to skip QNX packages, srbuild should set the relevant cache variable explicitly, for example -DSR_TARGET_LINUX=ON for Linux and likely -DSR_TARGET_QNX=ON for QNX. If Linux intentionally builds everything as a quick local-check path, the generated guards/docs should be adjusted so the behavior is explicit.

There is also a test gap in host/tests/test_srbuild_integration.py: the target tests only assert that build/linux exists. That directory is created before CMake tries to build the requested target, so srbuild target my_node --linux can exit 1 and the test still passes. These tests should assert success or define a minimal target that actually exists.

Small docs cleanup: the README version notes say --linux / --qnx were added to all srbuild subcommands, but srbuild clean --linux is rejected by argparse and the usage section shows bare srbuild clean. Either the note should be narrowed to all / target, or clean should accept the flags.

Resolved since the earlier review: srpkg create is back to requiring src/, and srpkg create --linux --qnx is now correctly rejected.

Checks run locally: python3 -m pytest host/tests -q passed with 32 passed; python3 -m py_compile host/srbuild host/srpkg host/common_helpers.py passed.

@genryjiang

Copy link
Copy Markdown

Other than that - LGTM (other parts seem to be semantics)

@genryjiang genryjiang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, docs look good and other stuff seem to be semantics mainly.

@genryjiang genryjiang left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

implement tests properly - missed cases, define build semantics

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.

3 participants