Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into fcitx
Browse files Browse the repository at this point in the history
  • Loading branch information
Fcitx Bot committed Jan 16, 2025
2 parents bee3c60 + 5f08937 commit 3214ae6
Show file tree
Hide file tree
Showing 21 changed files with 62 additions and 47 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[Mozc - a Japanese Input Method Editor designed for multi-platform](https://github.com/google/mozc)
===================================

Copyright 2010-2024 Google LLC
Copyright 2010-2025 Google LLC

Mozc is a Japanese Input Method Editor (IME) designed for multi-platform such as
Android OS, Apple macOS, Chromium OS, GNU/Linux and Microsoft Windows. This
Expand Down
37 changes: 17 additions & 20 deletions src/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
# MODULE.bazel is the new dependency configuration system (Bzlmod), but not used yet by default.
# To use Bzlmod, you need to specify --enable_bzlmod to the Bazel command or modify .bazelrc.

# abseil-cpp with patches for Bazel 8.0.0 is used instead of the local Abseil in third_party/.
# Otherwise, `bazel fetch` will fail with the error: "cc_configure_extension no longer available".
# References
# * https://github.com/bazelbuild/bazel/issues/24426
# * https://github.com/bazelbuild/bazel-central-registry/pull/3320
bazel_dep(
name = "abseil-cpp",
version = "20240722.0.bcr.2",
repo_name = "com_google_absl",
)
local_path_override(
module_name = "abseil-cpp",
path = "third_party/abseil-cpp",
)

# This is also workaround for the above issue bazel/issues/24426.
# This bazel_dep should be removed after the issue is fixed.
bazel_dep(
name = "re2",
version = "2024-07-02.bcr.1",
)
bazel_dep(
name = "protobuf",
repo_name = "com_google_protobuf",
Expand Down Expand Up @@ -270,28 +278,17 @@ http_archive(
],
)

# Zip code
# Since the URL is shared among multiple versions, we cannot specify the SHA256.
# For offline build (with the --repository_cache flag), SHA256 should be specified.
#
# SHA256 as of 2024-10-08
# SHA256_ZIP_CODE_KEN_ALL = "e5a32c0199ebc890ea5c48c06fd817a168b26d68ce1c3a86ba0ae1cdf6c2d1c4"
SHA256_ZIP_CODE_KEN_ALL = None

# Zip code (2025-01-12)
http_archive(
name = "zip_code_ken_all",
build_file_content = "exports_files([\"KEN_ALL.CSV\"])",
sha256 = SHA256_ZIP_CODE_KEN_ALL,
url = "https://www.post.japanpost.jp/zipcode/dl/kogaki/zip/ken_all.zip",
sha256 = "8736e6a331be40582cfbd86e77c29b6efdbc8425052877e235c8a3c1f7190150",
url = "https://github.com/hiroyuki-komatsu/japanpost_zipcode/raw/refs/heads/main/ken_all.zip",
)

# SHA256 as of 2024-10-08
# SHA256_ZIP_CODE_JIGYOSYO = "5d52511ce6613fcc0c5b24ac59b463e927cff76ac466c2ae07a511a64bb5913f"
SHA256_ZIP_CODE_JIGYOSYO = None

http_archive(
name = "zip_code_jigyosyo",
build_file_content = "exports_files([\"JIGYOSYO.CSV\"])",
sha256 = SHA256_ZIP_CODE_JIGYOSYO,
url = "https://www.post.japanpost.jp/zipcode/dl/jigyosyo/zip/jigyosyo.zip",
sha256 = "0e62af72f56a3039409dc105057051df0e374c2e373a2a068172daaaa1a9af13",
url = "https://github.com/hiroyuki-komatsu/japanpost_zipcode/raw/refs/heads/main/jigyosyo.zip",
)
1 change: 0 additions & 1 deletion src/base/win32/win_sandbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,6 @@ std::wstring Sid::GetName() const {
}

std::wstring Sid::GetAccountName() const {
wchar_t *ptr = nullptr;
DWORD name_size = 0;
DWORD domain_name_size = 0;
SID_NAME_USE name_use;
Expand Down
4 changes: 2 additions & 2 deletions src/build_tools/mozc_win32_resource_template.rc
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@
#endif
#ifndef MOZC_RES_LEGAL_COPYRIGHT
#if defined(GOOGLE_JAPANESE_INPUT_BUILD)
#define MOZC_RES_LEGAL_COPYRIGHT "Copyright 2024 Google LLC. All Rights Reserved."
#define MOZC_RES_LEGAL_COPYRIGHT "Copyright 2025 Google LLC. All Rights Reserved."
#elif defined(MOZC_BUILD)
#define MOZC_RES_LEGAL_COPYRIGHT "Copyright 2024 Google LLC. All Rights Reserved."
#define MOZC_RES_LEGAL_COPYRIGHT "Copyright 2025 Google LLC. All Rights Reserved."
#endif
#endif
#ifndef MOZC_RES_ORIGINAL_FILENAME
Expand Down
2 changes: 1 addition & 1 deletion src/data/installer/credits_en.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<div class="licence">
<h3>Mozc is licensed as follows:</h3>
<pre>
Copyright 2010-2024 Google LLC
Copyright 2010-2025 Google LLC
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
2 changes: 1 addition & 1 deletion src/data/mac/ConfigDialog/English.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Localized versions of Info.plist keys */

CFBundleName = "${CF_BUNDLE_NAME_EN} Preferences";
NSHumanReadableCopyright = "Copyright 2024 Google LLC";
NSHumanReadableCopyright = "Copyright 2025 Google LLC";
2 changes: 1 addition & 1 deletion src/data/mac/ConfigDialog/Japanese.lproj/InfoPlist.strings
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Localized versions of Info.plist keys */

CFBundleName = "${CF_BUNDLE_NAME_JA} 環境設定";
NSHumanReadableCopyright = "Copyright 2024 Google LLC";
NSHumanReadableCopyright = "Copyright 2025 Google LLC";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Localized versions of Info.plist keys */

CFBundleName = "Dictionary Tool";
NSHumanReadableCopyright = "Copyright 2024 Google LLC";
NSHumanReadableCopyright = "Copyright 2025 Google LLC";
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Localized versions of Info.plist keys */

CFBundleName = "辞書ツール";
NSHumanReadableCopyright = "Copyright 2024 Google LLC";
NSHumanReadableCopyright = "Copyright 2025 Google LLC";
3 changes: 3 additions & 0 deletions src/engine/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ mozc_cc_library(
deps = [
"//converter:converter_interface",
"//protocol:engine_builder_cc_proto",
"//protocol:user_dictionary_storage_cc_proto",
"@com_google_absl//absl/status",
"@com_google_absl//absl/strings",
],
Expand Down Expand Up @@ -196,11 +197,13 @@ mozc_cc_library(
"//converter:immutable_converter_interface",
"//converter:immutable_converter_no_factory",
"//data_manager",
"//dictionary:user_dictionary_session_handler",
"//prediction:dictionary_predictor",
"//prediction:predictor",
"//prediction:predictor_interface",
"//prediction:user_history_predictor",
"//protocol:engine_builder_cc_proto",
"//protocol:user_dictionary_storage_cc_proto",
"//rewriter",
"//rewriter:rewriter_interface",
"@com_google_absl//absl/base:core_headers",
Expand Down
8 changes: 8 additions & 0 deletions src/engine/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "converter/immutable_converter.h"
#include "converter/immutable_converter_interface.h"
#include "data_manager/data_manager.h"
#include "dictionary/user_dictionary_session_handler.h"
#include "engine/data_loader.h"
#include "engine/minimal_converter.h"
#include "engine/modules.h"
Expand All @@ -54,6 +55,7 @@
#include "prediction/predictor_interface.h"
#include "prediction/user_history_predictor.h"
#include "protocol/engine_builder.pb.h"
#include "protocol/user_dictionary_storage.pb.h"
#include "rewriter/rewriter.h"
#include "rewriter/rewriter_interface.h"

Expand Down Expand Up @@ -212,4 +214,10 @@ bool Engine::SendSupplementalModelReloadRequest(
return true;
}

bool Engine::EvaluateUserDictionaryCommand(
const user_dictionary::UserDictionaryCommand &command,
user_dictionary::UserDictionaryCommandStatus *status) {
return user_dictionary_session_handler_.Evaluate(command, status);
}

} // namespace mozc
9 changes: 9 additions & 0 deletions src/engine/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
#include "converter/converter.h"
#include "converter/converter_interface.h"
#include "data_manager/data_manager.h"
#include "dictionary/user_dictionary_session_handler.h"
#include "engine/data_loader.h"
#include "engine/engine_interface.h"
#include "engine/minimal_converter.h"
Expand Down Expand Up @@ -131,6 +132,10 @@ class Engine : public EngineInterface {
bool SendSupplementalModelReloadRequest(
const EngineReloadRequest &request) override;

bool EvaluateUserDictionaryCommand(
const user_dictionary::UserDictionaryCommand &command,
user_dictionary::UserDictionaryCommandStatus *status) override;

void SetAlwaysWaitForTesting(bool value) { always_wait_for_testing_ = value; }

private:
Expand All @@ -146,6 +151,10 @@ class Engine : public EngineInterface {
std::unique_ptr<Converter> converter_;
std::unique_ptr<ConverterInterface> minimal_converter_;
std::unique_ptr<DataLoader::Response> loader_response_;
// Do not initialized with Init() because the cost of initialization is
// negligible.
user_dictionary::UserDictionarySessionHandler
user_dictionary_session_handler_;
bool always_wait_for_testing_ = false;
};

Expand Down
8 changes: 8 additions & 0 deletions src/engine/engine_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
#include "absl/strings/string_view.h"
#include "converter/converter_interface.h"
#include "protocol/engine_builder.pb.h"
#include "protocol/user_dictionary_storage.pb.h"

namespace mozc {

Expand Down Expand Up @@ -101,6 +102,13 @@ class EngineInterface {
return false;
}

// Evaluates user dictionary command.
virtual bool EvaluateUserDictionaryCommand(
const user_dictionary::UserDictionaryCommand &command,
user_dictionary::UserDictionaryCommandStatus *status) {
return false;
}

protected:
EngineInterface() = default;
};
Expand Down
2 changes: 1 addition & 1 deletion src/gui/about_dialog/about_dialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
</font>
</property>
<property name="text">
<string>Copyright 2024 Google LLC. All rights reserved.</string>
<string>Copyright 2025 Google LLC. All rights reserved.</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/about_dialog/about_dialog_en.qtts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</message>
<message utf8="true">
<location filename="about_dialog.ui" line="80"/>
<source>Copyright 2024 Google LLC. All rights reserved.</source>
<source>Copyright 2025 Google LLC. All rights reserved.</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
2 changes: 1 addition & 1 deletion src/gui/about_dialog/about_dialog_ja.qtts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</message>
<message utf8="true">
<location filename="about_dialog.ui" line="80"/>
<source>Copyright 2024 Google LLC. All rights reserved.</source>
<source>Copyright 2025 Google LLC. All rights reserved.</source>
<translation type="unfinished"></translation>
</message>
<message>
Expand Down
1 change: 0 additions & 1 deletion src/ipc/win32_ipc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,6 @@ IPCErrorType RecvIpcMessage(HANDLE device_handle, HANDLE read_wait_handle,
return IPC_READ_ERROR;
}
// Actually this is an async operation. Let's wait for its completion.
bool has_more_data = false;
const IPCErrorType result = SafeWaitOverlappedResult(
device_handle, nullptr, absl::ToInt64Milliseconds(timeout), &overlapped,
&num_bytes_read, read_type_ack);
Expand Down
1 change: 0 additions & 1 deletion src/session/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ mozc_cc_library(
"//config:config_handler",
"//converter:converter_interface",
"//data_manager",
"//dictionary:user_dictionary_session_handler",
"//engine",
"//engine:engine_interface",
"//engine:supplemental_model_interface",
Expand Down
1 change: 0 additions & 1 deletion src/session/session.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@
'<(mozc_oss_src_dir)/composer/composer.gyp:composer',
'<(mozc_oss_src_dir)/config/config.gyp:character_form_manager',
'<(mozc_oss_src_dir)/config/config.gyp:config_handler',
'<(mozc_oss_src_dir)/dictionary/dictionary_base.gyp:user_dictionary',
'<(mozc_oss_src_dir)/engine/engine.gyp:engine_factory',
'<(mozc_oss_src_dir)/protocol/protocol.gyp:commands_proto',
'<(mozc_oss_src_dir)/protocol/protocol.gyp:config_proto',
Expand Down
15 changes: 6 additions & 9 deletions src/session/session_handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
#include "composer/table.h"
#include "config/character_form_manager.h"
#include "config/config_handler.h"
#include "dictionary/user_dictionary_session_handler.h"
#include "engine/engine_interface.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
Expand Down Expand Up @@ -138,8 +137,6 @@ SessionHandler::SessionHandler(std::unique_ptr<EngineInterface> engine)
last_cleanup_time_ = absl::InfinitePast();
last_create_session_time_ = absl::InfinitePast();
observer_handler_ = std::make_unique<session::SessionObserverHandler>();
user_dictionary_session_handler_ =
std::make_unique<user_dictionary::UserDictionarySessionHandler>();
table_manager_ = std::make_unique<composer::TableManager>();
request_ = std::make_unique<commands::Request>();
config_ = config::ConfigHandler::GetConfig();
Expand Down Expand Up @@ -643,13 +640,13 @@ bool SessionHandler::SendUserDictionaryCommand(commands::Command *command) {
return false;
}
user_dictionary::UserDictionaryCommandStatus status;
const bool result = user_dictionary_session_handler_->Evaluate(
command->input().user_dictionary_command(), &status);
if (result) {
status.Swap(
command->mutable_output()->mutable_user_dictionary_command_status());
if (!engine_->EvaluateUserDictionaryCommand(
command->input().user_dictionary_command(), &status)) {
return false;
}
return result;
*command->mutable_output()->mutable_user_dictionary_command_status() =
std::move(status);
return true;
}

bool SessionHandler::SendEngineReloadRequest(commands::Command *command) {
Expand Down
3 changes: 0 additions & 3 deletions src/session/session_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
#include "absl/strings/string_view.h"
#include "absl/time/time.h"
#include "composer/table.h"
#include "dictionary/user_dictionary_session_handler.h"
#include "engine/engine_interface.h"
#include "protocol/commands.pb.h"
#include "protocol/config.pb.h"
Expand Down Expand Up @@ -148,8 +147,6 @@ class SessionHandler : public SessionHandlerInterface {

std::unique_ptr<EngineInterface> engine_;
std::unique_ptr<session::SessionObserverHandler> observer_handler_;
std::unique_ptr<user_dictionary::UserDictionarySessionHandler>
user_dictionary_session_handler_;
std::unique_ptr<composer::TableManager> table_manager_;
std::unique_ptr<const commands::Request> request_;
std::unique_ptr<const config::Config> config_;
Expand Down

0 comments on commit 3214ae6

Please sign in to comment.