Skip to content

Conversation

@kraenhansen
Copy link
Collaborator

Cmake expects paths to be using forward slashes as directory separator.

Merging this PR will:

  • Transform paths from using win32 separator () to using posix seperator (/) when CMakeList.txt files are generated by gyp-to-cmake and when the weak-node-api paths are injected by cmake-rn.

@kraenhansen kraenhansen self-assigned this Jun 19, 2025
@kraenhansen kraenhansen added CMake RN Our `cmake` wrapping CLI gyp-to-cmake labels Jun 19, 2025
@changeset-bot
Copy link

changeset-bot bot commented Jun 19, 2025

⚠️ No Changeset found

Latest commit: c76a8ae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@kraenhansen kraenhansen added the bug Something isn't working label Jun 19, 2025
@kraenhansen kraenhansen requested a review from Copilot June 19, 2025 15:14
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces support for converting Win32 path separators to POSIX style in CMakeLists.txt generation for both gyp-to-cmake and weak-node-api. It adds a new transformation option in the gyp-to-cmake transformer and updates the CLI and tests accordingly.

  • Added a new boolean option (transformWinPathsToPosix) to control path transformation.
  • Updated the command-line interface to support disabling transformation via the "--no-path-transforms" flag.
  • Implemented a new helper function in weak-node-api and added tests to verify the behavior.

Reviewed Changes

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

File Description
packages/gyp-to-cmake/src/transformer.ts Added transformWinPathsToPosix option and transformPath function
packages/gyp-to-cmake/src/transformer.test.ts Added tests validating that Win32 separators are converted to POSIX
packages/gyp-to-cmake/src/cli.ts Updated CLI option to support disabling path transformation
packages/cmake-rn/src/weak-node-api.ts Added toCmakePath function to convert paths (requires dependency fix)
Comments suppressed due to low confidence (1)

packages/cmake-rn/src/weak-node-api.ts:15

  • The 'path' module is used here without an explicit import. Add 'import path from "node:path";' at the top of the file.
  return input.split(path.win32.sep).join(path.posix.sep);

This was referenced Jun 19, 2025
@kraenhansen kraenhansen merged commit 9eb2b2f into main Jun 20, 2025
4 checks passed
@kraenhansen kraenhansen deleted the kh/gyp-to-cmake/transformed-paths branch June 20, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working CMake RN Our `cmake` wrapping CLI gyp-to-cmake

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants