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

Enable build variants #42455

Open
John-LittleBearLabs opened this issue Jun 12, 2024 · 1 comment
Open

Enable build variants #42455

John-LittleBearLabs opened this issue Jun 12, 2024 · 1 comment

Comments

@John-LittleBearLabs
Copy link

The idea is to ease the dev process of downstream variants of Electron, which add built-in functionality which might be seen as too specific or out-of-scope for upstream... without maintaining patches for Electron code itself. If the idea is accepted in principle, I intend to contribute toward this end.

For example (obviously the names here are negotiable/bikesheddable):
electron/BUILD.gn uses exec_script, which...

  • If ../electron-spin/BUILD.gn is absent Electron builds exactly as it does now

  • Otherwise it gains a dependency on //electron-spin:hooks

    • For each X in a list defined in the script, if ../electron-spin/X.h exists a define is added to Electron
  • In a few strategic places in the code, #ifdef those defines, call some function whose name is effectively API.

    • For example, ElectronBrowserClient::WillCreateURLLoaderRequestInterceptors might call CreateSpinRequestInterceptors, but only if ELECTRON_SPIN_INTERCEPTORS is defined, which would happen if ../electron-spin/interceptors.h exists.

    I could also use __has_include instead of defines if you prefer to take that part out of the build system, but the exec_script would still be useful to have the dependency if and only if someone did actually add their directory there.

    Does this seem like a reasonable approach?

@John-LittleBearLabs
Copy link
Author

Personally, my main interest would be related to this , but the hope is to make the hooks generic enough that it could be useful for various features.

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

No branches or pull requests

1 participant