Skip to content
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

Remove JS_ENGINES and COMPILER_ENGINE from config file #1354

Merged
merged 1 commit into from
Mar 14, 2024

Conversation

sbc100
Copy link
Collaborator

@sbc100 sbc100 commented Mar 13, 2024

COMPILER_ENGINE was completely removed from emscripten in emscripten-core/emscripten#9469.

JS_ENGINES is only used/needed for testing and is no longer needed as of emscripten-core/emscripten#9542.

@sbc100 sbc100 requested a review from kripken March 13, 2024 16:16
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise, versions look right.

emsdk.py Outdated
cfg += 'COMPILER_ENGINE = NODE_JS\n'
# See https://github.com/emscripten-core/emscripten/pull/9542
if version < [1, 38, 48]:
cfg += 'JS_ENGINES = [NODE_JS]\n'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is in a loop - is it not possible that we get these more than once? Or do we guarantee that EMSCRIPTEN_ROOT appears exactly once in a single activated config?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose we could have more than one version of emscripten installed? But in that case the desired behaviour is that the config file should be a super-set of all the settings required I think.

The exact same pattern is used here:

emsdk/emsdk.py

Lines 2490 to 2494 in 7815dca

for tool in tools_to_activate:
config = tool.activated_config()
if 'EMSCRIPTEN_ROOT' in config:
# For older emscripten versions that don't use an embedded cache by
# default we need to export EM_CACHE.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The superset makes sense, but I think the current code can end up with duplication? That is,

JS_ENGINES = [NODE_JS]
JS_ENGINES = [NODE_JS]
JS_ENGINES = [NODE_JS]

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I don't think it matters because you can't really have more than one version of emscripten installed can you?

Also, those repeated keys would be harmless if you somehow did mange to activate more than one emscripten install at once

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But I don't think it matters because you can't really have more than one version of emscripten installed can you?

Yeah, I think only one can be active at once, but just wanted to check that my understanding was the same as yours. However, reading the code I can't easily confirm that, as in the manifest file EMSCRIPTEN_ROOT appears in things with id "releases" and also id "emscripten". I think a release contains emscripten among other things, so that suggests we use that field in more than one active thing?

Also, those repeated keys would be harmless if you somehow did mange to activate more than one emscripten install at once

I agree, it should not break anything, but would just look weird.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What solution would your propose here?

Remember this only effects very old version of emscripten. So in order to see this "wierd" duplication one would need to:

  1. Somehow install more than one version of emscripten (I'm pretty sure this is not support and/or would never work)
  2. Both version of emscripten would need to be these very old versions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps we could in the loop set a boolean "need legacy vars", and then outside of it if that is set then we add those two? That doesn't seem much more complex, and it seems safer to me.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But there is no safety issue so I'm not sure adding complexity here is worth it. Have those duplicate keys would be a very minor cosmetic issue (more folks are not going to look at this config file ever).

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I refactored and added find_emscripten_root() which returns the currently active emscripten root.

@sbc100 sbc100 force-pushed the remove_JS_ENGINES branch 2 times, most recently from afc0b36 to e68a0c2 Compare March 13, 2024 20:20
@sbc100 sbc100 requested a review from kripken March 13, 2024 20:21
Copy link
Member

@kripken kripken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm % comments

emsdk.py Outdated Show resolved Hide resolved
emsdk.py Show resolved Hide resolved
@sbc100 sbc100 force-pushed the remove_JS_ENGINES branch 2 times, most recently from d3c08df to 97ffb86 Compare March 13, 2024 23:17
`COMPILER_ENGINE` was completely removed from emscripten in
emscripten-core/emscripten#9469.

`JS_ENGINES` is only used/needed for testing and is no longer needed
as of emscripten-core/emscripten#9542.
@sbc100 sbc100 merged commit 5726ccc into main Mar 14, 2024
9 of 10 checks passed
@sbc100 sbc100 deleted the remove_JS_ENGINES branch March 14, 2024 00:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants