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

allow client-only architecture #71

Merged
merged 6 commits into from
Dec 24, 2024
Merged

allow client-only architecture #71

merged 6 commits into from
Dec 24, 2024

Conversation

eagleoflqj
Copy link
Member

@eagleoflqj eagleoflqj commented Nov 15, 2024

Android, iOS and Web cannot use the C-S architecture as-is. The core part of server is SessionHandler. Created a static global variable so server is not needed.
Created MozcClientInterface to allow both architectures.
MozcClient is a simplified version of mozc::client::Client, which keeps all APIs used by fcitx and discards those not used.
MozcClientHolder becomes a proxy of mozc::client::Client.
--define server=1 to keep existing C-S arch and --define server=0 for simplified arch.
Note: only Linux C-S should still be preferred because mozc_tool also talks to mozc_server. Only other platforms there is no mozc_tool yet so this is not a concern compared to not having fcitx5-mozc running at all.

@wengxt
Copy link
Member

wengxt commented Nov 15, 2024

Please create a shim layer and make it a compile time switch.

@eagleoflqj eagleoflqj changed the title let engine own SessionHandler to get rid of server [skip ci] allow client-only architecture Nov 17, 2024
"@fcitx5",
],
)

mozc_cc_library(
name = "mozc_client_impl",
Copy link
Member

Choose a reason for hiding this comment

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

  1. create mozc_client_interface target, things like mozc_engine can depend on it.
  2. Create two mozc_client_impl target one with server, one without.
  3. use select() on target, not on source files or deps, if possible.

"//client",
"//protocol:commands_cc_proto",
],
config_setting(
Copy link
Member

Choose a reason for hiding this comment

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

Example:
https://github.com/bazelbuild/examples/blob/b51e3bdd468ce8c4a516d7dca993909dcc84af32/configurations/select_on_build_setting/BUILD

You can see how it defines a flag and have a sane default value. (Hint: string_flag & "//conditions:default" ).

Also, "server" as a name is too generic. Better to define a name with "fcitx" in it so it's unique to fcitx (if you use string_flag you will get it for free, since flag is now --//unix/fcitx5:...

return false;
}

#if defined(_WIN32) || defined(__linux__)
Copy link
Member

Choose a reason for hiding this comment

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

This check may break BSD.

@wengxt wengxt merged commit e191411 into fcitx:fcitx Dec 24, 2024
7 checks passed
@eagleoflqj eagleoflqj deleted the serverless branch December 28, 2024 00:11
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