diff --git a/src/.bazelrc b/src/.bazelrc index 36b0b62df..89417f53f 100644 --- a/src/.bazelrc +++ b/src/.bazelrc @@ -10,9 +10,11 @@ common:prod_android --config=compiler_gcc_like common:macos --config=compiler_gcc_like common:oss_macos --config=compiler_gcc_like common:prod_macos --config=compiler_gcc_like +common:prod_macos_dev --config=prod_macos --config=dev_channel common:windows --config=compiler_msvc_like common:oss_windows --config=compiler_msvc_like common:prod_windows --config=compiler_msvc_like +common:prod_windows_dev --config=prod_windows --config=dev_channel # Make sure we set -std=c++20 that may affect ABI across all the compilation targets. # https://github.com/abseil/abseil-cpp/blob/master/FAQ.md#what-is-abi-and-why-dont-you-recommend-using-a-pre-compiled-version-of-abseil @@ -27,6 +29,9 @@ build:compiler_msvc_like --copt "/utf-8" --host_copt "/utf-8" build:compiler_msvc_like --cxxopt "/J" --host_cxxopt "/J" build:compiler_msvc_like --cxxopt "/utf-8" --host_cxxopt "/utf-8" +# Dev channel +build:dev_channel --define CHANNEL=dev + # Linux build:linux --define TARGET=oss_linux --copt "-fPIC" build:linux --build_tag_filters=-nolinux diff --git a/src/BUILD.bazel b/src/BUILD.bazel index 30ad3efe1..419ddb938 100644 --- a/src/BUILD.bazel +++ b/src/BUILD.bazel @@ -56,6 +56,13 @@ config_setting( visibility = ["//visibility:private"], ) +config_setting( + name = "dev_channel", + values = { + "define": "CHANNEL=dev", + }, +) + alias( name = "compiler", actual = BAZEL_TOOLS_PREFIX + "//tools/cpp:compiler", @@ -157,7 +164,10 @@ cc_library( ) + mozc_select_enable_supplemental_model([ ]) + mozc_select_enable_usage_rewriter( off = ["NO_USAGE_REWRITER"], - ), + ) + select({ + ":dev_channel": ["CHANNEL_DEV=1"], + "//conditions:default": [], + }), ) bzl_library( diff --git a/src/mac/BUILD.bazel b/src/mac/BUILD.bazel index b91f51c17..25a573288 100644 --- a/src/mac/BUILD.bazel +++ b/src/mac/BUILD.bazel @@ -44,6 +44,12 @@ load( package(default_visibility = ["//:__subpackages__"]) +# BUILD_TYPE_SELECT is treated as a function, but not a string. This cannot be a value of join(). +BUILD_TYPE_SELECT = select({ + "//:dev_channel": "dev", + "//conditions:default": "stable", +}) + mozc_macos_application( name = "mozc_macos", additional_contents = mozc_select( @@ -380,8 +386,8 @@ genrule( "$(location //build_tools:tweak_macinstaller_script)", " --output $@", " --input $<", - " --build_type dev", # or stable. - ]), + " --build_type ", + ]) + BUILD_TYPE_SELECT, # "dev" or "stable". tools = ["//build_tools:tweak_macinstaller_script"], ) @@ -397,8 +403,8 @@ genrule( " --output $@", " --input $<", " --version_file $(location //base:mozc_version_txt)", - " --build_type dev", # or stable. - ]), + " --build_type ", + ]) + BUILD_TYPE_SELECT, # "dev" or "stable". tools = [ "//base:mozc_version_txt", "//build_tools:tweak_macinstaller_script", @@ -505,13 +511,16 @@ genrule( prod_macos = ["installer/Mozc_template.pkgproj"], ), outs = ["Mozc_Packages.pkg"], - cmd = ("$(location :build_installer) --input $(location :tweaked_installer_files) --output $@" + - " --pkgproj_command $(location //build_tools:tweak_pkgproj)" + - " --pkgproj_input $(location installer/Mozc_template.pkgproj)" + - " --pkgproj_output installer.pkgproj" + - " --version_file $(location //base:mozc_version_txt)" + - " --auto_updater_dir " + AUTO_UPDATER_DIR + - " --build_type dev"), # or stable + cmd = " ".join([ + "$(location :build_installer)", + "--input $(location :tweaked_installer_files) --output $@" + + "--pkgproj_command $(location //build_tools:tweak_pkgproj)", + "--pkgproj_input $(location installer/Mozc_template.pkgproj)", + "--pkgproj_output installer.pkgproj", + "--version_file $(location //base:mozc_version_txt)", + "--auto_updater_dir " + AUTO_UPDATER_DIR, + "--build_type ", + ]) + BUILD_TYPE_SELECT, # "dev" or "stable" tags = ["manual"], tools = [ ":build_installer", @@ -529,8 +538,8 @@ genrule( "$(location //build_tools:tweak_macinstaller_script)", "--output $@", "--input $(SRCS)", - "--build_type dev", # or stable - ]), + "--build_type ", + ]) + BUILD_TYPE_SELECT, # "dev" or "stable" tags = ["manual"], tools = [ "//build_tools:tweak_macinstaller_script", diff --git a/src/win32/installer/BUILD.bazel b/src/win32/installer/BUILD.bazel index caf78613f..ee91b532c 100644 --- a/src/win32/installer/BUILD.bazel +++ b/src/win32/installer/BUILD.bazel @@ -28,3 +28,6 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # Build rules for the Windows installer. + +# Note, omaha_channel_type can be controlled by //:dev_channel +# See BUILD_TYPE_SELECT in mac/BUILD as an example.