4511 Commits

Author SHA1 Message Date
10f91ef751 Remove unused visibility specs
Tested:
    Local presubmit tests passed.
PiperOrigin-RevId: 720903995
2025-01-29 11:24:15 +00:00
b39050e6b3 - Moved SessionConverter from session/ to engine/
- Get rid of the dependency from engine/ to session/
- Cleanup visibility.

PiperOrigin-RevId: 720468982
2025-01-28 08:50:29 +00:00
8e4d09d2ab Refactoring of CollocationRewriter with modern C++.
* use `constexpr`, `string_view` and `std::vector`.
* remove an unused flag.

#codehealth

PiperOrigin-RevId: 720044957
2025-01-27 07:49:03 +00:00
bd8f5e51dc Add individual define for each rewriters to check whether or not to add them
* The behaviors should not be changed.

#codehealth

PiperOrigin-RevId: 719955368
2025-01-27 00:05:23 +00:00
a0352ea247 Simplify unnecessary conditional execution in DateRewriter::Rewrite.
#codehealth

PiperOrigin-RevId: 719152065
2025-01-24 06:19:31 +00:00
662b9b5c4a Remove --build_tests_only from the bazel test command in CI.
* this will check the build rules more strictly.

#codehealth

PiperOrigin-RevId: 719145071
2025-01-24 05:52:40 +00:00
867654283e Add target_compatible_with to a subrule in mozc_win32_cc_prod_binary.
* follow-up to cl/717739005
* fix the failure of `bazelisk test ...` in non-Windows platforms

#codehealth

