From ef13f51037a5adb6313fe25205adabe9674b9803 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 22 Jan 2025 13:53:03 +0100 Subject: [PATCH 1/6] algorithms: use absl::string_view --- ortools/algorithms/set_cover_solve.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/ortools/algorithms/set_cover_solve.cc b/ortools/algorithms/set_cover_solve.cc index c9433d3fa3..cd8c53d074 100644 --- a/ortools/algorithms/set_cover_solve.cc +++ b/ortools/algorithms/set_cover_solve.cc @@ -18,6 +18,7 @@ #include "absl/log/check.h" #include "absl/strings/match.h" #include "absl/strings/str_join.h" +#include "absl/strings/string_view.h" #include "absl/time/time.h" #include "ortools/algorithms/set_cover_heuristics.h" #include "ortools/algorithms/set_cover_invariant.h" @@ -141,8 +142,7 @@ FileFormat ParseFileFormat(const std::string& format_name) { } } -SetCoverModel ReadModel(const std::string& input_file, - FileFormat input_format) { +SetCoverModel ReadModel(absl::string_view input_file, FileFormat input_format) { switch (input_format) { case FileFormat::ORLIB_SCP: return ReadOrlibScp(input_file); @@ -160,7 +160,7 @@ SetCoverModel ReadModel(const std::string& input_file, } } -SubsetBoolVector ReadSolution(const std::string& input_file, +SubsetBoolVector ReadSolution(absl::string_view input_file, FileFormat input_format) { switch (input_format) { case FileFormat::TXT: @@ -175,7 +175,7 @@ SubsetBoolVector ReadSolution(const std::string& input_file, } } -void WriteModel(const SetCoverModel& model, const std::string& output_file, +void WriteModel(const SetCoverModel& model, absl::string_view output_file, FileFormat output_format) { switch (output_format) { case FileFormat::ORLIB_SCP: @@ -197,7 +197,7 @@ void WriteModel(const SetCoverModel& model, const std::string& output_file, } void WriteSolution(const SetCoverModel& model, const SubsetBoolVector& solution, - const std::string& output_file, FileFormat output_format) { + absl::string_view output_file, FileFormat output_format) { switch (output_format) { case FileFormat::TXT: WriteSetCoverSolutionText(model, solution, output_file); From 6f48941686b4c86b1be49cf089a316cf11c7db33 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 22 Jan 2025 13:53:19 +0100 Subject: [PATCH 2/6] bazel: backport cleanup from main --- .bazelrc | 3 +++ MODULE.bazel | 2 +- ortools/math_opt/core/python/BUILD.bazel | 4 ++-- ortools/math_opt/io/python/BUILD.bazel | 4 ++-- patches/BUILD.bazel | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.bazelrc b/.bazelrc index 94434ccb95..c50ba9a2c9 100644 --- a/.bazelrc +++ b/.bazelrc @@ -1,3 +1,6 @@ +# Enable logging rc options. +common --announce_rc + # ----CONFIG OPTIONS---- build --flag_alias=with_bop=//ortools/linear_solver:with_bop build --flag_alias=with_cbc=//ortools/linear_solver:with_cbc diff --git a/MODULE.bazel b/MODULE.bazel index 975b96bb3a..3ed5c803b2 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -26,7 +26,7 @@ bazel_dep(name = "googletest", version = "1.15.2", repo_name = "com_google_googl bazel_dep(name = "highs", version = "1.9.0") bazel_dep(name = "platforms", version = "0.0.10") bazel_dep(name = "protobuf", version = "29.2", repo_name = "com_google_protobuf") -bazel_dep(name = "pybind11_abseil", version = "202402.0", repo_name = "org_pybind11_abseil") +bazel_dep(name = "pybind11_abseil", version = "202402.0") bazel_dep(name = "pybind11_bazel", version = "2.13.6") bazel_dep(name = "pybind11_protobuf", version = "0.0.0-20240524-1d7a729") bazel_dep(name = "re2", version = "2024-07-02", repo_name = "com_google_re2") diff --git a/ortools/math_opt/core/python/BUILD.bazel b/ortools/math_opt/core/python/BUILD.bazel index 4e9684d52d..672dc04129 100644 --- a/ortools/math_opt/core/python/BUILD.bazel +++ b/ortools/math_opt/core/python/BUILD.bazel @@ -52,8 +52,8 @@ pybind_extension( "//ortools/util:solve_interrupter", "@com_google_absl//absl/memory", "@com_google_absl//absl/status:statusor", - "@org_pybind11_abseil//pybind11_abseil:import_status_module", - "@org_pybind11_abseil//pybind11_abseil:status_casters", + "@pybind11_abseil//pybind11_abseil:import_status_module", + "@pybind11_abseil//pybind11_abseil:status_casters", "@pybind11_protobuf//pybind11_protobuf:native_proto_caster", ], ) diff --git a/ortools/math_opt/io/python/BUILD.bazel b/ortools/math_opt/io/python/BUILD.bazel index 9355182f92..4ad0abe9da 100644 --- a/ortools/math_opt/io/python/BUILD.bazel +++ b/ortools/math_opt/io/python/BUILD.bazel @@ -25,8 +25,8 @@ pybind_extension( "//ortools/math_opt:model_update_cc_proto", "//ortools/math_opt:result_cc_proto", "//ortools/math_opt/io:mps_converter", - "@org_pybind11_abseil//pybind11_abseil:import_status_module", - "@org_pybind11_abseil//pybind11_abseil:status_casters", + "@pybind11_abseil//pybind11_abseil:import_status_module", + "@pybind11_abseil//pybind11_abseil:status_casters", "@pybind11_protobuf//pybind11_protobuf:native_proto_caster", ], ) diff --git a/patches/BUILD.bazel b/patches/BUILD.bazel index e871020ed9..32ceb218fa 100644 --- a/patches/BUILD.bazel +++ b/patches/BUILD.bazel @@ -13,7 +13,7 @@ exports_files([ "abseil-cpp-20240722.0.patch", - "highs-v1.8.1.patch", + "highs-v1.9.0.patch", "protobuf-v29.2.patch", "pybind11_abseil.patch", "pybind11_protobuf.patch", From 210ccab7e8349b35c6c672aad1ec864443dd523d Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 22 Jan 2025 15:13:24 +0100 Subject: [PATCH 3/6] swig: bump to 4.3.0 in various scripts and docker --- cmake/dependencies/SWIG.CMakeLists.txt.in | 2 +- cmake/docker/almalinux/Dockerfile | 12 ++++++------ cmake/docker/rockylinux/Dockerfile | 12 ++++++------ tools/docker/images/almalinux-9.Dockerfile | 12 ++++++------ tools/docker/images/rockylinux-9.Dockerfile | 12 ++++++------ 5 files changed, 25 insertions(+), 25 deletions(-) diff --git a/cmake/dependencies/SWIG.CMakeLists.txt.in b/cmake/dependencies/SWIG.CMakeLists.txt.in index 89be36cb37..6addbea38c 100644 --- a/cmake/dependencies/SWIG.CMakeLists.txt.in +++ b/cmake/dependencies/SWIG.CMakeLists.txt.in @@ -11,7 +11,7 @@ ExternalProject_Add(SWIG_project SOURCE_DIR "@CMAKE_CURRENT_BINARY_DIR@/${PROJECT_NAME}/source" BUILD_IN_SOURCE 1 - URL "http://prdownloads.sourceforge.net/swig/swigwin-4.2.1.zip" + URL "http://prdownloads.sourceforge.net/swig/swigwin-4.3.0.zip" LOG_DOWNLOAD TRUE UPDATE_COMMAND "" diff --git a/cmake/docker/almalinux/Dockerfile b/cmake/docker/almalinux/Dockerfile index aa079b289e..96992677ae 100644 --- a/cmake/docker/almalinux/Dockerfile +++ b/cmake/docker/almalinux/Dockerfile @@ -11,18 +11,18 @@ RUN dnf -y update \ && rm -rf /var/cache/dnf CMD [ "/usr/bin/bash" ] -# Install SWIG 4.2.1 +# Install SWIG 4.3.0 FROM base AS swig RUN dnf -y update \ && dnf -y install pcre2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf \ -&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \ -&& tar xvf swig-4.2.1.tar.gz \ -&& rm swig-4.2.1.tar.gz \ -&& cd swig-4.2.1 \ +&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.3.0/swig-4.3.0.tar.gz" \ +&& tar xvf swig-4.3.0.tar.gz \ +&& rm swig-4.3.0.tar.gz \ +&& cd swig-4.3.0 \ && ./configure --prefix=/usr \ && make -j 4 \ && make install \ && cd .. \ -&& rm -rf swig-4.2.1 +&& rm -rf swig-4.3.0 diff --git a/cmake/docker/rockylinux/Dockerfile b/cmake/docker/rockylinux/Dockerfile index 40e9397764..70a6deeb17 100644 --- a/cmake/docker/rockylinux/Dockerfile +++ b/cmake/docker/rockylinux/Dockerfile @@ -11,18 +11,18 @@ RUN dnf -y update \ && rm -rf /var/cache/dnf CMD [ "/usr/bin/bash" ] -# Install SWIG 4.2.1 +# Install SWIG 4.3.0 FROM base AS swig RUN dnf -y update \ && dnf -y install pcre2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf \ -&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \ -&& tar xvf swig-4.2.1.tar.gz \ -&& rm swig-4.2.1.tar.gz \ -&& cd swig-4.2.1 \ +&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.3.0/swig-4.3.0.tar.gz" \ +&& tar xvf swig-4.3.0.tar.gz \ +&& rm swig-4.3.0.tar.gz \ +&& cd swig-4.3.0 \ && ./configure --prefix=/usr \ && make -j 4 \ && make install \ && cd .. \ -&& rm -rf swig-4.2.1 +&& rm -rf swig-4.3.0 diff --git a/tools/docker/images/almalinux-9.Dockerfile b/tools/docker/images/almalinux-9.Dockerfile index 35dbc409b9..c20d3b77ab 100644 --- a/tools/docker/images/almalinux-9.Dockerfile +++ b/tools/docker/images/almalinux-9.Dockerfile @@ -13,20 +13,20 @@ RUN dnf -y update \ ENTRYPOINT ["/usr/bin/bash", "-c"] CMD ["/usr/bin/bash"] -# Install SWIG 4.2.1 +# Install SWIG 4.3.0 RUN dnf -y update \ && dnf -y install pcre2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf \ -&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \ -&& tar xvf swig-4.2.1.tar.gz \ -&& rm swig-4.2.1.tar.gz \ -&& cd swig-4.2.1 \ +&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.3.0/swig-4.3.0.tar.gz" \ +&& tar xvf swig-4.3.0.tar.gz \ +&& rm swig-4.3.0.tar.gz \ +&& cd swig-4.3.0 \ && ./configure --prefix=/usr \ && make -j 4 \ && make install \ && cd .. \ -&& rm -rf swig-4.2.1 +&& rm -rf swig-4.3.0 # Install .Net # see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install diff --git a/tools/docker/images/rockylinux-9.Dockerfile b/tools/docker/images/rockylinux-9.Dockerfile index 841427f044..f84ab889de 100644 --- a/tools/docker/images/rockylinux-9.Dockerfile +++ b/tools/docker/images/rockylinux-9.Dockerfile @@ -13,20 +13,20 @@ RUN dnf -y update \ ENTRYPOINT ["/usr/bin/bash", "-c"] CMD ["/usr/bin/bash"] -# Install SWIG 4.2.1 +# Install SWIG 4.3.0 RUN dnf -y update \ && dnf -y install pcre2-devel \ && dnf clean all \ && rm -rf /var/cache/dnf \ -&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.2.1/swig-4.2.1.tar.gz" \ -&& tar xvf swig-4.2.1.tar.gz \ -&& rm swig-4.2.1.tar.gz \ -&& cd swig-4.2.1 \ +&& wget -q "https://downloads.sourceforge.net/project/swig/swig/swig-4.3.0/swig-4.3.0.tar.gz" \ +&& tar xvf swig-4.3.0.tar.gz \ +&& rm swig-4.3.0.tar.gz \ +&& cd swig-4.3.0 \ && ./configure --prefix=/usr \ && make -j 4 \ && make install \ && cd .. \ -&& rm -rf swig-4.2.1 +&& rm -rf swig-4.3.0 # Install .Net # see: https://learn.microsoft.com/en-us/dotnet/core/install/linux-scripted-manual#scripted-install From e4b5fa5b6a9457888b7c52385d1237cb16a16e93 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Wed, 22 Jan 2025 15:15:40 +0100 Subject: [PATCH 4/6] tools/release: fix comment --- tools/release/amd64.Dockerfile | 2 +- tools/release/arm64.Dockerfile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/release/amd64.Dockerfile b/tools/release/amd64.Dockerfile index badba105ee..58f2d2a174 100644 --- a/tools/release/amd64.Dockerfile +++ b/tools/release/amd64.Dockerfile @@ -3,7 +3,7 @@ #FROM quay.io/pypa/manylinux2014_x86_64:latest AS env # Use dnf FROM quay.io/pypa/manylinux_2_28_x86_64:latest AS env -# note: CMake 3.30.5 and SWIG 4.2.1 are already installed +# note: CMake 3.31.2 and SWIG 4.3.0 are already installed ############# ## SETUP ## diff --git a/tools/release/arm64.Dockerfile b/tools/release/arm64.Dockerfile index 1c8b1e1462..d04bd506ac 100644 --- a/tools/release/arm64.Dockerfile +++ b/tools/release/arm64.Dockerfile @@ -6,7 +6,7 @@ #FROM quay.io/pypa/manylinux2014_aarch64:latest AS env # Use dnf FROM quay.io/pypa/manylinux_2_28_aarch64:latest AS env -# note: CMake 3.30.5 and SWIG 4.2.1 are already installed +# note: CMake 3.31.2 and SWIG 4.3.0 are already installed ############# ## SETUP ## From 09be9a9815e04ff960f56596699f7abdc83a75a3 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 24 Jan 2025 02:20:20 -0800 Subject: [PATCH 5/6] cmake: fix model_build_helper.pyi on windows (#4512) --- cmake/python.cmake | 3 ++- ortools/python/__init__.py.in | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cmake/python.cmake b/cmake/python.cmake index a72a2df5c3..c77a622a1b 100644 --- a/cmake/python.cmake +++ b/cmake/python.cmake @@ -550,8 +550,9 @@ add_custom_command( ${PYTHON_PROJECT}/.libs COMMAND ${CMAKE_COMMAND} -E - $ + $,copy,true> $<${need_unix_re2_lib}:$> + $<${need_windows_re2_lib}:$> ${PYTHON_PROJECT}/.libs COMMAND ${CMAKE_COMMAND} -E diff --git a/ortools/python/__init__.py.in b/ortools/python/__init__.py.in index 8eed3a3e5c..c4e01a15cd 100644 --- a/ortools/python/__init__.py.in +++ b/ortools/python/__init__.py.in @@ -55,7 +55,7 @@ def _load_ortools_libs(): except: pass else: - for dll in ["zlib1.dll", "abseil_dll.dll", "utf8_validity.dll", "libprotobuf.dll", "highs.dll"]: + for dll in ["zlib1.dll", "abseil_dll.dll", "utf8_validity.dll", "re2.dll", "libprotobuf.dll", "highs.dll"]: dll_path = os.path.join(basedir, ".libs", dll) if os.path.exists(dll_path): print(f"load {dll_path}...") From 217a71169c3e7d5207aadf53cb7aae75916e5b20 Mon Sep 17 00:00:00 2001 From: Corentin Le Molgat Date: Fri, 24 Jan 2025 02:21:28 -0800 Subject: [PATCH 6/6] tools/release: Check set_cover.pyi in build_delivery_win.cmd --- tools/release/build_delivery_win.cmd | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/release/build_delivery_win.cmd b/tools/release/build_delivery_win.cmd index a5638aaf6c..461954935a 100644 --- a/tools/release/build_delivery_win.cmd +++ b/tools/release/build_delivery_win.cmd @@ -300,6 +300,7 @@ FOR %%v IN (8 9 10 11 12 13) DO ( echo Check MYPY files... | tee.exe -a build.log FOR %%m IN ( ortools\algorithms\python\knapsack_solver.pyi + ortools\algorithms\python\set_cover.pyi ortools\constraint_solver\pywrapcp.pyi ortools\graph\python\linear_sum_assignment.pyi ortools\graph\python\max_flow.pyi