Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider specifying configure = True when using repository_rule #844

Closed
yukawa opened this issue Nov 7, 2023 · 0 comments
Closed

Consider specifying configure = True when using repository_rule #844

yukawa opened this issue Nov 7, 2023 · 0 comments

Comments

@yukawa
Copy link
Collaborator

yukawa commented Nov 7, 2023

Description

Currently pkg_config_repository, qt_mac_repository.bzl, and android_repository use repository_rule without configure = True.

If the configure flag is set, the repository is only re-fetched on bazel sync when the --configure parameter is passed to it (if the attribute is unset, this command will not cause a re-fetch)

As a result, these repositories will not be re-evaluated upon bazel sync --configure.

pkg_config_repository

pkg_config_repository = repository_rule(
implementation = _pkg_config_repository_impl,
attrs = {
"packages": attr.string_list(),
},
)

mozc/src/WORKSPACE.bazel

Lines 119 to 123 in e324bf2

# iBus
pkg_config_repository(
name = "ibus",
packages = ["glib-2.0", "gobject-2.0", "ibus-1.0"],
)

mozc/src/WORKSPACE.bazel

Lines 132 to 136 in e324bf2

# Qt for Linux
pkg_config_repository(
name = "qt_linux",
packages = ["Qt6Core", "Qt6Gui", "Qt6Widgets"],
)

qt_mac_repository.bzl

qt_mac_repository = repository_rule(
implementation = _qt_mac_repository_impl,
environ = ["MOZC_QT_PATH"],
attrs = {
"default_path": attr.string(),
},
)

android_repository

android_repository = repository_rule(
implementation = _android_repository_impl,
environ = ["ANDROID_NDK_HOME"],
)

Steps to reproduce

  1. Install Ubuntu 23.10 server as a minimum installation
  2. Run the following commands.
sudo apt-get install -y curl gnupg libncurses6
curl -fsSL https://bazel.build/bazel-release.pub.gpg | gpg --dearmor > bazel.gpg
sudo mv bazel.gpg /etc/apt/trusted.gpg.d/
echo "deb [arch=amd64] https://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
sudo apt-get update
sudo apt-get install -y git build-essential python3 bazel pkg-config
git clone https://github.com/google/mozc.git -b master --single-branch --recursive
cd mozc/src
bazel build package --config oss_linux -c opt
  1. Then run the following commands.
sudo apt-get install -y libibus-1.0-dev libglib2.0-dev qt6-base-dev libgl-dev
bazel sync --configure
bazel build package --config oss_linux -c opt

Expected behavior

  • At the step 2, the build fails due to missing dependencies (libibus-1.0-dev, libglib2.0-dev, qt6-base-dev, libgl-dev)
  • At the step 3, the build succeeds.

Actual behavior

  • At the step 2, the build fails due to missing dependencies (libibus-1.0-dev, libglib2.0-dev, qt6-base-dev, libgl-dev)
  • At the step 3, the build fails with the same error as the step 2.

Version or commit-id

e324bf2

Environment

  • OS: Ubuntu 23.10
hiroyuki-komatsu added a commit that referenced this issue Nov 15, 2023
Typing quality
* Updated the word dictionary.
* Adjusted the conversion with suffix numbers (e.g. 後に vs あと2).

Windows
* Prelaunch processes from the installer (#845)

Build
* Updated the Protobuf version: v24.2 → v25.0 (#841)
* Updated the Abseil version: 20230125.3 → 20230802.1 (#841)
* Supported to follow updates of external environmental dependencies (#843, #844)
* Removed `third_party/ipa_font` and introduced our own testing font  (#842)
* Android: Fixed the linkage error of Android library build (#840)

PiperOrigin-RevId: 582509744
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
By setting 'configure = True' to 'repository_rule' when defining an
external repository, the repository will be re-evaluated by running the
following command [1].

  bazel sync --configure

Hopefully this command can fix most of mysterious build failures due to
stale external repositories and/or build toolchanins, which cannot be
simply fixed by 'bazel clean'.

 [1]: https://github.com/bazelbuild/bazel/blob/80edda5b7be15875b9bcca7aef64ffa4be06bd38/site/en/extending/repo.md?plain=1#L156-L168

PiperOrigin-RevId: 580265652
coooooooozy pushed a commit to coooooooozy/mozc that referenced this issue Nov 26, 2023
Typing quality
* Updated the word dictionary.
* Adjusted the conversion with suffix numbers (e.g. 後に vs あと2).

Windows
* Prelaunch processes from the installer (google#845)

Build
* Updated the Protobuf version: v24.2 → v25.0 (google#841)
* Updated the Abseil version: 20230125.3 → 20230802.1 (google#841)
* Supported to follow updates of external environmental dependencies (google#843, google#844)
* Removed `third_party/ipa_font` and introduced our own testing font  (google#842)
* Android: Fixed the linkage error of Android library build (google#840)

PiperOrigin-RevId: 582509744
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant