fix(jetbrains): apply patch for @vscode/policy-watcher macOS compilation #4563
+184
−1
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Context
The JetBrains plugin build fails on macOS due to a compilation error in
@vscode/policy-watcher. The package usesstd::optionalinPreferencesPolicy.hhbut doesn't include the<optional>header, causing the build to fail during native module compilation.This fix adds an automated patch application system that:
PreferencesPolicy.hhfile to include<optional>headerdeps/patches/vscode/jetbrains.patch)Implementation
Changes Made
Created patch file (
deps/patches/policy-watcher/macos-optional-fix.patch)#include <optional>toPreferencesPolicy.hhafter the CoreFoundation includeCreated patch application script (
scripts/apply-policy-watcher-patch.js)@vscode/policy-watcherfiles in both pnpm and npm node_modules structuresUpdated build script (
jetbrains/plugin/package.json)copy:resource-nodemodulesto:--ignore-scriptsto skip native compilation@vscode/policy-watcherafter patchingAdded documentation (
deps/patches/policy-watcher/README.md)Technical Details
The patch script:
PreferencesPolicy.hhfiles in both pnpm and npm structures#include <optional>after#include <CoreFoundation/CoreFoundation.h>The build process now:
--ignore-scripts)Screenshots
std::optionalcompilation errorsHow to Test
Clean build test:
cd jetbrains/plugin pnpm run clean:resource-nodemodules pnpm run copy:resource-nodemodulesVerify that the build completes without errors.
Full build test:
cd jetbrains/plugin pnpm run bundleVerify that the complete plugin bundle builds successfully.
Patch verification:
After running
copy:resource-nodemodules, check that the patch was applied:grep -A 2 "CoreFoundation" ../resources/node_modules/@vscode/policy-watcher/src/macos/PreferencesPolicy.hhShould show
#include <optional>after the CoreFoundation include.Multiple runs test:
Run
copy:resource-nodemodulesmultiple times to ensure the patch script handles already-patched files correctly.