diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index e851407fd..eec7010f5 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -13,8 +13,8 @@ concurrency: jobs: build: - # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md - runs-on: ubuntu-22.04 + # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md + runs-on: ubuntu-24.04 timeout-minutes: 60 steps: diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml index 7029da5ca..13d001b4d 100644 --- a/.github/workflows/linux.yaml +++ b/.github/workflows/linux.yaml @@ -13,8 +13,8 @@ concurrency: jobs: build: - # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md - runs-on: ubuntu-22.04 + # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md + runs-on: ubuntu-24.04 timeout-minutes: 60 steps: @@ -30,9 +30,6 @@ jobs: # # Unset the Android NDK setting to skip the unnecessary configuration. echo "ANDROID_NDK_HOME=" >> $GITHUB_ENV - # - # Work around https://bugreports.qt.io/browse/QTBUG-86080 for Ubuntu 22.04 - echo "PKG_CONFIG_PATH=${PWD}/docker/ubuntu22.04/qt6-core-pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV - name: bazel build working-directory: ./src @@ -47,8 +44,8 @@ jobs: if-no-files-found: warn test: - # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2204-Readme.md - runs-on: ubuntu-22.04 + # https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md + runs-on: ubuntu-24.04 timeout-minutes: 60 steps: @@ -64,9 +61,6 @@ jobs: # # Unset the Android NDK setting to skip the unnecessary configuration. echo "ANDROID_NDK_HOME=" >> $GITHUB_ENV - # - # Work around https://bugreports.qt.io/browse/QTBUG-86080 for Ubuntu 22.04 - echo "PKG_CONFIG_PATH=${PWD}/docker/ubuntu22.04/qt6-core-pkgconfig:${PKG_CONFIG_PATH}" >> $GITHUB_ENV - name: bazel test working-directory: ./src diff --git a/docs/build_mozc_in_docker.md b/docs/build_mozc_in_docker.md index a4106d1ef..c82af6f8c 100644 --- a/docs/build_mozc_in_docker.md +++ b/docs/build_mozc_in_docker.md @@ -9,9 +9,9 @@ If you are not sure what the following commands do, please check the description and make sure the operations before running them. ``` -curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu22.04/Dockerfile -docker build --rm --tag mozc_ubuntu22.04 . -docker create --interactive --tty --name mozc_build mozc_ubuntu22.04 +curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile +docker build --rm --tag mozc_ubuntu24.04 . +docker create --interactive --tty --name mozc_build mozc_ubuntu24.04 docker start mozc_build docker exec mozc_build bazel build package --config oss_linux --config release_build @@ -22,24 +22,24 @@ docker cp mozc_build:/home/mozc_builder/work/mozc/src/bazel-bin/unix/mozc.zip . Docker containers are available to build Mozc binaries for Android JNI library and Linux desktop. ## System Requirements -Currently, only Ubuntu 22.04 is tested to host the Docker container to build Mozc. +Currently, only Ubuntu 24.04 is tested to host the Docker container to build Mozc. -* [Dockerfile](https://github.com/google/mozc/blob/master/docker/ubuntu22.04/Dockerfile) for Ubuntu 22.04 +* [Dockerfile](https://github.com/google/mozc/blob/master/docker/ubuntu24.04/Dockerfile) for Ubuntu 24.04 ## Build in Docker -### Set up Ubuntu 22.04 Docker container +### Set up Ubuntu 24.04 Docker container ``` -curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu22.04/Dockerfile -docker build --rm --tag mozc_ubuntu22.04 . -docker create --interactive --tty --name mozc_build mozc_ubuntu22.04 +curl -O https://raw.githubusercontent.com/google/mozc/master/docker/ubuntu24.04/Dockerfile +docker build --rm --tag mozc_ubuntu24.04 . +docker create --interactive --tty --name mozc_build mozc_ubuntu24.04 ``` You may need to execute `docker` with `sudo` (e.g. `sudo docker build ...`). Notes -* `mozc_ubuntu22.04` is a Docker image name (customizable). +* `mozc_ubuntu24.04` is a Docker image name (customizable). * `mozc_build` is a Docker container name (customizable). * Don't forget to rebuild Docker container when Dockerfile is updated. @@ -148,7 +148,7 @@ Note: This section is not about our officially supported build process. You may also need other libraries. See the configurations of -[Dockerfile](https://github.com/google/mozc/blob/master/docker/ubuntu22.04/Dockerfile) +[Dockerfile](https://github.com/google/mozc/blob/master/docker/ubuntu24.04/Dockerfile) and [GitHub Actions](https://github.com/google/mozc/blob/master/.github/workflows/linux.yaml). diff --git a/docs/build_mozc_in_osx.md b/docs/build_mozc_in_osx.md index ffaf04c4d..524c869f3 100644 --- a/docs/build_mozc_in_osx.md +++ b/docs/build_mozc_in_osx.md @@ -87,7 +87,7 @@ python build_tools/update_deps.py In this step, additional build dependencies will be downloaded. * [Ninja 1.11.0](https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-mac.zip) - * [Qt 6.7.2](https://download.qt.io/archive/qt/6.7/6.7.2/submodules/qtbase-everywhere-src-6.7.2.tar.xz) + * [Qt 6.7.3](https://download.qt.io/archive/qt/6.7/6.7.3/submodules/qtbase-everywhere-src-6.7.3.tar.xz) * [git submodules](../.gitmodules) You can specify `--noqt` option if you would like to use your own Qt binaries. diff --git a/docs/build_mozc_in_windows.md b/docs/build_mozc_in_windows.md index 8d683c6f9..463b2bc36 100644 --- a/docs/build_mozc_in_windows.md +++ b/docs/build_mozc_in_windows.md @@ -65,7 +65,7 @@ python build_tools/update_deps.py In this step, additional build dependencies will be downloaded. * [Ninja 1.11.0](https://github.com/ninja-build/ninja/releases/download/v1.11.0/ninja-win.zip) - * [Qt 6.7.2](https://download.qt.io/archive/qt/6.7/6.7.2/submodules/qtbase-everywhere-src-6.7.2.tar.xz) + * [Qt 6.7.3](https://download.qt.io/archive/qt/6.7/6.7.3/submodules/qtbase-everywhere-src-6.7.3.tar.xz) * [.NET tools](../dotnet-tools.json) * [git submodules](../.gitmodules) diff --git a/src/base/util.cc b/src/base/util.cc index b03c32690..55daee5be 100644 --- a/src/base/util.cc +++ b/src/base/util.cc @@ -329,6 +329,23 @@ size_t Util::CharsLen(absl::string_view str) { return length; } +std::u32string Util::Utf8ToUtf32(absl::string_view str) { + std::u32string codepoints; + char32_t codepoint; + while (Util::SplitFirstChar32(str, &codepoint, &str)) { + codepoints.push_back(codepoint); + } + return codepoints; +} + +std::string Util::Utf32ToUtf8(const std::u32string_view str) { + std::string output; + for (const char32_t codepoint : str) { + CodepointToUtf8Append(codepoint, &output); + } + return output; +} + char32_t Util::Utf8ToCodepoint(const char *begin, const char *end, size_t *mblen) { absl::string_view s(begin, end - begin); @@ -470,6 +487,82 @@ bool Util::SplitLastChar32(absl::string_view s, absl::string_view *rest, return true; } +bool Util::IsValidUtf8(absl::string_view s) { + char32_t first; + absl::string_view rest; + while (!s.empty()) { + if (!SplitFirstChar32(s, &first, &rest)) { + return false; + } + s = rest; + } + return true; +} + +std::string Util::CodepointToUtf8(char32_t c) { + std::string output; + CodepointToUtf8Append(c, &output); + return output; +} + +void Util::CodepointToUtf8Append(char32_t c, std::string *output) { + char buf[7]; + output->append(buf, CodepointToUtf8(c, buf)); +} + +size_t Util::CodepointToUtf8(char32_t c, char *output) { + if (c == 0) { + // Do nothing if |c| is `\0`. Previous implementation of + // CodepointToUtf8Append worked like this. + output[0] = '\0'; + return 0; + } + if (c < 0x00080) { + output[0] = static_cast(c & 0xFF); + output[1] = '\0'; + return 1; + } + if (c < 0x00800) { + output[0] = static_cast(0xC0 + ((c >> 6) & 0x1F)); + output[1] = static_cast(0x80 + (c & 0x3F)); + output[2] = '\0'; + return 2; + } + if (c < 0x10000) { + output[0] = static_cast(0xE0 + ((c >> 12) & 0x0F)); + output[1] = static_cast(0x80 + ((c >> 6) & 0x3F)); + output[2] = static_cast(0x80 + (c & 0x3F)); + output[3] = '\0'; + return 3; + } + if (c < 0x200000) { + output[0] = static_cast(0xF0 + ((c >> 18) & 0x07)); + output[1] = static_cast(0x80 + ((c >> 12) & 0x3F)); + output[2] = static_cast(0x80 + ((c >> 6) & 0x3F)); + output[3] = static_cast(0x80 + (c & 0x3F)); + output[4] = '\0'; + return 4; + } + // below is not in UCS4 but in 32bit int. + if (c < 0x8000000) { + output[0] = static_cast(0xF8 + ((c >> 24) & 0x03)); + output[1] = static_cast(0x80 + ((c >> 18) & 0x3F)); + output[2] = static_cast(0x80 + ((c >> 12) & 0x3F)); + output[3] = static_cast(0x80 + ((c >> 6) & 0x3F)); + output[4] = static_cast(0x80 + (c & 0x3F)); + output[5] = '\0'; + return 5; + } + output[0] = static_cast(0xFC + ((c >> 30) & 0x01)); + output[1] = static_cast(0x80 + ((c >> 24) & 0x3F)); + output[2] = static_cast(0x80 + ((c >> 18) & 0x3F)); + output[3] = static_cast(0x80 + ((c >> 12) & 0x3F)); + output[4] = static_cast(0x80 + ((c >> 6) & 0x3F)); + output[5] = static_cast(0x80 + (c & 0x3F)); + output[6] = '\0'; + return 6; +} + absl::string_view Util::Utf8SubString(absl::string_view src, size_t start) { const char *begin = src.data(); const char *end = begin + src.size(); diff --git a/src/base/util.h b/src/base/util.h index a6199d813..1bd5d71e1 100644 --- a/src/base/util.h +++ b/src/base/util.h @@ -37,10 +37,7 @@ #include #include -#include "absl/base/attributes.h" -#include "absl/base/macros.h" #include "absl/strings/string_view.h" -#include "base/strings/unicode.h" namespace mozc { @@ -83,19 +80,12 @@ class Util { static bool IsCapitalizedAscii(absl::string_view s); // Returns the lengths of [src, src+size] encoded in UTF8. - ABSL_DEPRECATED("Use strings::CharsLen or AtLeastCharsLen.") static size_t CharsLen(absl::string_view str); // Converts a UTF-8 string to UTF-32. - ABSL_DEPRECATE_AND_INLINE() - static std::u32string Utf8ToUtf32(absl::string_view str) { - return strings::Utf8ToUtf32(str); - } + static std::u32string Utf8ToUtf32(absl::string_view str); // Converts a UTF-32 string to UTF-8. - ABSL_DEPRECATE_AND_INLINE() - static std::string Utf32ToUtf8(std::u32string_view str) { - return strings::Utf32ToUtf8(str); - } + static std::string Utf32ToUtf8(std::u32string_view str); // Converts the first character of UTF8 string starting at |begin| to UCS4. // The read byte length is stored to |mblen|. @@ -107,16 +97,16 @@ class Util { } // Converts a UCS4 code point to UTF8 string. - ABSL_DEPRECATE_AND_INLINE() static std::string CodepointToUtf8(char32_t c) { - return strings::Char32ToUtf8(c); - } + static std::string CodepointToUtf8(char32_t c); // Converts a UCS4 code point to UTF8 string and appends it to |output|, i.e., // |output| is not cleared. - ABSL_DEPRECATE_AND_INLINE() - static void CodepointToUtf8Append(char32_t c, std::string *output) { - return strings::StrAppendChar32(output, c); - } + static void CodepointToUtf8Append(char32_t c, std::string *output); + + // Converts a UCS4 code point to UTF8 and stores it to char array. The result + // is terminated by '\0'. Returns the byte length of converted UTF8 string. + // REQUIRES: The output buffer must be longer than 7 bytes. + static size_t CodepointToUtf8(char32_t c, char *output); // Returns true if |s| is split into |first_char32| + |rest|. // You can pass nullptr to |first_char32| and/or |rest| to ignore the matched @@ -135,23 +125,18 @@ class Util { char32_t *last_char32); // Returns true if |s| is a valid UTF8. - ABSL_DEPRECATE_AND_INLINE() static bool IsValidUtf8(absl::string_view s) { - return strings::IsValidUtf8(s); - } + static bool IsValidUtf8(absl::string_view s); // Extracts a substring range, where both start and length are in terms of // UTF8 size. Note that the returned string view refers to the same memory // block as the input. - ABSL_DEPRECATED("Use strings::Utf8AsChars or strings::Utf8Substring instead.") static absl::string_view Utf8SubString(absl::string_view src, size_t start, size_t length); // This version extracts the substring to the end. - ABSL_DEPRECATED("Use strings::Utf8AsChars or strings::Utf8Substring instead.") static absl::string_view Utf8SubString(absl::string_view src, size_t start); // Extracts a substring of length |length| starting at |start|. // Note: |start| is the start position in UTF8, not byte position. - ABSL_DEPRECATED("Use strings::Utf8AsChars or strings::Utf8Substring instead.") static void Utf8SubString(absl::string_view src, size_t start, size_t length, std::string *result); @@ -274,7 +259,7 @@ class Util { // char32_t c = iter.Get(); // ... // } -class ABSL_DEPRECATED("Use strings::Utf8AsChars instead.") ConstChar32Iterator { +class ConstChar32Iterator { public: explicit ConstChar32Iterator(absl::string_view utf8_string); ConstChar32Iterator(const ConstChar32Iterator &) = delete; diff --git a/src/base/util_test.cc b/src/base/util_test.cc index 6bedf5c21..55079567b 100644 --- a/src/base/util_test.cc +++ b/src/base/util_test.cc @@ -326,8 +326,10 @@ TEST(UtilTest, Utf8ToCodepoint) { } TEST(UtilTest, CodepointToUtf8) { + // Do nothing if |c| is NUL. Previous implementation of CodepointToUtf8 worked + // like this even though the reason is unclear. std::string output = Util::CodepointToUtf8(0); - EXPECT_EQ(output, absl::string_view("\0", 1)); + EXPECT_TRUE(output.empty()); output = Util::CodepointToUtf8(0x7F); EXPECT_EQ(output, "\x7F"); @@ -342,7 +344,34 @@ TEST(UtilTest, CodepointToUtf8) { output = Util::CodepointToUtf8(0x10000); EXPECT_EQ(output, "\xF0\x90\x80\x80"); output = Util::CodepointToUtf8(0x1FFFFF); - EXPECT_EQ(output, "\uFFFD"); + EXPECT_EQ(output, "\xF7\xBF\xBF\xBF"); + + // Buffer version. + char buf[7]; + + EXPECT_EQ(Util::CodepointToUtf8(0, buf), 0); + EXPECT_EQ(strcmp(buf, ""), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x7F, buf), 1); + EXPECT_EQ(strcmp("\x7F", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x80, buf), 2); + EXPECT_EQ(strcmp("\xC2\x80", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x7FF, buf), 2); + EXPECT_EQ(strcmp("\xDF\xBF", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x800, buf), 3); + EXPECT_EQ(strcmp("\xE0\xA0\x80", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0xFFFF, buf), 3); + EXPECT_EQ(strcmp("\xEF\xBF\xBF", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x10000, buf), 4); + EXPECT_EQ(strcmp("\xF0\x90\x80\x80", buf), 0); + + EXPECT_EQ(Util::CodepointToUtf8(0x1FFFFF, buf), 4); + EXPECT_EQ(strcmp("\xF7\xBF\xBF\xBF", buf), 0); } TEST(UtilTest, CharsLen) { diff --git a/src/build_tools/BUILD.bazel b/src/build_tools/BUILD.bazel index 8e57cc543..7b86c9bf1 100644 --- a/src/build_tools/BUILD.bazel +++ b/src/build_tools/BUILD.bazel @@ -179,3 +179,13 @@ bzl_library( "//bazel:run_build_tool_bzl", ], ) + +exports_files([ + "mozc_win32_resource_template.rc", +]) + +mozc_py_binary( + name = "gen_win32_resource_header", + srcs = ["gen_win32_resource_header.py"], + deps = [":mozc_version_lib"], +) diff --git a/src/build_tools/build_qt.py b/src/build_tools/build_qt.py index f22a4f009..33d38c86b 100755 --- a/src/build_tools/build_qt.py +++ b/src/build_tools/build_qt.py @@ -37,7 +37,7 @@ By default, this script assumes that Qt archives are stored as - src/third_party_cache/qtbase-everywhere-src-6.7.2.tar.xz + src/third_party_cache/qtbase-everywhere-src-6.7.3.tar.xz and Qt src files that are necessary to build Mozc will be checked out into @@ -69,7 +69,7 @@ ABS_QT_DEST_DIR = ABS_MOZC_SRC_DIR.joinpath('third_party', 'qt') # The archive filename should be consistent with update_deps.py. ABS_QT6_ARCHIVE_PATH = ABS_MOZC_SRC_DIR.joinpath( - 'third_party_cache', 'qtbase-everywhere-src-6.7.2.tar.xz') + 'third_party_cache', 'qtbase-everywhere-src-6.7.3.tar.xz') ABS_DEFAULT_NINJA_DIR = ABS_MOZC_SRC_DIR.joinpath('third_party', 'ninja') diff --git a/src/build_tools/gen_win32_resource_header.py b/src/build_tools/gen_win32_resource_header.py index d52bd41e8..c63343082 100755 --- a/src/build_tools/gen_win32_resource_header.py +++ b/src/build_tools/gen_win32_resource_header.py @@ -38,11 +38,12 @@ import logging -import mozc_version import optparse import os import sys +from build_tools import mozc_version + def ParseOptions(): """Parse command line options. @@ -55,6 +56,7 @@ def ParseOptions(): parser.add_option('--output', dest='output') parser.add_option('--main', dest='main') parser.add_option('--template', dest='template') + parser.add_option('--utf8', action='store_true', dest='utf8', default=False) (options, unused_args) = parser.parse_args() return options @@ -107,16 +109,17 @@ def main(): version_definition = version.GetVersionInFormat(bootstrapper_template) + out_encoding = 'utf-8' if options.utf8 else 'utf-16le' old_content = '' if os.path.exists(options.output): # if the target file already exists, need to check the necessity of update. try: - old_content = open(options.output, encoding='utf-16le').read() + old_content = open(options.output, encoding=out_encoding).read() except UnicodeError: old_content = '' if version_definition != old_content: - open(options.output, 'w', encoding='utf-16le').write(version_definition) + open(options.output, 'w', encoding=out_encoding).write(version_definition) if __name__ == '__main__': main() diff --git a/src/build_tools/update_deps.py b/src/build_tools/update_deps.py index a279374c8..4d556bcda 100644 --- a/src/build_tools/update_deps.py +++ b/src/build_tools/update_deps.py @@ -81,9 +81,9 @@ def __hash__(self): QT6 = ArchiveInfo( - url='https://download.qt.io/archive/qt/6.7/6.7.2/submodules/qtbase-everywhere-src-6.7.2.tar.xz', - size=49364504, - sha256='c5f22a5e10fb162895ded7de0963328e7307611c688487b5d152c9ee64767599', + url='https://download.qt.io/archive/qt/6.7/6.7.3/submodules/qtbase-everywhere-src-6.7.3.tar.xz', + size=49426156, + sha256='8ccbb9ab055205ac76632c9eeddd1ed6fc66936fc56afc2ed0fd5d9e23da3097', ) NINJA_MAC = ArchiveInfo( diff --git a/src/converter/BUILD.bazel b/src/converter/BUILD.bazel index bd227f17c..e48ae54c5 100644 --- a/src/converter/BUILD.bazel +++ b/src/converter/BUILD.bazel @@ -512,6 +512,7 @@ mozc_cc_test( ":segments", "//composer", "//composer:table", + "//config:config_handler", "//engine:engine_factory", "//engine:engine_interface", "//protocol:commands_cc_proto", diff --git a/src/converter/converter_regression_test.cc b/src/converter/converter_regression_test.cc index b80f63c59..5e9a2ab1e 100644 --- a/src/converter/converter_regression_test.cc +++ b/src/converter/converter_regression_test.cc @@ -32,6 +32,7 @@ #include "absl/log/check.h" #include "composer/composer.h" #include "composer/table.h" +#include "config/config_handler.h" #include "converter/converter_interface.h" #include "converter/segments.h" #include "engine/engine_factory.h" @@ -68,12 +69,13 @@ TEST_F(ConverterRegressionTest, QueryOfDeathTest) { } { Segments segments; - ConversionRequest conv_request; // Create an empty composer. const Table table; const commands::Request request; - composer::Composer composer(&table, &request, nullptr); - conv_request.set_composer(&composer); + const commands::Context context; + const config::Config config = config::ConfigHandler::DefaultConfig(); + composer::Composer composer(&table, &request, &config); + ConversionRequest conv_request(&composer, &request, &context, &config); // Converter returns false, but not crash. EXPECT_FALSE(converter->StartConversion(conv_request, &segments)); } diff --git a/src/data/images/win/BUILD.bazel b/src/data/images/win/BUILD.bazel new file mode 100644 index 000000000..b5bc6a725 --- /dev/null +++ b/src/data/images/win/BUILD.bazel @@ -0,0 +1,44 @@ +# Copyright 2010-2021, Google Inc. +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are +# met: +# +# * Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above +# copyright notice, this list of conditions and the following disclaimer +# in the documentation and/or other materials provided with the +# distribution. +# * Neither the name of Google Inc. nor the names of its +# contributors may be used to endorse or promote products derived from +# this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +# Image files for Windows builds. + +package(default_visibility = ["//visibility:private"]) + +filegroup( + name = "candidate_window_logo", + srcs = glob(["candidate_window_logo_*.bmp"]), + visibility = ["//renderer/win32:__subpackages__"], +) + +filegroup( + name = "icons", + srcs = glob(["*.ico"]), + visibility = ["//win32/tip:__subpackages__"], +) diff --git a/src/prediction/dictionary_prediction_aggregator.cc b/src/prediction/dictionary_prediction_aggregator.cc index 61134d931..f91691044 100644 --- a/src/prediction/dictionary_prediction_aggregator.cc +++ b/src/prediction/dictionary_prediction_aggregator.cc @@ -1706,6 +1706,8 @@ void DictionaryPredictionAggregator::AggregateTypingCorrectedPrediction( // insensitive dictionary lookup is also disabled as composition // spellchecker has already fixed them. ConversionRequest corrected_request = request; + // TODO(b/365909808): corrected_request.composer() returns nullptr. We should + // add an empty composer instead. corrected_request.set_composer(nullptr); corrected_request.set_kana_modifier_insensitive_conversion(false); diff --git a/src/prediction/user_history_predictor_test.cc b/src/prediction/user_history_predictor_test.cc index 84fd7d9ab..21589f22e 100644 --- a/src/prediction/user_history_predictor_test.cc +++ b/src/prediction/user_history_predictor_test.cc @@ -2788,7 +2788,7 @@ void InitSegmentsFromInputSequence(const absl::string_view text, composer->InsertCharacterKeyEvent(key); } - request->set_composer(composer); + ASSERT_EQ(&request->composer(), composer); request->set_request_type(ConversionRequest::PREDICTION); Segment *segment = segments->add_segment(); diff --git a/src/rewriter/BUILD.bazel b/src/rewriter/BUILD.bazel index 4bd54711d..01b20fc89 100644 --- a/src/rewriter/BUILD.bazel +++ b/src/rewriter/BUILD.bazel @@ -1168,6 +1168,7 @@ mozc_cc_test( ":t13n_promotion_rewriter", ":transliteration_rewriter", "//composer", + "//config:config_handler", "//converter:segments", "//data_manager/testing:mock_data_manager", "//dictionary:pos_matcher", diff --git a/src/rewriter/date_rewriter_test.cc b/src/rewriter/date_rewriter_test.cc index 8b23e7b18..6782877f3 100644 --- a/src/rewriter/date_rewriter_test.cc +++ b/src/rewriter/date_rewriter_test.cc @@ -918,10 +918,10 @@ TEST_F(DateRewriterTest, NumberRewriterFromRawInputTest) { table.AddRule("222", "c", ""); table.AddRule("3", "d", ""); const commands::Request request; + const commands::Context context; const config::Config config; composer::Composer composer(&table, &request, &config); - ConversionRequest conversion_request; - conversion_request.set_composer(&composer); + ConversionRequest conversion_request(&composer, &request, &context, &config); // Key sequence : 2223 // Preedit : cd diff --git a/src/rewriter/rewriter_test.gyp b/src/rewriter/rewriter_test.gyp index 16131b433..b3646a080 100644 --- a/src/rewriter/rewriter_test.gyp +++ b/src/rewriter/rewriter_test.gyp @@ -78,6 +78,7 @@ '<(mozc_oss_src_dir)/base/base.gyp:number_util', '<(mozc_oss_src_dir)/base/base.gyp:serialized_string_array', '<(mozc_oss_src_dir)/base/base_test.gyp:clock_mock', + '<(mozc_oss_src_dir)/config/config.gyp:config_handler', '<(mozc_oss_src_dir)/converter/converter.gyp:converter', '<(mozc_oss_src_dir)/data_manager/testing/mock_data_manager.gyp:mock_data_manager', '<(mozc_oss_src_dir)/dictionary/dictionary_base.gyp:user_pos', diff --git a/src/rewriter/t13n_promotion_rewriter_test.cc b/src/rewriter/t13n_promotion_rewriter_test.cc index 0649b4214..033f8d8d4 100644 --- a/src/rewriter/t13n_promotion_rewriter_test.cc +++ b/src/rewriter/t13n_promotion_rewriter_test.cc @@ -35,6 +35,7 @@ #include "absl/strings/string_view.h" #include "composer/composer.h" +#include "config/config_handler.h" #include "converter/segments.h" #include "data_manager/testing/mock_data_manager.h" #include "dictionary/pos_matcher.h" @@ -75,12 +76,15 @@ class T13nPromotionRewriterTest : public testing::TestWithTempUserProfile { t13n_rewriter_ = std::make_unique( dictionary::PosMatcher(mock_data_manager_.GetPosMatcherData())); - mobile_conv_request_ = ConversionRequest(); composer_ = composer::Composer(); mobile_request_ = commands::Request(); request_test_util::FillMobileRequest(&mobile_request_); composer_.SetRequest(&mobile_request_); + + mobile_conv_request_ = + ConversionRequest(&composer_, &mobile_request_, &context_, + &config::ConfigHandler::DefaultConfig()); mobile_conv_request_.set_request(&mobile_request_); mobile_conv_request_.set_composer(&composer_); } @@ -88,6 +92,7 @@ class T13nPromotionRewriterTest : public testing::TestWithTempUserProfile { std::unique_ptr t13n_rewriter_; ConversionRequest mobile_conv_request_; composer::Composer composer_; + commands::Context context_; commands::Request mobile_request_; private: