Skip to content

Track active tools and SDKs in activated.json - #1766

Open
sbc100 wants to merge 1 commit into
mainfrom
activated-json
Open

Track active tools and SDKs in activated.json#1766
sbc100 wants to merge 1 commit into
mainfrom
activated-json

Conversation

@sbc100

@sbc100 sbc100 commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Store active tools and SDKs in a dedicated activated.json file when they are activated by emsdk activate. Update Tool.is_active() to check against activated.json rather than matching entries in .emscripten.

This solves several issues with the previous .emscripten-based is_active() logic:

  1. Tools with no activated_cfg (such as ccache or tools that only modify PATH or environment variables) previously returned is_active() == False because they had no .emscripten keys and no dependencies (len(deps) == 0).
  2. Tools with dependencies but no activated_cfg previously falsely reported is_active() == True whenever their dependencies were active, even if the tool itself was never activated.

This allows us to remove all of the activated_cfg entries that were there only to keep track of tool activation.

Replaces: #1345

@sbc100
sbc100 force-pushed the activated-json branch 4 times, most recently from 50c92bc to db9759e Compare August 3, 2026 21:28
@sbc100
sbc100 requested a review from juj August 3, 2026 21:29
@sbc100
sbc100 force-pushed the activated-json branch 2 times, most recently from 1031db7 to a3b8a46 Compare August 3, 2026 22:14
@sbc100
sbc100 requested a review from kripken August 5, 2026 22:04
@kripken

kripken commented Aug 6, 2026

Copy link
Copy Markdown
Member

The new behavior seems reasonable, but also changing the current long-standing behavior seems risky. How much of a benefit do you estimate our users would get from this?

@sbc100

sbc100 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

I think its much cleaner and clearer design. Without this we need to have dummy config vars in the .emscripten file that just server as magic strings to show that a tool is active. Its odd at best and confusing at worst.

For example there on mac an windows you will see PYTHON= the .emscripten config file even though nobody reads this or uses it. Its very confusing to have a setting like that that doesn't do anything.

We need the invent new functional FOO=bar settings for all tools, just to support making is_active() work as expected.

@sbc100

sbc100 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

I tired to mitigate the potential risk by building migration system from the old to new system. The idea is that maybe one day we can remove this.

Store active tools and SDKs in a dedicated `activated.json` file when
they are activated by `emsdk activate`. Update `Tool.is_active()` to check
against `activated.json` rather than matching entries in `.emscripten`.

This solves several issues with the previous `.emscripten`-based
`is_active()` logic:

1. Tools with no `activated_cfg` (such as `ccache` or tools that only
   modify `PATH` or environment variables) previously returned
   `is_active() == False` because they had no `.emscripten` keys and no
   dependencies (`len(deps) == 0`).
2. Tools with dependencies but no `activated_cfg` previously falsely
   reported `is_active() == True` whenever their dependencies were active,
   even if the tool itself was never activated.

Replaces: #1345
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.

2 participants