Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor build improvements #614

Closed
wants to merge 3 commits into from
Closed

Minor build improvements #614

wants to merge 3 commits into from

Conversation

rotu
Copy link
Contributor

@rotu rotu commented Jun 14, 2024

  1. Don't skip tsc on install script. Previously, if script/build.js exists, we would skip the C++ build.
  2. Fix issue with github tags if ZMQ version provided as semver. (github seems to normalize tarballed directory name by stripping leading v from tag)
  3. Build scripts before node-gyp. Build library wrappers after.

Removed from this PR:

  • Remove questionable .npmrc
  • Switch to standard node-gyp-build. Modified version tends to hang on failure instead of crash.

@rotu rotu marked this pull request as draft June 14, 2024 08:38
package.json Outdated Show resolved Hide resolved
package.json Outdated
Comment on lines 91 to 95
"prebuild": "run-s build.js && node ./script/prebuild.js",
"prebuild": "node ./script/prebuild.js",
"build.native": "node-gyp configure --release && node-gyp build --release",
"build.native.debug": "cross-env CMAKE_BUILD_TYPE=Debug node-gyp configure --debug && cross-env CMAKE_BUILD_TYPE=Debug node-gyp build --debug",
"build": "run-s build.js build.native",
"build.debug": "run-s build.js build.native.debug",
Copy link
Member

Choose a reason for hiding this comment

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

Why skipping the Js build before when it is needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The preinstall hook is run before the install hook. That said, the scripts benefit very little from being written in TypeScript. I'd be in favor of converting them to plain JavaScript, or committing the compiled js to the repo so consumers can build the package from source without typescript installed.

script/build.ts Outdated
Comment on lines 10 to 14
process.env.ZMQ_VERSION || "20de92ac0a2b2b9a1869782a429df68f93c3625e"
const src_url = `https://github.com/zeromq/libzmq/archive/${zmq_rev}.tar.gz`
process.env.ZMQ_VERSION || "4.3.5"

// if it looks like a dot-separated version number, prepend with "v" to match repo tagging convention
const gitref = zmq_rev.match(/^\d+\./) ? `v${zmq_rev}` : zmq_rev
const src_url = `https://github.com/zeromq/libzmq/archive/${gitref}.tar.gz`
Copy link
Member

Choose a reason for hiding this comment

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

I use an exact commit hash instead of tags because upstream is slow in tagging their releases.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That makes a ton of sense and I love having the ability to have a hash. The version number is much more friendly. These changes still allow for a hash. I'll add a comment.

.npmrc Outdated Show resolved Hide resolved
Copy link
Member

@aminya aminya left a comment

Choose a reason for hiding this comment

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

Please change the title of the pull request to follow the Code of Conduct. We want to have a friendly environment here in Zeromq
https://zeromq.org/community/code-of-conduct/

@rotu rotu force-pushed the literary-squid branch 2 times, most recently from cc513dd to 0c31bba Compare June 14, 2024 22:15
1. Don't skip tsc on install script. Previously, if `script/build.js` exists, we would skip the C++ build.
2. Fix issue with github tags if ZMQ version provided as semver. (github seems to normalize tarballed directory name by stripping leading `v` from tag)
3. Build scripts before node-gyp. Build library wrappers after.
@rotu rotu changed the title Fix the darn build! Minor build improvements Jun 14, 2024
@rotu
Copy link
Contributor Author

rotu commented Jun 14, 2024

Please change the title of the pull request to follow the Code of Conduct. We want to have a friendly environment here in Zeromq https://zeromq.org/community/code-of-conduct/

I'm sorry if my words or tone seemed like trolling or like a personal attack! I don't at all mean to antagonize you or anyone else who pours selfless hours into open source software. I intended it to be levity over how frustrating it is to get a stable build process and an allusion to the frustrated confusion in recent issues.

Thank you for the tone reminder. I'll try to be more constructive with my wording in the future!

@rotu rotu marked this pull request as ready for review June 14, 2024 23:23
@rotu rotu marked this pull request as draft June 18, 2024 16:50
Copy link
Member

@aminya aminya left a comment

Choose a reason for hiding this comment

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

The building of JavaScript files doesn't need to happen on the user's machine since they are already included in the package. See #635

Comment on lines +8 to +14
// Revision to use. Can be a version number like "4.3.5", a branch name, or a commit hash.
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing, @typescript-eslint/strict-boolean-expressions
const zmq_rev = process.env.ZMQ_VERSION || "4.3.5"

// if it looks like a dot-separated version number, prepend with "v" to match repo tagging convention
const gitref = zmq_rev.match(/^\d+\./) ? `v${zmq_rev}` : zmq_rev
const src_url = `https://github.com/zeromq/libzmq/archive/${gitref}.tar.gz`
Copy link
Member

Choose a reason for hiding this comment

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

Given the conflicts and recent changes, this can be a separate pull request, but it needs some testing to verify it works

@aminya aminya closed this Jun 20, 2024
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