summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2018-01-20 01:00:34 +0100
committerRuben Bridgewater <ruben@bridgewater.de>2018-01-21 02:19:46 +0100
commitd9b59def72c718aaad3eefb6bf43f409ccefe4d2 (patch)
treeec02442a3153500b91e368c873db4d1a3763e567 /tools
parentc6682636be4955e2181c00e7d4868fbf6682a5c5 (diff)
downloadandroid-node-v8-d9b59def72c718aaad3eefb6bf43f409ccefe4d2.tar.gz
android-node-v8-d9b59def72c718aaad3eefb6bf43f409ccefe4d2.tar.bz2
android-node-v8-d9b59def72c718aaad3eefb6bf43f409ccefe4d2.zip
build,test: make building addon tests less fragile
* Get rid of recursive `make` when building the node binary. An earlier commit makes GYP write out rules that we can use for proper dependency tracking. * Use module name 'binding' in addons.md and addons-napi/*/binding.gyp. This massively simplifies the logic for generating the build rules. * Check in auto-generated add-on tests from `doc/api/addons.md`. The files change rarely and generating them dynamically causes no end of race conditions and special-casing during the build. PR-URL: https://github.com/nodejs/node/pull/17407 Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/doc/addon-verify.js11
1 files changed, 10 insertions, 1 deletions
diff --git a/tools/doc/addon-verify.js b/tools/doc/addon-verify.js
index 4da99d64d7..51ba75ca45 100644
--- a/tools/doc/addon-verify.js
+++ b/tools/doc/addon-verify.js
@@ -5,6 +5,7 @@ const fs = require('fs');
const path = require('path');
const marked = require('marked');
+const auto = 'Auto-generated by `node tools/doc/addon-verify.js`';
const rootDir = path.resolve(__dirname, '..', '..');
const doc = path.resolve(rootDir, 'doc', 'api', 'addons.md');
const verifyDir = path.resolve(rootDir, 'test', 'addons');
@@ -49,12 +50,20 @@ for (const header in addons) {
files = Object.entries(files).map(([name, content]) => {
if (name === 'test.js') content = boilerplate(name, content);
+ content = `// ${auto}\n${content}`;
+ if (name.endsWith('.h')) {
+ content = content.replace(/(#(ifndef|define) \w+_H)/g,
+ '$1 // NOLINT(build/header_guard)');
+ content = content.replace(/(#endif)$/,
+ '$1 // NOLINT(build/header_guard)');
+ }
+ if (!content.endsWith('\n')) content += '\n'; // Pacify linter.
return { name, content, path: path.resolve(dir, name) };
});
files.push({
path: path.resolve(dir, 'binding.gyp'),
- content: JSON.stringify({
+ content: `# ${auto}\n` + JSON.stringify({
targets: [
{
target_name: 'binding',