Skip to content

Add or-tools modules#3832

Merged
meteorcloudy merged 4 commits into
bazelbuild:mainfrom
Mizux:or-tools
Mar 21, 2025
Merged

Add or-tools modules#3832
meteorcloudy merged 4 commits into
bazelbuild:mainfrom
Mizux:or-tools

Conversation

@Mizux

@Mizux Mizux commented Feb 19, 2025

Copy link
Copy Markdown
Contributor
  • Add google/or-tools v9.12

  • need the fix google/riegeli@0306789 (2024 September) only available in BCR version = "0.0.0-20241218-3385e3c" of riegeli.
    note: none version of fuzztest use it...
    git grep -A 1 "\bname = .*riegeli" | grep -v "\(modules\/riegeli\|--\)"

DevNote:

Gen patch between original or-tools v9.12 MODULE.bazel and custom MODULE.bazel:

pushd
cd modules/or-tools/9.12
meld patches/bazel.patch <$(diff -u ~/work/stable/MODULE.bazel MODULE.bazel)
popd

bazel run //tools:update_integrity or-tools
bazel run -- //tools:bcr_validation --check=or-tools@9.12

BCR use sha256sum encoded in base64 to make it boring to generate...

git archive --prefix=or-tools-9.12/ -o or-tools-9.12.tar.gz v9.12
sha256sum v9.12.tar.gz | cut -d' ' -f1 | xxd -r -p | base64

@bazel-io

Copy link
Copy Markdown
Member

Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (or-tools) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@Mizux Mizux force-pushed the or-tools branch 2 times, most recently from b8b0bb8 to c1a2d4d Compare February 19, 2025 10:21
Comment thread modules/or-tools/9.12/MODULE.bazel
@fmeum fmeum added the presubmit-auto-run Presubmit jobs will be triggered for new changes automatically without reviewer's approval label Feb 19, 2025
@bazel-io

Copy link
Copy Markdown
Member

Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (ortools) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@Mizux

Mizux commented Mar 5, 2025

Copy link
Copy Markdown
Contributor Author

PTAL

@hzeller

hzeller commented Mar 7, 2025

Copy link
Copy Markdown
Contributor

👍
Looks good. Using bazel_dep(name = "ortools", version = "9.12") with this pull request applied to the registry works for me.

Given that ortools is using a newer version of absl, it would probably be good to include a patch that inserts absl/log/vlog_is_on.h to all of the following
find . -name "*.cc" | xargs grep VLOG_IS_ON | awk -F: '{print $1}' | sort | uniq
... but it works for now and is probably more of a cleanup to implement upstream.

@Mizux

Mizux commented Mar 10, 2025

Copy link
Copy Markdown
Contributor Author

👍 Looks good. Using bazel_dep(name = "ortools", version = "9.12") with this pull request applied to the registry works for me.

Given that ortools is using a newer version of absl, it would probably be good to include a patch that inserts absl/log/vlog_is_on.h to all of the following find . -name "*.cc" | xargs grep VLOG_IS_ON | awk -F: '{print $1}' | sort | uniq ... but it works for now and is probably more of a cleanup to implement upstream.

git grep -l VLOG_IS_ON ?

EDIT: even better, cli to find files using VLOG_IS_ON but not including log/vlog_is_on.h
git grep -l VLOG_IS_ON | xargs grep -L "log/vlog_is_on_log.h"
ps: with a | wc -l I got 40 -_-

@hzeller

hzeller commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

git grep -l VLOG_IS_ON ?

#TIL that there is git grep :)

hzeller
hzeller previously approved these changes Mar 10, 2025

@hzeller hzeller left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hzeller

hzeller commented Mar 10, 2025

Copy link
Copy Markdown
Contributor

Not sure if my approval of a non-write-access person counts in any way, but I think this is a good first version to get into the BCR.

@meteorcloudy

Copy link
Copy Markdown
Member

@Mizux @hzeller Do you want to wait a bit for a new protobuf release so that you can use or-tools as the module name?
protocolbuffers/protobuf@3576a1f

Or we just go with ortools?

@Mizux

Mizux commented Mar 11, 2025

Copy link
Copy Markdown
Contributor Author

@Mizux @hzeller Do you want to wait a bit for a new protobuf release so that you can use or-tools as the module name? protocolbuffers/protobuf@3576a1f

