From 1a0d98a537b3f016da9c74503b6471f2e4336dc8 Mon Sep 17 00:00:00 2001 From: Yohei Yukawa Date: Wed, 6 Nov 2024 21:28:51 -0800 Subject: [PATCH] Remove `WORKSPACE` support from Bazel builds (#1116) As Mozc has already migrated to bzlmod from WORKSPACE, let's remove obsolete and unmaintained WORKSPACE-related files and configs to make it clear that WORKSPACE is no longer supported to build Mozc with Bazel. Closes #1115. PiperOrigin-RevId: 693968950 --- src/.bazelrc | 16 +-- src/WORKSPACE.bazel | 332 ------------------------------------------- src/WORKSPACE.bzlmod | 6 - 3 files changed, 2 insertions(+), 352 deletions(-) delete mode 100644 src/WORKSPACE.bazel delete mode 100644 src/WORKSPACE.bzlmod diff --git a/src/.bazelrc b/src/.bazelrc index 2f8a716a4..cbe35ca50 100644 --- a/src/.bazelrc +++ b/src/.bazelrc @@ -17,15 +17,6 @@ common:android --config=android_env --define TARGET=oss_android common:oss_android --config=android_env --define TARGET=oss_android common:prod_android --config=android_env --define TARGET=prod_android -## Bzlmod options: Bzlmod is the default except for Android. -common:linux_env --config=bzlmod -common:macos_env --config=bzlmod -common:windows_env --config=bzlmod -common:android_env --config=bzlmod - -common:bzlmod --enable_bzlmod -common:workspace --noenable_bzlmod - ## Dev channel build:dev_channel --define CHANNEL=dev @@ -74,9 +65,6 @@ build:windows_env --noincompatible_enable_cc_toolchain_resolution # Android specific options build:android_env --copt "-DOS_ANDROID" build:android_env --build_tag_filters=-noandroid -test:android_env --test_tag_filters=-noandroid - -## Android Blzmod specific options -### --experimental_google_legacy_api is required for all platforms. -build:bzlmod --experimental_google_legacy_api build:android_env --experimental_enable_android_migration_apis +build:android_env --experimental_google_legacy_api +test:android_env --test_tag_filters=-noandroid diff --git a/src/WORKSPACE.bazel b/src/WORKSPACE.bazel deleted file mode 100644 index 3dfed4f5d..000000000 --- a/src/WORKSPACE.bazel +++ /dev/null @@ -1,332 +0,0 @@ -# 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. - -# WORKSPACE.bazel is a legacy dependency configuration system but the default system for Mozc yet. -# To use the new system (Bzlmod), specify --enable_bzlmod to the Bazel command or modify .bazelrc. - -# An identifier for this repository. -workspace(name = "mozc") - -load("@//:config.bzl", "MACOS_QT_PATH", "SHA256_ZIP_CODE_JIGYOSYO", "SHA256_ZIP_CODE_KEN_ALL") -load("@//bazel:pkg_config_repository.bzl", "pkg_config_repository") -load( - "@bazel_tools//tools/build_defs/repo:http.bzl", - "http_archive", - "http_file", -) - -# Bazel Skylib (1.7.1 2024-07-03) -# https://github.com/bazelbuild/bazel-skylib -http_archive( - name = "bazel_skylib", - sha256 = "bc283cdfcd526a52c3201279cda4bc298652efa898b10b4db0837dc51652756f", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", - "https://github.com/bazelbuild/bazel-skylib/releases/download/1.7.1/bazel-skylib-1.7.1.tar.gz", - ], -) - -load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") - -bazel_skylib_workspace() - -# Bazel Python rules (0.34.0 2024-07-04) -http_archive( - name = "rules_python", - sha256 = "778aaeab3e6cfd56d681c89f5c10d7ad6bf8d2f1a72de9de55b23081b2d31618", - strip_prefix = "rules_python-0.34.0", - url = "https://github.com/bazelbuild/rules_python/releases/download/0.34.0/rules_python-0.34.0.tar.gz", -) - -load("@rules_python//python:repositories.bzl", "py_repositories") - -py_repositories() - -# Abseil -# https://abseil.io/docs/cpp/quickstart#set-up-a-bazel-workspace-to-work-with-abseil -local_repository( - name = "com_google_absl", - path = "third_party/abseil-cpp", -) - -# Protocol Buffers -# https://github.com/protocolbuffers/protobuf/blob/main/examples/WORKSPACE -local_repository( - name = "com_google_protobuf", - path = "third_party/protobuf", -) - -load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps") - -protobuf_deps() - -# GoogleTest -local_repository( - name = "com_google_googletest", - path = "third_party/gtest", -) - -# Bazel macOS build (3.8.0 2024-08-10) -# https://github.com/bazelbuild/rules_apple/ -http_archive( - name = "build_bazel_rules_apple", - sha256 = "62847b3f444ce514ae386704a119ad7b29fa6dfb65a38bff4ae239f2389a0429", - url = "https://github.com/bazelbuild/rules_apple/releases/download/3.8.0/rules_apple.3.8.0.tar.gz", -) - -load( - "@build_bazel_rules_apple//apple:repositories.bzl", - "apple_rules_dependencies", -) - -apple_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:repositories.bzl", - "swift_rules_dependencies", -) - -swift_rules_dependencies() - -load( - "@build_bazel_rules_swift//swift:extras.bzl", - "swift_rules_extra_dependencies", -) - -swift_rules_extra_dependencies() - -load( - "@build_bazel_apple_support//lib:repositories.bzl", - "apple_support_dependencies", -) - -apple_support_dependencies() - -# Android NDK setup (0.1.2 2024-07-23) -http_archive( - name = "rules_android_ndk", - sha256 = "65aedff0cd728bee394f6fb8e65ba39c4c5efb11b29b766356922d4a74c623f5", - strip_prefix = "rules_android_ndk-0.1.2", - url = "https://github.com/bazelbuild/rules_android_ndk/releases/download/v0.1.2/rules_android_ndk-v0.1.2.tar.gz", -) - -# Check the ANDROID_NDK_HOME envvar, if it is specified set up NDK as follows -# load("@rules_android_ndk//:rules.bzl", "android_ndk_repository") -# android_ndk_repository(name="androidndk") -# If it is empty, do nothing. -load("@//bazel:android_repository.bzl", "android_repository") - -android_repository(name = "android_repository") - -load("@android_repository//:setup.bzl", "android_ndk_setup") - -android_ndk_setup() - -# Placeholder of rules_android for the compatibility with Bzlmod. -new_local_repository( - name = "rules_android", - build_file_content = "", - path = "bazel", -) - -# Android SDK rules (0.1.1 2018-06-15) -http_archive( - name = "build_bazel_rules_android", - sha256 = "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", - strip_prefix = "rules_android-0.1.1", - urls = ["https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip"], -) - -load("@build_bazel_rules_android//android:rules.bzl", "android_sdk_repository") - -android_sdk_repository( - name = "androidsdk", -) - -# platforms (0.0.10 2024-04-26) -# https://github.com/bazelbuild/platforms/ -http_archive( - name = "platforms", - sha256 = "218efe8ee736d26a3572663b374a253c012b716d8af0c07e842e82f238a0a7ee", - urls = [ - "https://mirror.bazel.build/github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", - "https://github.com/bazelbuild/platforms/releases/download/0.0.10/platforms-0.0.10.tar.gz", - ], -) - -# Windows Implementation Library (WIL) -# https://github.com/microsoft/wil/ -new_local_repository( - name = "com_microsoft_wil", - build_file = "@//bazel:BUILD.wil.bazel", - path = "third_party/wil", -) - -# iBus -pkg_config_repository( - name = "ibus", - packages = [ - "glib-2.0", - "gobject-2.0", - "ibus-1.0", - ], -) - -# Japanese Usage Dictionary -new_local_repository( - name = "ja_usage_dict", - build_file = "@//bazel:BUILD.ja_usage_dict.bazel", - path = "third_party/japanese_usage_dictionary", -) - -# Qt for Linux -pkg_config_repository( - name = "qt_linux", - packages = [ - "Qt6Core", - "Qt6Gui", - "Qt6Widgets", - ], -) - -# Qt for macOS -load("@//bazel:qt_mac_repository.bzl", "qt_mac_repository") - -qt_mac_repository( - name = "qt_mac", - default_path = MACOS_QT_PATH, # can be replaced with MOZC_QT_PATH envvar. -) - -# Qt for Windows -new_local_repository( - name = "qt_win", - build_file = "@//bazel:BUILD.qt_win.bazel", - path = "third_party/qt", -) - -# Windows SDK -load("@//bazel:windows_sdk_repository.bzl", "windows_sdk_repository") - -windows_sdk_repository( - name = "windows_sdk", -) - -# dotnet tool repository (to load "wix") -load("@//bazel:dotnet_tool_repository.bzl", "dotnet_tool_repository") - -dotnet_tool_repository( - name = "wix", - version = "5.0.2", -) - -# Google Toolbox for Mac -# https://github.com/google/google-toolbox-for-mac -# We just need UnitTesting, so strip to the directory and skip dependencies. -GTM_GIT_SHA = "8fbaae947b87c1e66c0934493168fc6d583ed889" - -http_archive( - name = "google_toolbox_for_mac", - build_file = "@//bazel:BUILD.google_toolbox_for_mac.bazel", - patch_args = ["-p2"], - patches = ["@//:google_toolbox_for_mac.patch"], - strip_prefix = "google-toolbox-for-mac-%s/UnitTesting" % GTM_GIT_SHA, - urls = [ - "https://github.com/google/google-toolbox-for-mac/archive/%s.zip" % GTM_GIT_SHA, - ], -) - -# Material icons -http_file( - name = "material_icon_dictionary_png", - downloaded_file_path = "dictionary.png", - sha256 = "6d2ac7befa038d4f32e07136293acaf5d8645a4daecb6d063f34be2ffea59b55", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/png/action/chrome_reader_mode/materialiconsoutlined/48dp/1x/outline_chrome_reader_mode_black_48dp.png", - ], -) - -http_file( - name = "material_icon_dictionary_svg", - downloaded_file_path = "dictionary.svg", - sha256 = "a4c7b9bfb442a7497b72d74358c31034c4fef1ab2a50659834784580751ac04d", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/src/action/chrome_reader_mode/materialiconsoutlined/24px.svg", - ], -) - -http_file( - name = "material_icon_properties_png", - downloaded_file_path = "properties.png", - sha256 = "c4ae8bb7992f43157be9d026f76a7039af6e0e3de0f220842208dfda8c38714a", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/png/action/settings/materialiconsround/48dp/1x/round_settings_black_48dp.png", - ], -) - -http_file( - name = "material_icon_properties_svg", - downloaded_file_path = "properties.svg", - sha256 = "9b01b133be1caffc680f132d385d0e594262d6cfd29759a63c428050b83fe628", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/src/action/settings/materialiconsround/24px.svg", - ], -) - -http_file( - name = "material_icon_tool_png", - downloaded_file_path = "tool.png", - sha256 = "269433bf6d6948a93ab6a57a73ceb5930870223046052cfffe01eeca37327d3e", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/png/action/build/materialicons/48dp/1x/baseline_build_black_48dp.png", - ], -) - -http_file( - name = "material_icon_tool_svg", - downloaded_file_path = "tool.svg", - sha256 = "df34fba3d09778db69503a23b688761051dbf65b5bccb0d7b729c69ff61c3804", - urls = [ - "https://raw.githubusercontent.com/google/material-design-icons/4.0.0/src/action/build/materialicons/24px.svg", - ], -) - -# Zip code -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", -) - -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", -) diff --git a/src/WORKSPACE.bzlmod b/src/WORKSPACE.bzlmod deleted file mode 100644 index 447f28e76..000000000 --- a/src/WORKSPACE.bzlmod +++ /dev/null @@ -1,6 +0,0 @@ -# WORKSPACE.bzlmod is used with Bzlmod (i.e. MODULE.bazel). -# To use Bzlmod, you need to specify --enable_bzlmod to the Bazel command or -# modify .bazelrc. - -# This empty file prevents fetching any dependencies from the old WORKSPACE -# system when Bzlmod is enabled.