-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
build,tools: refactor build config into config.json #25798
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -193,6 +193,10 @@ def ReadMacros(lines): | |
return UnionBytes(config_raw, arraysize(config_raw)); // config.gypi | ||
}} | ||
|
||
UnionBytes NativeModuleLoader::GetBuildConfig() {{ | ||
return UnionBytes(build_config_raw, arraysize(build_config_raw)); // config.json | ||
}} | ||
|
||
}} // namespace native_module | ||
|
||
}} // namespace node | ||
|
@@ -271,12 +275,19 @@ def AddModule(module, source): | |
# later on anyway, so get it out of the way now | ||
if name.endswith('.gypi'): | ||
# Currently only config.gypi is allowed | ||
assert name == 'config.gypi' | ||
lines = re.sub(r'\'true\'', 'true', lines) | ||
lines = re.sub(r'\'false\'', 'false', lines) | ||
assert name.endswith('config.gypi') | ||
config_filename = str(name).replace('gypi', 'json') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why not just pass config.json to js2c in node.gyp? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For the time being I'm assuming 1:1 correspondence, and I want to keep the embedded |
||
config = ReadFile(config_filename) | ||
config = re.sub('"true"', 'true', config) | ||
config = re.sub('"false"', 'false', config) | ||
print(config) | ||
config_definition = GetDefinition('build_config_raw', config) | ||
definitions.append(config_definition) | ||
lines = lines.replace("{ 'includes': ['config.json']}", config) | ||
lines = re.sub(r'#.*?\n', '', lines) | ||
lines = re.sub(r'\'', '"', lines) | ||
lines = re.sub("'", '"', lines) | ||
definition = GetDefinition('config_raw', lines) | ||
print(lines) | ||
definitions.append(definition) | ||
else: | ||
AddModule(name.split('.', 1)[0], lines) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does any downstream rely on the variables being in
config.gypi
instead of being included? (Not sure who to ping but I guess this could make the PR semver-major?)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't we just recreate config.gypi in this script? Or does that defeat the purpose of this PR if there is an inconsistency between what's generated in the build and what gets distributed in the tarballs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have considered that. Since they are both created by
./configure
we could do that to solve this if we find it's a problem.I wanted to do it like this to see if we can map the scope by looking for things that break.
(P.S. if we decide to make this semver-major, then I guess it would make sense to add the deprecation of
process.config
here)