Skip to content

Add node-gyp-build-major parameter to support v4 naming convention#90

Merged
szegedi merged 5 commits intomainfrom
support-node-gyp-build-v4
Mar 9, 2026
Merged

Add node-gyp-build-major parameter to support v4 naming convention#90
szegedi merged 5 commits intomainfrom
support-node-gyp-build-v4

Conversation

@szegedi
Copy link
Copy Markdown
Contributor

@szegedi szegedi commented Mar 4, 2026

Summary

  • Adds a node-gyp-build-major workflow input (default: 3) to opt into the v4 prebuild naming convention
  • node-gyp-build v4 changed from directory-encoded libc (linuxglibc-arm64/node-115.node) to tag-based filenames (linux-arm64/dd_pprof.node.abi115.node)
  • When set to 4, the action generates prebuilds with the new convention:
    • Directory: prebuilds/${platform}-${arch}/ (no libc in dir name)
    • Filename: ${TARGET_NAME}[.musl].node.[napi|abi${N}].node (libc encoded as .musl tag; glibc is the default and needs no tag)
  • Artifact upload path is broadened to prebuilds/**/* for v4 (since directory names no longer match job names)
  • All existing behavior is unchanged when node-gyp-build-major is not set (defaults to 3)

Motivation

Needed by pprof-nodejs#284 which bumps node-gyp-build from 3.x to 4.x.

Test plan

  • Verify existing builds still pass with default node-gyp-build-major: 3
  • Verify pprof-nodejs PR #284 passes with node-gyp-build-major: 4

🤖 Generated with Claude Code

Jira: PROF-14113

node-gyp-build v4 changed prebuild naming from:
  prebuilds/${platform}${libc}-${arch}/node-${abi}.node
to a tag-based convention:
  prebuilds/${platform}-${arch}/${name}[.musl].node.[napi|abi${N}].node

Add NODE_GYP_BUILD_MAJOR (default: 3) to prebuild/index.js, exposed as
node-gyp-build-major workflow input. When set to 4:
- Directory: platform-arch (no libc suffix; glibc is assumed by default)
- Filename: name[.musl].node.[napi|abi${N}].node (libc encoded as tag)
- Artifact upload uses prebuilds/**/* to match the new directory names

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@szegedi szegedi requested a review from a team as a code owner March 4, 2026 17:21
szegedi and others added 4 commits March 4, 2026 18:28
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@szegedi szegedi merged commit e488d9d into main Mar 9, 2026
185 checks passed
szegedi added a commit that referenced this pull request Mar 23, 2026
PR #90 refactored prebuild output naming into a shared
prebuildFilename() function, but the v3 code path hardcoded the
"node-{abi}.node" prefix, ignoring the baseName parameter. This broke
Rust builds which previously preserved the original binary name from
build/Release/ (e.g. "process-discovery-napi.node" became
"node-napi.node"), causing consumers like libdatadog-nodejs to fail
with "Could not find a {name} binary for {platform}".

The fix makes prebuildFilename() use baseName in the v3 path, and
passes 'node' from the non-Rust call site to preserve backward
compatibility there.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
szegedi added a commit that referenced this pull request Mar 23, 2026
Move prebuildDir and prebuildFilename into prebuild/naming.js as pure
functions (all dependencies passed as parameters) so they can be tested
in isolation. Add test/naming.js covering v3 and v4 naming for both
Rust (dynamic baseName) and non-Rust (fixed 'node' prefix) builds.

This would have caught the regression in PR #90 where v3 Rust builds
lost the original binary name.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
szegedi added a commit that referenced this pull request Mar 23, 2026
* Fix v3 prebuild naming for Rust builds

PR #90 refactored prebuild output naming into a shared
prebuildFilename() function, but the v3 code path hardcoded the
"node-{abi}.node" prefix, ignoring the baseName parameter. This broke
Rust builds which previously preserved the original binary name from
build/Release/ (e.g. "process-discovery-napi.node" became
"node-napi.node"), causing consumers like libdatadog-nodejs to fail
with "Could not find a {name} binary for {platform}".

The fix makes prebuildFilename() use baseName in the v3 path, and
passes 'node' from the non-Rust call site to preserve backward
compatibility there.

Test have also been added to cover the functionality.

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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.

2 participants