0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-21 21:19:50 +01:00

build: add --without-amaro build flag

PR-URL: https://github.com/nodejs/node/pull/54136
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Marco Ippolito <marcoippolito54@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
This commit is contained in:
Antoine du Hamel 2024-08-02 12:37:36 +02:00 committed by GitHub
parent 2f7a354f14
commit 1e3a3470a5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 43 additions and 7 deletions

View File

@ -765,6 +765,12 @@ http2_optgroup.add_argument('--debug-nghttp2',
default=None,
help='build nghttp2 with DEBUGBUILD (default is false)')
parser.add_argument('--without-amaro',
action='store_true',
dest='without_amaro',
default=None,
help='do not install the bundled Amaro (TypeScript utils)')
parser.add_argument('--without-npm',
action='store_true',
dest='without_npm',
@ -1380,6 +1386,7 @@ def configure_node(o):
o['variables']['node_prefix'] = options.prefix
o['variables']['node_install_npm'] = b(not options.without_npm)
o['variables']['node_install_corepack'] = b(not options.without_corepack)
o['variables']['node_use_amaro'] = b(not options.without_amaro)
o['variables']['debug_node'] = b(options.debug_node)
o['default_configuration'] = 'Debug' if options.debug else 'Release'
o['variables']['error_on_warn'] = b(options.error_on_warn)

View File

@ -14,6 +14,7 @@
'force_dynamic_crt%': 0,
'ossfuzz' : 'false',
'node_module_version%': '',
'node_use_amaro%': 'true',
'node_shared_brotli%': 'false',
'node_shared_zlib%': 'false',
'node_shared_http_parser%': 'false',
@ -56,7 +57,6 @@
'deps/acorn/acorn/dist/acorn.js',
'deps/acorn/acorn-walk/dist/walk.js',
'deps/minimatch/index.js',
'deps/amaro/dist/index.js',
'<@(node_builtin_shareable_builtins)',
],
'node_sources': [
@ -461,6 +461,11 @@
}, {
'use_openssl_def%': 0,
}],
[ 'node_use_amaro=="true"', {
'deps_files': [
'deps/amaro/dist/index.js',
]
} ]
],
},

View File

@ -412,5 +412,10 @@
}, {
'defines': [ 'HAVE_OPENSSL=0' ]
}],
[ 'node_use_amaro=="true"', {
'defines': [ 'HAVE_AMARO=1' ],
}, {
'defines': [ 'HAVE_AMARO=0' ]
}],
],
}

View File

@ -126,7 +126,10 @@ Metadata::Versions::Versions() {
acorn = ACORN_VERSION;
cjs_module_lexer = CJS_MODULE_LEXER_VERSION;
uvwasi = UVWASI_VERSION_STRING;
#if HAVE_AMARO
amaro = AMARO_VERSION;
#endif
#if HAVE_OPENSSL
openssl = GetOpenSSLVersion();

View File

@ -27,6 +27,12 @@ namespace node {
#define NODE_HAS_RELEASE_URLS
#endif
#if HAVE_AMARO
#define NODE_VERSIONS_KEY_AMARO(V) V(amaro)
#else
#define NODE_VERSIONS_KEY_AMARO(V)
#endif
#ifndef NODE_SHARED_BUILTIN_UNDICI_UNDICI_PATH
#define NODE_VERSIONS_KEY_UNDICI(V) V(undici)
#else
@ -51,7 +57,7 @@ namespace node {
V(sqlite) \
V(ada) \
V(nbytes) \
V(amaro) \
NODE_VERSIONS_KEY_AMARO(V) \
NODE_VERSIONS_KEY_UNDICI(V) \
V(cjs_module_lexer)

View File

@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
test('require a .ts file with explicit extension succeeds', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',

View File

@ -1,7 +1,9 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
test('eval TypeScript ESM syntax', async () => {
const result = await spawnPromisified(process.execPath, [
'--input-type=module',

View File

@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
test('expect failure of a .mts file with CommonJS syntax', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',

View File

@ -1,8 +1,10 @@
import { spawnPromisified } from '../common/index.mjs';
import { skip, spawnPromisified } from '../common/index.mjs';
import * as fixtures from '../common/fixtures.mjs';
import { match, strictEqual } from 'node:assert';
import { test } from 'node:test';
if (!process.config.variables.node_use_amaro) skip('Requires Amaro');
test('execute a TypeScript file', async () => {
const result = await spawnPromisified(process.execPath, [
'--experimental-strip-types',

View File

@ -24,11 +24,13 @@ const expected_keys = [
'ada',
'cjs_module_lexer',
'nbytes',
'amaro',
];
const hasUndici = process.config.variables.node_builtin_shareable_builtins.includes('deps/undici/undici.js');
if (process.config.variables.node_use_amaro) {
expected_keys.push('amaro');
}
if (hasUndici) {
expected_keys.push('undici');
}