PiperOrigin-RevId: 719144481
2025-01-24 05:49:49 +00:00
7ea64deb31 Set /DEPENDENTLOADFLAG in Bazel Windows build (#1166)
This mirrors my previous commit [1] for Windows GYP build so that Bazel
build can also specify appropriate /DEPENDENTLOADFLAG options (#836).

Closes #1114.

 [1]: 18d1bcaab4

PiperOrigin-RevId: 719096319
2025-01-24 14:01:16 +09:00
50357d46b7 Add key_len() as a pre-calculated length of key() in Unicode character.
PiperOrigin-RevId: 719078472
2025-01-24 01:39:15 +00:00
dd56d86b05 Include absl/strings/str_cat.h in addition to the debug build.
* Follow-up to cl/718660749
* Will fix build errors with the release build

#codehealth

PiperOrigin-RevId: 718704810
2025-01-23 06:07:48 +00:00
6622e39963 Move the segment operation functions to Segments.
* ResizeSegments in converter.cc
* PrepenedCandidates in session_converter.cc

PiperOrigin-RevId: 718660749
2025-01-23 03:09:51 +00:00
e52c003469 Move segments preparation functions to Segments.
#codehealth

PiperOrigin-RevId: 718236759
2025-01-22 07:26:42 +00:00
be17aff5c9 Add "部首" (radical) to candidate descriptions (#1165)
PiperOrigin-RevId: 718231460
2025-01-22 22:38:51 +09:00
83fd3078dd Specify /CETCOMPAT in Bazel Windows build (#1164)
Win32 x64/x86 executables built with GYP are already declared to be
Intel CET compatible (#835).

With this commit those executables built with Bazel also become Intel
CET compatible.

Closes #1111 

PiperOrigin-RevId: 718229248
2025-01-22 22:37:05 +09:00
9a1449b117 Replace += with .append in build_defs.bzl
As the lint tool suggested so.

#codehealth

PiperOrigin-RevId: 717763403
2025-01-21 07:39:50 +00:00
6e76b54020 Add module with the project name in MODULE.bazel
#codehealth

PiperOrigin-RevId: 717763382
2025-01-21 07:39:45 +00:00
51b4cd065d Generate PDB file from mozc_win32_cc_prod_binary (#1109)
While 'rules_cc' provides 'generate_pdb_file' feature to generate the
PDB file, its filename is not hard-coded and not configurable. For
instance, if the target name is 'mozc_tip32', then the output pdb file
is always assumed to be 'mozc_tip32.pdb'. To make it
'mozc_tip32.dll.pdb', the target name must be 'mozc_tip32.dll.dll'.

This is why 'intermediate_name' is introduced in
'mozc_win32_cc_prod_binary'.

There must be no observable change in GYP build and non-Windows bazel
builds.

Closes #1108.

PiperOrigin-RevId: 717739005
2025-01-21 15:38:54 +09:00
b8786636c9 Register CC toolchain from rules_cc (#1163)
This reworks my previous PR #1156 [1], which was to make Windows bazel
build compatible with

  --noincompatible_enable_cc_toolchain_resolution

option (#1102) (#1112).

The difference from the previous approach is that this commit uses
CC toolchains defined by 'rules_cc' rather than the ones implicitly
defined by the Bazel itself.

Given that 'rules_cc' becomes the new home of CC-related rules and
configurations, hopefully this change will reduce the likelihood of
future troubles.

There must be no observable behavior change in the final artifacts.

 [1]: 4aad25e97d

PiperOrigin-RevId: 717738755
2025-01-21 15:38:06 +09:00
cd7d25c440 Inline mozc_win_build_target in build_defs.bzl (#1160)
This follows up to our previous commit [1], which intended to be a
preparation to merge #1109 to address #1108.

As another preparation this commit aims to simplify 'build_defs.bzl' by
inlining 'mozc_win_build_target' into 'mozc_win32_cc_prod_binary'.

There must be no change in the final artifacts.

 [1]: bc546b239b

PiperOrigin-RevId: 717365663
2025-01-20 14:39:13 +09:00
e772004b4c Simplify NDK setup in Dockerfile (#1162)
This commit aims to simplify how Android NDK is set up in Dockerfile
without changing any final artifact.

With this commit Android NDK will be directly downloaded then deployed
just by unzipping the archive. As a result we no longer need to install
openjdk-17-jdk package just to run Android SDK setup.

This commit also makes it clear that the build environment for Android
requires Android NDK only. Android SDK and ANDROID_HOME environment
variable are not necessary.

There must be no difference in the final artifact.

PiperOrigin-RevId: 717365459
2025-01-20 14:38:43 +09:00
58ebfadae0 Update BUILD_OSS to 5712
2.30.5618 → 2.31.5712

Conversion
* Updated the LM dictionary
* Updated symbols (#1074, #1100)
* Updated emoji data to CLDR 46 (Emoji 16.0)
* Fixed conversion errors reported by users.

Bug fix
* Windows: fixed the freeze issue with some applications like the searchhost.exe (#1077, #856)
* Windows: fixed the UI language issue of the GUI tools (#1110)

Features
* Updated the copyright year to 2025.
* Windows: bundle debug symbol for Mozc TIP DLL (#1081)
* Windows: shutdown existing Mozc processes on upgrading the version (#1093)

Build
* supported Bazel 8.0.0 (#1118)
* removed WORKSPACE support for Bazel (#1115)
* supported Python 3.14 (#1084)
* updated the protobuf version: v27.3 → v29.1.
* Linux: supported gcc-14.1.1 without additional build flags (#927)
* macOS / Windows: Updated Qt version: 6.7.3 → 6.8.0 (#1105, #1110, #1121)

Code
* added a lint checker for BUILD.bazel and *bzl files (#1089)
* renamed the protobuf field from Candidates to CandidateWindow
* refactoring of ConversionRequest making it as immutable object
* refactoring of the Converter implementation
* refactoring of Engine and SessionConverter to make each module pluggable
* removed cyclic dependency between Converter and Rewriter.

PiperOrigin-RevId: 716215275
2025-01-16 14:42:53 +00:00
8d704f0f82 Use bazelisk instead of bazel.
* .bazeliskrc is used instead of USE_BAZEL_VERSION.
* Remove the .bazelversion file.

#codehealth

PiperOrigin-RevId: 716213424
2025-01-16 14:35:53 +00:00
016c7385c6 Clear candidate words when the composition was cleared by backspace / delete / escape.
In this code path, SessionConverter::Suggest() is not called, and session converter's internal state including candidate list was not updated.

PiperOrigin-RevId: 716097305
2025-01-16 07:10:10 +00:00
abbb2399d1 Create .bazeliskrc to set "USE_BAZEL_VERSION=8.0.0"
PiperOrigin-RevId: 716065333
2025-01-16 04:55:57 +00:00
5f08937029 Update MODULE.bazel to workaround the issue for Bazel 8.0.0.
#codehealth

PiperOrigin-RevId: 715841834
2025-01-15 18:03:38 +00:00
280c06e2dd Fix some windows-specific diagnostics.
The Windows toolchain has `-Wunused-variable` and `-Wunused-result` disabled. Clean up code that triggers these, in preparation for enabling them, as they are already enabled on other platforms.

PiperOrigin-RevId: 715679816
2025-01-15 08:18:40 +00:00
0f478e8cb1 Do not initilize UserDictionarySessionHandler in Init()
because the cost of initialization is negligible and
there is a client that access UserDictionarySessionHandler without calling Init().

PiperOrigin-RevId: 715634005
2025-01-15 04:55:18 +00:00
41b586083e Update the URLs of zip code data.
Since the original download page reuses the same URLs without version control, sha256 entries could not be unique.

#codehealth

PiperOrigin-RevId: 715250673
2025-01-14 07:23:48 +00:00
ee85d4ad52 Update copyright years from 2024 to 2025.
PiperOrigin-RevId: 715203471
2025-01-14 03:51:20 +00:00
ab2ba16500 Moved UserDictionarySessionHandler from SessionHandler to Engine/EngineInterface
SessionHandler and Session should not own concrete logic (e.g., predictor/rewriter/converter/dictionary) but depend only on the pure interface methods of EngineInterface and SessionConverterInterface.

PiperOrigin-RevId: 713974280
2025-01-10 10:31:54 +00:00
6a64efa8e3 Gracefully handle empty output from vswhere.exe (#1159)
This is a follow up commit to my previous commit [1], which started
using 'vswhere.exe' to locate 'vcvarsall.bat' as discussed in #1057.

One thing I overlooked is that 'vswhere.exe' could return an empty
result even when the exitcode is ERROR_SUCCESS. With this commit such a
case will be gracefully handled.

This is also a preparation to support ARM64 build on Windows (#1130).

 [1]: ace3145671

PiperOrigin-RevId: 713563231
2025-01-09 17:45:01 +09:00
c4cbd4cb83 Small code refactoring
* Removed an unused declaration.
* Swapped the argument order of DCHECK_EQ

#codehealth

PiperOrigin-RevId: 713512608
2025-01-09 04:24:08 +00:00
45e696072a Remove unused variable and function from SessionConverter.
* cl/699938273 removed the caller of kDefaultMaxHistorySize.
* cl/699944808 removed the caller of CreateIncognitoConversionRequest.

#codehealth

PiperOrigin-RevId: 713210877
2025-01-08 10:11:07 +00:00
aa4bb69421 Avoid using unnecessary mutable_conversion_segment.
* Use `conversion_segment` instead.

#codehealth

PiperOrigin-RevId: 713193266
2025-01-08 09:01:23 +00:00
d6302fcaec Removed unused method: GetPredictorName. This method is not used in production code.
PiperOrigin-RevId: 713187705
2025-01-08 08:38:23 +00:00
4aad25e97d Rely on CC toolchain resolution on Windows (#1156)
This is a follow up commit to my previous commit [1], which updated the
Bazel version from 7.4.1 to 8.0.0 (#1118).

It turns out that

  --noincompatible_enable_cc_toolchain_resolution

is now no-op in Bazel 8.0. Thus we have no other choice than fully
migrating to the new CC toolchain resolution as planned in #1112.
Otherwise 'mozc_tip32.dll' will be built as a 64-bit executable (#1102).

This commit consists of two parts:

 1. explicitly register CC toolchains in '.bazelrc'.
 2. Switch from '--cpu' commandline option to '--platforms' commandline
    option in '_win_executable_transition'.

With above 'mozc_tip32.dll' will be built as a 32-bit executable again.

Closes #1102.
Closes #1112.

 [1]: 6dadef1c3d

PiperOrigin-RevId: 713127750
2025-01-08 13:10:00 +09:00
5b7a3334e7 Remove Converter argument from the Rewriter constructor.
It is no longer used.

#codehealth

PiperOrigin-RevId: 712810236
2025-01-07 09:06:03 +00:00
9e51d337bb Implement CheckResizeSegmentsRequest for UserBoundaryHistoryRewriter.
PiperOrigin-RevId: 712809555
2025-01-07 09:03:44 +00:00
a08015651e Implement CheckResizeSegmentsRequest for SmallLetterRewriter.
#codehealth

PiperOrigin-RevId: 712808009
2025-01-07 08:58:11 +00:00
91729ed54e Implement CheckResizeSegmentsRequest for UnicodeRewriter.
PiperOrigin-RevId: 712807064
2025-01-07 08:54:01 +00:00
17e5145caf Implement CheckResizeSegmentsRequest for SymbolRewriter.
PiperOrigin-RevId: 712806483
2025-01-07 08:52:01 +00:00
5e12dded3f Apply the Python formatter to vs_util.py
#codehealth

PiperOrigin-RevId: 712785958
2025-01-07 07:27:09 +00:00
c93519036c Add the explicit dependency of commands_proto on engine.
PiperOrigin-RevId: 712742471
2025-01-07 04:09:48 +00:00
03ab962e8e Rename candidates to candidate-window.
* The protobuf name was renamed from Candidates to CandidateWindow.
* https://github.com/google/mozc/discussions/1158

PiperOrigin-RevId: 712721899
2025-01-07 02:46:48 +00:00
c66515902e Make code forward-compatible with returning string_view in protobuf descriptor API.
An upcoming change in Protobuf will change the return types of various
methods like `Descriptor::name()` and `Message::GetTypeName()` from
`const std::string&` or `std::string` to `absl::string_view`. This CL fixes
users of those methods to work both before and after the change.

PiperOrigin-RevId: 712709155
2025-01-07 01:58:07 +00:00
86e5da1af9 Implement CheckResizeSegmentsReqeust for DateRewriter.
PiperOrigin-RevId: 711346356
2025-01-02 09:10:17 +00:00
ad0e97b8b8 Removed MimimalEngine and introduced MinimalConverter. (#1155)
Removed the dependency to MinimalEngine from gyp(engine/engine.gyp).

PiperOrigin-RevId: 710266536
2024-12-28 23:14:12 +09:00
c0689c4927 Fix typos in the comments of .bazelversion.
#codehealth

PiperOrigin-RevId: 709793417
2024-12-26 14:40:58 +00:00
6dadef1c3d Switch to Bazel 8.0.0 (#1154)
With this commit we fully switch to Bazel 8.0.0 as the officially
supported build environment for Mozc.

Closes #1118.

PiperOrigin-RevId: 709793147
2024-12-27 00:18:51 +09:00
f3f2929eba Removed MimimalEngine and introduced MinimalConverter. We've already removed the dependency to MinimalEngine.
PiperOrigin-RevId: 709514761
2024-12-25 09:29:43 +00:00