From d5d024d6ec4241bfb6449c314ee620cf6953ab25 Mon Sep 17 00:00:00 2001 From: Rod Vagg Date: Tue, 23 Jan 2018 21:48:49 +1100 Subject: [PATCH] Revert "build,tools: check freshness of doc addons" This reverts commit 2cb9e2a6f7c570fe317d560de840046595c3f2ec. Reverted along with d9b59def7 as this introduces freshness checks that are too stringent without the comprehensive dependency checking of introduced in d9b59def7 so `make test` won't work with this. Ref: https://github.com/nodejs/node/pull/17407 PR-URL: https://github.com/nodejs/node/pull/18287 Reviewed-By: Gireesh Punathil Reviewed-By: Richard Lau Reviewed-By: James M Snell Reviewed-By: Ben Noordhuis --- Makefile | 6 +----- tools/doc/addon-verify.js | 31 +++++++++---------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 33159d4af4d..eaf07109871 100644 --- a/Makefile +++ b/Makefile @@ -225,7 +225,7 @@ v8: .PHONY: test # This does not run tests of third-party libraries inside deps. -test: all check-doc-addons build-addons ## Runs default tests, linters, and builds docs. +test: all build-addons ## Runs default tests, linters, and builds docs. $(MAKE) -s doc-only $(MAKE) -s lint $(MAKE) -s cctest @@ -234,10 +234,6 @@ test: all check-doc-addons build-addons ## Runs default tests, linters, and buil $(CI_NATIVE_SUITES) \ $(CI_DOC) -.PHONY: check-doc-addons -check-doc-addons: $(NODE) - $(NODE) tools/doc/addon-verify.js --check - .PHONY: test-only test-only: all build-addons ## For a quick test, does not run linter or build docs. $(MAKE) cctest diff --git a/tools/doc/addon-verify.js b/tools/doc/addon-verify.js index e9b43a2b60c..51ba75ca45a 100644 --- a/tools/doc/addon-verify.js +++ b/tools/doc/addon-verify.js @@ -10,9 +10,6 @@ const rootDir = path.resolve(__dirname, '..', '..'); const doc = path.resolve(rootDir, 'doc', 'api', 'addons.md'); const verifyDir = path.resolve(rootDir, 'test', 'addons'); -const changed = []; -const checkOnly = process.argv.includes('--check'); - let id = 0; let currentHeader; @@ -79,6 +76,12 @@ for (const header in addons) { }) }); + try { + fs.mkdirSync(dir); + } catch (e) { + strictEqual(e.code, 'EEXIST'); + } + for (const file of files) { let content; try { @@ -88,29 +91,13 @@ for (const header in addons) { } // Only update when file content has changed to prevent unneeded rebuilds. - if (content === file.content) continue; - changed.push(file); - - if (checkOnly) continue; - - try { - fs.mkdirSync(dir); - } catch (e) { - strictEqual(e.code, 'EEXIST'); + if (content !== file.content) { + fs.writeFileSync(file.path, file.content); + console.log('wrote', file.path); } - - fs.writeFileSync(file.path, file.content); - console.log('wrote', file.path); } } -if (checkOnly && changed.length > 0) { - console.error('The following files are out of date:'); - for (const { path } of changed) console.error(' ', path); - console.error('Run `node tools/doc/addon-verify.js` to update.'); - process.exit(1); -} - function boilerplate(name, content) { return `'use strict'; const common = require('../../common');