Or we just go with ortools?

Discussing with @mering in off, I'll try to wait and revert this PR to or-tools naming (or building a duplicate/sibling for or-tools ?)
TLDR: longterm goal is to have or-tools package, if it take too much time to have a protobuf package version with a fix, then we may provide an ortools package in the mean time...

@hzeller

hzeller commented Mar 11, 2025

Copy link
Copy Markdown
Contributor

I am happy to wait for it to be possible to have a proper name with a dash or-tools.

@bazel-io bazel-io dismissed hzeller’s stale review March 11, 2025 17:51

Require module maintainers' approval for newly pushed changes.

@bazel-io

Copy link
Copy Markdown
Member

Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (or-tools, ortools) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@Mizux

Mizux commented Mar 11, 2025

Copy link
Copy Markdown
Contributor Author

Currently pushing "both" module (1 commit per module, have squashed previous commits), to check the CI
https://buildkite.com/bazel/bcr-presubmit/builds/11485

@meteorcloudy meteorcloudy changed the title Add ortools modules Add or-tools modules Mar 12, 2025
@meteorcloudy

Copy link
Copy Markdown
Member

Please rebase your branch to get the latest protobuf version

@meteorcloudy

Copy link
Copy Markdown
Member

@meteorcloudy

Copy link
Copy Markdown
Member

Or, upgrade rules_python to the latest version: bazel-contrib/rules_python@edfb4b3

@Mizux

Mizux commented Mar 21, 2025

Copy link
Copy Markdown
Contributor Author

Oh, looks like you still need to switch to use py_proto_library from protobuf: https://github.com/google/or-tools/blob/9b77015d9d7162b560b9e772c06ff262d2780844/ortools/constraint_solver/BUILD.bazel#L21 https://github.com/protocolbuffers/protobuf/blob/main/bazel/py_proto_library.bzl

yes and no: here we try to package the release 9.12 (basically snapshot of October 2024)
while our v99bugfix branch (incoming v9.13) and main do have the patch and also target abseil 202501 and soon protobuf 30.1

i.e. I don't see the point to pass hours to backport bazel patch only required for BCR while it should work for 9.13 out of the box + 9.12 build (CMake and bazel) and local BCR seems to work too...

devNote:
From v9.12 tag:

%git grep "load.*py_proto_library"
ortools/algorithms/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/bop/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/constraint_solver/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/glop/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/gscip/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/linear_solver/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/math_opt/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/math_opt/solvers/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/pdlp/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/sat/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/scheduling/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/service/v1/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/service/v1/mathopt/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")
ortools/util/BUILD.bazel:load("@rules_python//python:proto.bzl", "py_proto_library")

From v99bugfix or main

%git grep "load.*py_proto_library"
ortools/bop/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/constraint_solver/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/glop/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/gscip/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/linear_solver/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/math_opt/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/math_opt/solvers/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/pdlp/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/sat/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/scheduling/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/service/v1/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/service/v1/mathopt/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/set_cover/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")
ortools/util/BUILD.bazel:load("@com_google_protobuf//bazel:py_proto_library.bzl", "py_proto_library")

@mering

mering commented Mar 21, 2025

Copy link
Copy Markdown
Contributor

Can you upgrade rules_python to 1.2.0? Then it should redirect to py_proto_library from Protobuf which in 30.1 contains the fix.

Comment thread modules/or-tools/9.12/MODULE.bazel Outdated
@Mizux

Mizux commented Mar 21, 2025

Copy link
Copy Markdown
Contributor Author

Can you upgrade rules_python to 1.2.0? Then it should redirect to py_proto_library from Protobuf which in 30.1 contains the fix.

Yup the idea was to suppose rules_python was just an alias to Protobuf so using Protobuf v30.1 would fix the issue (until we migrate in the next release)...

seems now we have issue with riegeli upstream...

https://buildkite.com/bazel/bcr-presubmit/builds/11954

@meteorcloudy

Copy link
Copy Markdown
Member

