Skip to content

Migrate compiler settings to TOML - #28488

Open
sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:settings-toml
Open

sbc100 wants to merge 1 commit into
emscripten-core:mainfrom
sbc100:settings-toml

Conversation

@sbc100

@sbc100 sbc100 commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator

Replace src/settings.js and src/settings_internal.js with src/settings.toml and src/settings_internal.toml as the canonical source of truth for compiler setting defaults and documentation, while keeping setting metadata lists in tools/settings.py and setLikeSettings in src/utility.mjs.

Add tools/maint/gen_settings.py (replacing
tools/maint/update_settings_docs.py and wired into CI via --check) to validate the TOML files and generate checked-in outputs:

  • tools/settings_generated.py, consumed by tools/settings.py instead of regex-translating and exec-ing JS files
  • src/settings_generated.mjs, consumed by src/utility.mjs via structuredClone(defaultSettings) instead of vm.runInNewContext
  • site/source/docs/tools_reference/settings_reference.rst

Add tomli==2.3.0; python_version < '3.11' to requirements-dev.txt so Python 3.10 developers can run tools/maint/gen_settings.py (Python 3.11+ uses stdlib tomllib), and update stale settings.js references across tools and tests.

Fixes: #28311

Replace `src/settings.js` and `src/settings_internal.js` with
`src/settings.toml` and `src/settings_internal.toml` as the canonical
source of truth for compiler setting defaults and documentation.

Add `tools/maint/gen_settings.py` (replacing
`tools/maint/update_settings_docs.py` in CI's `--check` step) to
validate the TOML files and generate checked-in outputs:
- `tools/settings_generated.py`, consumed by `tools/settings.py`
  instead of regex-translating and `exec`-ing JS files
- `src/settings_generated.mjs`, consumed by `src/utility.mjs` via
  `structuredClone(defaultSettings)` instead of `vm.runInNewContext`
- `site/source/docs/tools_reference/settings_reference.rst`, with
  normalized/evaluated default values

Add `tomli==2.3.0; python_version < '3.11'` to `requirements-dev.txt`
so Python 3.10 developers can run `tools/maint/gen_settings.py` (Python
3.11+ uses stdlib `tomllib`), and update stale `settings.js`
references across tools, docs, and tests.

Fixes: emscripten-core#28311

This branch has not been deployed

No deployments
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.

Come up with a new way to maintain settings.js/settings_internal.js

1 participant