Disambiguate release and local `config_settings` via a release flag.

This flag was added to Protobuf and submitted separately due to version skew between repos.

This attempts to fix the following error from local and release settings both matching.
```
ERROR: /workspace/_build/out/external/upb/python/dist/BUILD.bazel:251:9: Illegal ambiguous match on configurable attribute "platform" in @upb//python/dist:binary_wheel:
@upb//python/dist:linux_x86_64_local
@upb//python/dist:windows_x86_64
Multiple matches are not allowed unless one is unambiguously more specialized or they resolve to the same value. See https://bazel.build/reference/be/functions#select.
```
PiperOrigin-RevId: 553226261
pull/13675/head^2
Sandy Zhang 1 year ago committed by Copybara-Service
parent 8c5f39d1ed
commit 629764bacf
  1. 2
      .github/workflows/python_tests.yml
  2. 4
      bazel/workspace_deps.bzl
  3. 36
      python/dist/BUILD.bazel

@ -39,7 +39,7 @@ jobs:
name: Set up Bazel caching name: Set up Bazel caching
uses: ./.github/actions/setup-bazel-cache uses: ./.github/actions/setup-bazel-cache
- name: Build Wheels - name: Build Wheels
run: cd ${{ github.workspace }} && docker run -e GOOGLE_APPLICATION_CREDENTIALS=/workspace/$(basename $GOOGLE_APPLICATION_CREDENTIALS) -v$PWD:/workspace $DOCKER_IMAGE build $BAZEL_CACHE --crosstool_top=@com_google_protobuf//toolchain:clang_suite --symlink_prefix=/ -c dbg python/dist ${{ steps.bazel-cache.outputs.cache_args }} python/dist:test_wheel python/dist:source_wheel run: cd ${{ github.workspace }} && docker run -e GOOGLE_APPLICATION_CREDENTIALS=/workspace/$(basename $GOOGLE_APPLICATION_CREDENTIALS) -v$PWD:/workspace $DOCKER_IMAGE build $BAZEL_CACHE --crosstool_top=@com_google_protobuf//toolchain:clang_suite --@com_google_protobuf//toolchain:release=true --symlink_prefix=/ -c dbg python/dist ${{ steps.bazel-cache.outputs.cache_args }} python/dist:test_wheel python/dist:source_wheel
- name: Move Wheels - name: Move Wheels
run: mkdir wheels && find _build/out \( -name 'protobuf*.whl' -o -name 'protobuf-*.tar.gz' \) -exec mv '{}' wheels ';' run: mkdir wheels && find _build/out \( -name 'protobuf*.whl' -o -name 'protobuf-*.tar.gz' \) -exec mv '{}' wheels ';'
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v3

@ -23,8 +23,8 @@ def upb_deps():
_github_archive, _github_archive,
name = "com_google_protobuf", name = "com_google_protobuf",
repo = "https://github.com/protocolbuffers/protobuf", repo = "https://github.com/protocolbuffers/protobuf",
commit = "3f98af287b8b1919e1efb65d5f5851ff1e7628ce", commit = "22e845e279bd79ad013bff4b79660b8c8b72d935",
sha256 = "c166e5ee22b1e5432d8d9e99c322a017a2f02df62f2ca7bb12009fbbbf364b98", sha256 = "276215041e767973f274299783b5d7b7de1a3c55628b9890bd9eb064dfa5daaf",
patches = ["@upb//bazel:protobuf.patch"], patches = ["@upb//bazel:protobuf.patch"],
) )

@ -64,6 +64,9 @@ py_proto_library(
config_setting( config_setting(
name = "linux_aarch64_release", name = "linux_aarch64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "linux-aarch_64"}, values = {"cpu": "linux-aarch_64"},
) )
@ -73,10 +76,16 @@ config_setting(
"@platforms//os:linux", "@platforms//os:linux",
"@platforms//cpu:aarch64", "@platforms//cpu:aarch64",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
config_setting( config_setting(
name = "linux_x86_64_release", name = "linux_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "linux-x86_64"}, values = {"cpu": "linux-x86_64"},
) )
@ -86,10 +95,16 @@ config_setting(
"@platforms//os:linux", "@platforms//os:linux",
"@platforms//cpu:x86_64", "@platforms//cpu:x86_64",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
config_setting( config_setting(
name = "osx_x86_64_release", name = "osx_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "osx-x86_64"}, values = {"cpu": "osx-x86_64"},
) )
@ -99,6 +114,9 @@ config_setting(
"@platforms//os:osx", "@platforms//os:osx",
"@platforms//cpu:x86_64", "@platforms//cpu:x86_64",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
selects.config_setting_group( selects.config_setting_group(
@ -111,6 +129,9 @@ selects.config_setting_group(
config_setting( config_setting(
name = "osx_aarch64_release", name = "osx_aarch64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "osx-aarch_64"}, values = {"cpu": "osx-aarch_64"},
) )
@ -120,6 +141,9 @@ config_setting(
"@platforms//os:osx", "@platforms//os:osx",
"@platforms//cpu:aarch64", "@platforms//cpu:aarch64",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
selects.config_setting_group( selects.config_setting_group(
@ -137,6 +161,9 @@ config_setting(
config_setting( config_setting(
name = "windows_x86_32_release", name = "windows_x86_32_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "win32"}, values = {"cpu": "win32"},
) )
@ -146,6 +173,9 @@ config_setting(
"@platforms//os:windows", "@platforms//os:windows",
"@platforms//cpu:x86_32", "@platforms//cpu:x86_32",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
selects.config_setting_group( selects.config_setting_group(
@ -158,6 +188,9 @@ selects.config_setting_group(
config_setting( config_setting(
name = "windows_x86_64_release", name = "windows_x86_64_release",
flag_values = {
"@com_google_protobuf//toolchain:release": "True",
},
values = {"cpu": "win64"}, values = {"cpu": "win64"},
) )
@ -167,6 +200,9 @@ config_setting(
"@platforms//os:windows", "@platforms//os:windows",
"@platforms//cpu:x86_64", "@platforms//cpu:x86_64",
], ],
flag_values = {
"@com_google_protobuf//toolchain:release": "False",
},
) )
selects.config_setting_group( selects.config_setting_group(

Loading…
Cancel
Save