4511 Commits

Author SHA1 Message Date
29c35813b0 Propagate linkshared as appropriate (#1153)
This follows up to our previous commit [1], which was a preparation to
address the symbol name mismatch in Mozc's TIP DLLs (#1108) but
accidentally removed 'linkshared' from them.

While a subsequent commit [2] addressed the immediate issue by passing
'static_crt' to 'linkshared', strictly speaking they are two orthogonal
concepts. Let's decouple them to avoid future confusions.

There must be no immediate change in the final artifacts with this
commit right now.

 [1]: bc546b239b
 [2]: 8d20ea6328

PiperOrigin-RevId: 709332940
2024-12-26 20:04:42 +09:00
528099a46a Removed Create*EngineHelper. This is just syntax sugar. We would like to minimize the types of instantiation methods.
PiperOrigin-RevId: 709281313
2024-12-24 09:52:47 +00:00
3cb22a7fdc Remove DataManagerInterface because it is introduced only for testing (mock), not polymorphism.
PiperOrigin-RevId: 709273265
2024-12-24 09:11:01 +00:00
990c417cd4 Patch rules_android_ndk to add allow_empty (#1152)
There was an attempt to make 'rules_android_ndk' compatible with
'--incompatible_disallow_empty_glob' [1], but it seems that it was not
complete.

To unblock Mozc to enable '--incompatible_disallow_empty_glob' (#1150),
let's work around this in the Mozc side for now.

There must be no behavior change in the final artifacts.

  [1]: https://github.com/bazelbuild/rules_android_ndk/pull/37

PiperOrigin-RevId: 709015396
2024-12-24 16:21:56 +09:00
81d9aa7ad8 Fix misused glob in BUILD.qt_win.bazel (#1151)
This follows up to my previous commit [1], which aimed to enable us to
use Bazel to build executables with Qt6 dependencies.

Thanks to '--incompatible_disallow_empty_glob', which is going to be
enabled by default from Bazel 8.0, it is clear that an empty list was
set to 'hdrs' despite my intention. Let's fix it (#1150).

There must be no change in the final artifacts.

 [1]: 019911b19d

PiperOrigin-RevId: 709014821
2024-12-24 16:20:59 +09:00
99e45d3604 Remove the dependency to MinimalEngine. The default Engine has the instance of MinimalEngine. Creating MinimalEngine is equivalent to the Engine with no argument.
PiperOrigin-RevId: 708896804
2024-12-23 01:10:04 +00:00
b7faa84f2f bzlmod: Update rules_python to 1.0.0 (#1149)
This is just a mechanical update of rules_python from 0.34.0 to 1.0.0.
No change is expected in the final artifacts.

Closes #1148.

PiperOrigin-RevId: 708197475
2024-12-20 16:31:58 +09:00
deb48c89a1 Deprecated install_path. install_path is no longer used after MDD.
PiperOrigin-RevId: 707856864
2024-12-19 11:46:37 +00:00
6b2694ed30 Add visibility and features to mozc_win_build_target.
* Support pdb file generation.

#codehealth

PiperOrigin-RevId: 707779301
2024-12-19 06:04:08 +00:00
8d20ea6328 Fix build error on Windows.
* Follow-up to cl/704201709 and PR#1109.
* https://github.com/google/mozc/pull/1109

#codehealth

PiperOrigin-RevId: 707448701
2024-12-18 09:33:27 +00:00
4c7f0482f7 Add bazel 8 support to pkg_config_repository() (#1118) (#1144)
bazel 8 set --incompatible_disallow_empty_glob default to True. For
pkg-confg repository, libexec is likely to be empty, so empty should be
allowed there.

PiperOrigin-RevId: 707430069
2024-12-18 17:29:28 +09:00
269f7f4275 bzlmod: Update rules_apple to 3.16.1 (#1146)
This follows up to our previous commit [1], which downgraded rules_apple
from 3.8.0 to 3.5.1 to work around a regression [2], which was fixed in
3.9.0 and later [3].

Now that Bazel 8.0 RC3+ requires rules_apple 3.16.0 and later [4], let's
update it to the latest one, which is 3.16.1 [5].

No difference is expected in the final artifacts.

Closes #1145.

 [1]: c1e9f8b19a
 [2]: https://github.com/bazelbuild/rules_apple/issues/2516
 [3]: https://github.com/bazelbuild/rules_apple/releases/tag/3.9.0
 [4]: https://github.com/bazelbuild/rules_apple/releases/tag/3.16.0
 [5]: https://github.com/bazelbuild/rules_apple/releases/tag/3.16.1

PiperOrigin-RevId: 707429306
2024-12-18 17:28:55 +09:00
399f5d10f8 Remove rules_java from MODULE.bazel (#1141)
This follows up to our previous commit [1], which introduced the
dependency on 'rules_java' as an attempt to support Android build with
bzlmod (#1002).

Luckily a subsequent commit [2] had effectively removed the the
dependency on 'rules_java', but 'MODULE.bazel' had not been reflected.
Let's also update 'MODULE.bazel' for simplicity and maintainability.

There must be no difference in the final artifacts.

 [1]: 699c2ce5b7
 [2]: 6c61c4f29a

PiperOrigin-RevId: 707118402
2024-12-18 01:55:11 +09:00
ad4277994f Exclude "lazy_repeated_field*.cc" in protobuf.gyp
* This is necessary to update the protobuf version to v29.1

PiperOrigin-RevId: 707061780
2024-12-17 13:52:26 +00:00
9761c65815 Use CheckResizeSegmentsRequest for CalculatorRewriter.
This CL stops using `parent_converter` in `ConverterInterface::ResizeSegment`.

#codehealth

PiperOrigin-RevId: 706981284
2024-12-17 08:17:26 +00:00
86cf31d9c9 Call RewriteRule::CheckResizeSegmentsRequest before RewriteRule::Rewrite.
The implementation will be simplified when all rewriters migrate to the new resize procesure.

* Also added unit tests.

PiperOrigin-RevId: 706980864
2024-12-17 08:15:38 +00:00
5954c4b022 Add the CheckResizeSegmentsRequest method to RewriterInterface.
Rewriters will stop calling Converter::ResizeSegments directly, but returns the request to the converter via CheckResizeSegmentsRequest.

* This will remove cyclic dependency between Converter and Rewriter.
* Actual changes to rewriters will be done in the following CLs (e.g. cl/704192521).

PiperOrigin-RevId: 706980207
2024-12-17 08:12:45 +00:00
e98284eceb Refactoring, cleaning up, and improving performance on main LM loading
- Moves the core data loading loop from engine to data loader. This reduces the number of public APIs and simplifies the algorithm of data_loader.
- Removes the method that returns the moved object (MaybeMoveDataLoaderResponse), as it is confusing. We've introduced a callback to pass the ownership from data loader to engine more safely.
- Avoid loading multiple and unused LMs requested sequentially in a short period. We can improve the performance of data loading.

PiperOrigin-RevId: 706573104
2024-12-16 05:57:29 +00:00
63267d7408 Unify the implementation of ResizeSegment and ResizeSegments.
#codehealth

PiperOrigin-RevId: 706354368
2024-12-15 06:19:26 +00:00
e706d94702 Refactoring on the engine and converter to manage the lifetime.
- Avoid passing pointers after std::move()
- Moves the ownership of predictor, rewriter and immutable_converter to pointer
- Passes the factory function object to Converter so that we can generate any predictor/rewrite while keeping the Converter's ownership.

PiperOrigin-RevId: 705022641
2024-12-11 09:56:28 +00:00
b12f229db8 Modify ConverterToTransliteration to set the right offset length to ResizeSegmentWidth.
* This is a preparation for the unification of ResizeSegment and ResizeSegments in Converter. (e.g. cl/702707766).

#codehealth

PiperOrigin-RevId: 704959457
2024-12-11 05:29:23 +00:00
3688ce621c Change the SegmentType of unconsumed Segment from FIXE_BOUNDARY to FREE.
* This makes consistency b/w ResizeSegment and ResizeSegments.
* This changes the behavior, but it's not user visible.
  + Because UserBoundaryHistoryRewriter is the only client of this function,
    and it does not have unconsumed Segments.

PiperOrigin-RevId: 704528072
2024-12-10 04:45:21 +00:00
18b9c30768 Update dictionaries
PiperOrigin-RevId: 704498785
2024-12-10 02:44:33 +00:00
43d6a96248 Update third_party/protobuf to v29.1
Close #1140
2024-12-17 10:56:24 +00:00
bc546b239b Update a part of PR#1109 as a preparation to merge that PR.
* https://github.com/google/mozc/pull/1109

This change is a preparation to merge PR#1109.
The difference from PR#1109 is the implementation of `mozc_win32_cc_prod_binary` and `mozc_cc_win32_library`.

* mozc_win32_cc_prod_binary: In this change, this is a wrapper of `mozc_win_build_target` migrated from `trasition.bzl` to `build_defs.bzl`.
* mozc_cc_win32_library: In this change, nothing is changed.

PiperOrigin-RevId: 704201709
2024-12-09 10:25:27 +00:00
bc3c4136b3 Remove the segments_size param of ConverterInterface::ResizeSegment().
* Also renamed one of overloaded ResizeSegment functions to ResizeSegments.

#codehealth

PiperOrigin-RevId: 704137708
2024-12-09 05:24:07 +00:00
8354f11f28 Calculate the segments_size from new_size_array and segments.
* Renamed segments_size to unused_segments_size that will be removed in the next change.

#codehealth

PiperOrigin-RevId: 704136858
2024-12-09 05:19:32 +00:00
f6791ccdf9 Add tests for Converter::ResizeSegment.
There are two overloaded functions of Converter::ResizeSegment.
This is a preparation to unify the implementations of those functions.

#codehealth

PiperOrigin-RevId: 704136470
2024-12-09 05:17:00 +00:00
e983ab86bb Simplify ninja env file logic in build_mozc.py (#1134)
As a preparation to build Mozc for ARM64 in Windows (#1130), this commit
aims to simplify UpdateEnvironmentFilesForWindows in build_mozc.py so
that we can tweak environment file for ARM64 build configurations in a
subsequent commit easily.

This is still a mechanical code clean up. There must be no difference
in the final artifacts.

PiperOrigin-RevId: 703739072
2024-12-07 17:24:09 +09:00
0960a755bb Remove platform macros from tip_text_service.cc (#1132)
This commit removes the dependency on platform macros such as _M_X64 and
_M_IX86 from tip_text_service.cc.

There must be no change in the final artifacts.

This is a preparation to build Mozc for ARM64 (#1130).

PiperOrigin-RevId: 703735488
2024-12-07 17:23:08 +09:00
6deb280647 Remove dependency of SupplementalModel from EngineInterface.
Changes the owner of supplemental model from SessionHandler to Engine.
Remove spellchecker operations as it is no longer used.

PiperOrigin-RevId: 703360331
2024-12-06 05:42:49 +00:00
62fe473627 Remove UserDataManger and moves the methods to EngineInterface.
Remove SetDataLoaderForTesting and SetAlwaysWaitForLoaderResponseFutureForTesting from EngineInterface.

PiperOrigin-RevId: 703336103
2024-12-06 03:52:00 +00:00
dc30d0ab11 Remove the dependency of Module and DataManager from EngineInterface.
PiperOrigin-RevId: 703011974
2024-12-05 08:39:31 +00:00
261a835677 Remove the dependency of SuppressionDictionary from EngineInterface.
Remove predictor from minimal_engine.

PiperOrigin-RevId: 703009610
2024-12-05 08:29:22 +00:00
31a9cd41bc uses Engine instead of EngineInterface so we can minimize the API of EngineInterface.
We would like to get rid of dependency to current converter logics/models from EngineInterface.

PiperOrigin-RevId: 703005027
2024-12-05 08:09:38 +00:00
06cd789290 Set composer key before initializing ConversionRequest
PiperOrigin-RevId: 702996887
2024-12-05 07:32:34 +00:00
014dacd40e use absl::string_view or absl::Span in data_manager to avoid using raw pointers.
PiperOrigin-RevId: 702974511
2024-12-05 05:47:09 +00:00
b2473cc521 Simplify the logic of MergerRewriter::Rewrite.
#codehealth

PiperOrigin-RevId: 702948819
2024-12-05 03:48:09 +00:00
8e7a3076bf Simplify ProgramFilesX86Cache (#1131)
The current implementation of

  ProgramFilesX86Cache::TryProgramFilesPath

is unnecessarily complex. We can always use CSIDL_PROGRAM_FILESX86 not
only within 64-bit processes but also within 32-bit processes.

There must be no observable behavior change in this commit.

This is a preparation to build Mozc as an ARM64 executable (#1130).

See #1086 for how and when we can stop relying on this historical
installation location.

PiperOrigin-RevId: 702632385
2024-12-04 20:17:39 +09:00
12c86d85ec Clarify '/CETCOMPAT' is only for x86/x64 (#1133)
This follows up to my previous commit [1] for #835.

This option (/CETCOMPAT) is not compatible with ARM64 builds.

As a preparation to build Mozc executables for ARM64 (#1130) let's
specify it in 'x86_Base' and 'x64_Base' instead of globally defining it.

There must be no change in the final artifacts.

 [1]: a0133fb078

PiperOrigin-RevId: 702630613
2024-12-04 20:17:02 +09:00
73836cf2c6 Remove unused methods depending on Segment::Candidate.
We can make SessionConverterInterface be independent from Segments.

PiperOrigin-RevId: 702603198
2024-12-04 07:38:36 +00:00
18561225ae Update some logics to optimize the behavior of UserBoundaryHistoryRewriter.
* Skip checked segments if they already have expected boundaries.
* Make Insert returns true if succeed.

#codehealth

PiperOrigin-RevId: 702588071
2024-12-04 06:22:19 +00:00
6dec24c328 Apply some code refactoring to UserBoundaryHistoryRewriter.
#codehealth

PiperOrigin-RevId: 702587754
2024-12-04 06:20:36 +00:00
ac9397740b Introduce SegmentsKey to manage key and length_array.
#codehealth

PiperOrigin-RevId: 702587279
2024-12-04 06:18:46 +00:00
6dd8459de4 Use seg_size instead of j + 1.
This is a preparation for the following refactoring.

#codehealth

PiperOrigin-RevId: 702556411
2024-12-04 03:51:43 +00:00
c98ba0441d Use conversion_segments instead of history_segments in UserBoundaryHistoryRewriter.
#### Note for removal of `i += (j + target_segments_size - old_segments_size)` in Resize():

> target_segments_size and old_segments_size store the same value since cl/8867845 (2012-02). As `parent_converter_->ResizeSegment` should update `j + 1` segments, proceeding `j` here (and +1 in the main loop) should be fine here.

### Note for target_segments_size

* Before this change, `target_segments_size` (in Resize) was `segments_size()` that is  `history_segments_size() + conversion_segments_size()`.
* With this change, `target_segments_size` (in Resize) will be `conversion_segments_size()` that is `segments_size() - history_segments_size()`.

* Before this change, indexes of segments (i.e. `i`) started from history_segments_size. So `- history_segments_size` was applied to each operation.
* With this change, indexes of segments (i.e. `i` and `seg_idx`) start from 0. To access segments, `conversion_segment(i)` is used instead of `segment(i)`.

#codehealth

PiperOrigin-RevId: 702537901
2024-12-04 02:31:20 +00:00
0a37aea4fc Use std::array instead of uint8_t[8] in LengthArray.
#codehealth

PiperOrigin-RevId: 702206576
2024-12-03 06:47:13 +00:00
1c13571d3d Use UserBoundaryHistoryRewriter.storage_ as a value instead of unique_ptr.
* This clarifies UserBoundaryHistoryRewriter::Insert changes the internal state.

#codehealth

PiperOrigin-RevId: 702206136
2024-12-03 06:45:01 +00:00
b7af55a10a Pass Segments by reference instead of pointer.
* It follows the latest coding style.

PiperOrigin-RevId: 702205722
2024-12-03 06:43:02 +00:00
91b538afba Split UserBoundaryHistoryRewriter::ResizeOrInsert to Resize and Insert.
* The optimization to the new functions will be performed in the following CLs.

#codehealth

PiperOrigin-RevId: 702200066
2024-12-03 06:18:35 +00:00