Upgrading riegeli might help (although it's not your direct dependency)

bazel_dep(name = "riegeli", version = "0.0.0-20241218-3385e3c")

@Mizux

Mizux commented Mar 21, 2025

Copy link
Copy Markdown
Contributor Author

Upgrading riegeli might help (although it's not your direct dependency)

bazel_dep(name = "riegeli", version = "0.0.0-20241218-3385e3c")

Just found:
google/riegeli@0306789 (2024 September)

But the repo has zero release and tags... -_-

devNote: All fuzztest release borken 🙃

%git grep -A 1 "\bname = .*riegeli"
modules/distributed_point_functions/0.0.0/MODULE.bazel:    name = "riegeli",
modules/distributed_point_functions/0.0.0/MODULE.bazel-    version = "0.0.0-20240927-cdfb25a",
--
modules/fuzztest/20240813.0/MODULE.bazel:    name = "riegeli",
modules/fuzztest/20240813.0/MODULE.bazel-    version = "0.0.0-20240606-973b6f0",
--
modules/fuzztest/20240813.0/patches/update_module_bazel_version.patch:     name = "riegeli",
modules/fuzztest/20240813.0/patches/update_module_bazel_version.patch-     version = "0.0.0-20240606-973b6f0",
--
modules/fuzztest/20241028.0/MODULE.bazel:    name = "riegeli",
modules/fuzztest/20241028.0/MODULE.bazel-    version = "0.0.0-20240606-973b6f0",
--
modules/fuzztest/20250214.0/MODULE.bazel:    name = "riegeli",
modules/fuzztest/20250214.0/MODULE.bazel-    version = "0.0.0-20240606-973b6f0",
--

@meteorcloudy

Copy link
Copy Markdown
Member

But the repo has zero release and tags... -_-

Yes, that's why we have to make up a version number in BCR

Mizux and others added 4 commits March 21, 2025 16:00
* Add v9.12
* use -c opt in presubmit to avoid build failure.

note: BCR use sha256sum encoded in base64 to make it boring to generate...
```sh
sha256sum v9.12.tar.gz | cut -d' ' -f1 | xxd -r -p | base64
```
see if it fix the build
need fix:
google/riegeli@0306789 (2024 September)

devNote:
gen patch between v9.12 clone and custom MODULE.bazel
```sh
pushd
cd modules/or-tools/9.12
meld patches/bazel.patch <$(diff -u ~/work/stable/MODULE.bazel MODULE.bazel)
popd

bazel run //tools:update_integrity or-tools
bazel run -- //tools:bcr_validation --check=or-tools@9.12
```
@bazel-io

Copy link
Copy Markdown
Member

Hello @bazelbuild/bcr-maintainers, modules without existing maintainers (or-tools) have been updated in this PR.
Please review the changes. You can view a diff against the previous version in the "Generate module diff" check.

@Mizux

Mizux commented Mar 21, 2025

Copy link
Copy Markdown
Contributor Author
  • remove module ortools (only keep or-tools),
  • presubmit pass

=> Should be ready to merge !

@meteorcloudy meteorcloudy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@meteorcloudy meteorcloudy merged commit a00a52c into bazelbuild:main Mar 21, 2025
Mizux added a commit to google/or-tools that referenced this pull request Mar 24, 2025
filmil pushed a commit to filmil/bazel-central-registry that referenced this pull request Jun 23, 2025
* Add [google/or-tools
v9.12](https://github.com/google/or-tools/releases/tag/v9.12)

* need the fix google/riegeli@0306789 (2024 September) only available in
BCR version = "0.0.0-20241218-3385e3c" of riegeli.
note: none version of fuzztest use it...
`git grep -A 1 "\bname = .*riegeli" | grep -v
"\(modules\/riegeli\|--\)"`

## DevNote:

Gen patch between original or-tools `v9.12` MODULE.bazel and custom
MODULE.bazel:
```sh
pushd
cd modules/or-tools/9.12
meld patches/bazel.patch <$(diff -u ~/work/stable/MODULE.bazel MODULE.bazel)
popd

bazel run //tools:update_integrity or-tools
bazel run -- //tools:bcr_validation --check=or-tools@9.12
```
 
BCR use sha256sum encoded in base64 to make it boring to generate...
```sh
git archive --prefix=or-tools-9.12/ -o or-tools-9.12.tar.gz v9.12
sha256sum v9.12.tar.gz | cut -d' ' -f1 | xxd -r -p | base64
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

presubmit-auto-run Presubmit jobs will be triggered for new changes automatically without reviewer's approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants