Skip to content

Commit 25d00a0

Browse files
authored
v8: fix V8 upgrades from 7.4 (nodejs#331)
* v8: fix V8 upgrades from 7.4 - Just increment NODE_MODULE_VERSION automatically by one. Now that this constant can also be used by embedders, it is no longer predictable - Add a --no-version-bump so we can skip this task for canary builds. - From V8 7.4 on, gypfiles are located in tools/ instead of deps/v8. Stop trying to move them around.
1 parent 5a27e9c commit 25d00a0

File tree

5 files changed

+25
-90
lines changed

5 files changed

+25
-90
lines changed

components/git/v8.js

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ module.exports = {
2323
describe: 'Branch of the V8 repository to use for the upgrade',
2424
default: 'lkgr'
2525
});
26+
yargs.option('version-bump', {
27+
describe: 'Bump the NODE_MODULE_VERSION constant by one',
28+
default: true
29+
});
2630
}
2731
})
2832
.command({
@@ -35,14 +39,16 @@ module.exports = {
3539
desc: 'Backport one or more commits from the V8 repository',
3640
handler: main,
3741
builder: (yargs) => {
38-
yargs.option('bump', {
39-
describe: 'Bump V8 embedder version number or patch version',
40-
default: true
41-
}).option('squash', {
42-
describe:
43-
'If multiple commits are backported, squash them into one',
44-
default: false
45-
});
42+
yargs
43+
.option('bump', {
44+
describe: 'Bump V8 embedder version number or patch version',
45+
default: true
46+
})
47+
.option('squash', {
48+
describe:
49+
'If multiple commits are backported, squash them into one',
50+
default: false
51+
});
4652
}
4753
})
4854
.demandCommand(1, 'Please provide a valid command')

docs/git-node.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ A custom Git command for managing pull requests. You can run it as
2424
Note: the prerequistes are not required for `git node v8`.
2525

2626
1. See the readme on how to
27-
[set up credentials](../README.md#setting-up-credentials).
27+
[set up credentials](../README.md#setting-up-credentials).
2828
1. It's a Git command, so make sure you have Git installed, of course.
2929
1. Configure your upstream remote and branch name.
3030

@@ -85,7 +85,8 @@ Examples:
8585
If you are using `git bash` and having trouble with output use
8686
`winpty git-node.cmd metadata $PRID`.
8787

88-
current known issues with git bash:
88+
Current known issues with git bash:
89+
8990
- git bash Lacks colors.
9091
- git bash output duplicates metadata.
9192

@@ -244,6 +245,9 @@ Options:
244245
- `--branch=branchName`: Branch of the V8 repository to use for the upgrade.
245246
Defaults to `lkgr`.
246247

248+
- `--no-version-bump`: Disable automatic bump of the `NODE_MODULE_VERSION`
249+
constant.
250+
247251
### `git node v8 minor`
248252

249253
Compare current V8 version with latest upstream of the same major. Applies a

lib/update-v8/gypfiles.js

Lines changed: 0 additions & 60 deletions
This file was deleted.

lib/update-v8/majorUpdate.js

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,6 @@ const {
1414
addToGitignore,
1515
replaceGitignore
1616
} = require('./util');
17-
const {
18-
moveGypfilesOut,
19-
moveGypfilesIn,
20-
updateGypfiles
21-
} = require('./gypfiles');
2217
const applyNodeChanges = require('./applyNodeChanges');
2318
const { chromiumGit, v8Deps } = require('./constants');
2419

@@ -29,14 +24,11 @@ module.exports = function() {
2924
return new Listr([
3025
common.getCurrentV8Version(),
3126
checkoutBranch(),
32-
moveGypfilesOut(),
3327
removeDepsV8(),
3428
cloneLocalV8(),
3529
removeDepsV8Git(),
3630
updateV8Deps(),
37-
applyNodeChanges(),
38-
moveGypfilesIn(),
39-
updateGypfiles()
31+
applyNodeChanges()
4032
]);
4133
}
4234
};

lib/update-v8/updateVersionNumbers.js

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@ module.exports = function() {
1919
function bumpNodeModule() {
2020
return {
2121
title: 'Bump NODE_MODULE_VERSION',
22-
task: async(ctx, task) => {
22+
task: async(ctx) => {
2323
const v8Version = util.getNodeV8Version(ctx.nodeDir);
2424
const currentModuleVersion = getModuleVersion(ctx.nodeDir);
25-
const newModuleVersion = translateV8ToModuleVersion(v8Version);
26-
if (currentModuleVersion === newModuleVersion) {
27-
task.skip('version is the same');
28-
return;
29-
}
25+
const newModuleVersion = currentModuleVersion + 1;
3026
updateModuleVersion(ctx.nodeDir, newModuleVersion, v8Version);
3127
await ctx.execGitNode('add', 'src/node_version.h');
3228
await ctx.execGitNode(
@@ -36,7 +32,8 @@ function bumpNodeModule() {
3632
'-m',
3733
getCommitBody(v8Version)
3834
);
39-
}
35+
},
36+
skip: (ctx) => ctx.noVersionBump
4037
};
4138
}
4239

@@ -62,10 +59,6 @@ function updateModuleVersion(nodeDir, newVersion, v8Version) {
6259
fs.writeFileSync(path, nodeVersionH);
6360
}
6461

65-
function translateV8ToModuleVersion(v8Version) {
66-
return parseInt(String(v8Version[0]) + String(v8Version[1]), 10) - 3;
67-
}
68-
6962
function getCommitTitle(moduleVersion) {
7063
return `src: update NODE_MODULE_VERSION to ${moduleVersion}`;
7164
}

0 commit comments

Comments
 (0)