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

Cmake is producing a clean build everytime #277

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

takameyer
Copy link

cmakebuild.js is hardcoded to 'rebuild', which cleans all build artifacts beforhand. This is problematic for incremental builds in CI. This hardcodes it to 'build' instead

cmakebuild.js is hardcoded to 'rebuild', which cleans all build artifacts beforhand.  This is problematic for incremental builds in CI.  This hardcodes it to 'build' instead
Copy link
Member

@vweevers vweevers left a comment

Choose a reason for hiding this comment

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

I don't use cmake myself so would like to hear from cmake users. I have no objections (except that it's asymmetrical with node-gyp where we do use rebuild).

@vweevers
Copy link
Member

@takameyer To remove the risk of breakage and speed up landing this PR, perhaps the behavior should be opt-in. Via a new command line option, like --no-clean or --no-rebuild. WDYT?

@takameyer
Copy link
Author

takameyer commented May 17, 2021

@vweevers that seems fair. I would prefer a --clean flag, but I think for consistency a --no-clean flag would be appropriate. Are there other places int this tool where this could be implemented?

@vweevers
Copy link
Member

The new option can be added to defaults here:

prebuild/rc.js

Lines 8 to 10 in 7c08103

var rc = require('rc')('prebuild', {
target: process.versions.node,
runtime: 'node',

Like so:

var rc = require('rc')('prebuild', { 
  clean: true,
  ...
}

Which isn't strictly required, but keeps us aware of supported options. No additional code is needed for argument parsing, because our parser (minimist) will recognize --no-clean as a boolean out of the box. Then to use the new option, add opts.clean === false ? 'build' : 'rebuild' to 2 places:

var args = ['build']

args.push('rebuild')

We could also do opts.clean ? 'rebuild' : 'build' but that would require updating unit tests & the programmatic API (which don't use rc.js).

Lastly, a new unit test would be good to have. For gyp you can copy this test to a new test in the same file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants