Skip to content

build: add --without-amaro build flag #54136

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

Merged
merged 3 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,12 @@
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',
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 6 additions & 1 deletion node.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -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': [
Expand Down Expand Up @@ -461,6 +461,11 @@
}, {
'use_openssl_def%': 0,
}],
[ 'node_use_amaro=="true"', {
'deps_files': [
'deps/amaro/dist/index.js',
]
} ]
],
},

Expand Down
5 changes: 5 additions & 0 deletions node.gypi
Original file line number Diff line number Diff line change
Expand Up @@ -412,5 +412,10 @@
}, {
'defines': [ 'HAVE_OPENSSL=0' ]
}],
[ 'node_use_amaro=="true"', {
'defines': [ 'HAVE_AMARO=1' ],
}, {
'defines': [ 'HAVE_AMARO=0' ]
}],
],
}
3 changes: 3 additions & 0 deletions src/node_metadata.cc
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,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();
Expand Down
8 changes: 7 additions & 1 deletion src/node_metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)

Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-commonjs.mjs
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-eval.mjs
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript-module.mjs
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 3 additions & 1 deletion test/es-module/test-typescript.mjs
Original file line number Diff line number Diff line change
@@ -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',
Expand Down
4 changes: 3 additions & 1 deletion test/parallel/test-process-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand Down
Loading