diff --git a/WORKSPACE b/WORKSPACE index c6de1ae70b..a524214d10 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -33,6 +33,12 @@ git_repository( remote = "https://github.com/bazelbuild/platforms.git", ) +git_repository( + name = "rules_proto", + tag = "5.3.0-21.7", + remote = "https://github.com/bazelbuild/rules_proto.git", +) + # ZLIB new_git_repository( name = "zlib", @@ -135,10 +141,13 @@ new_git_repository( ## Bazel Python rules. git_repository( name = "rules_python", - tag = "0.16.2", + tag = "0.20.0", remote = "https://github.com/bazelbuild/rules_python.git", ) +load("@rules_python//python:repositories.bzl", "py_repositories") +py_repositories() + # Create a central external repo, @ortools_deps, that contains Bazel targets for all the # third-party packages specified in the python_deps.txt file. load("@rules_python//python:pip.bzl", "pip_parse") diff --git a/ortools/linear_solver/BUILD.bazel b/ortools/linear_solver/BUILD.bazel index 2a89981456..6e7d4b8344 100644 --- a/ortools/linear_solver/BUILD.bazel +++ b/ortools/linear_solver/BUILD.bazel @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@rules_cc//cc:defs.bzl", "cc_proto_library") +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_python//python:proto.bzl", "py_proto_library") load("@bazel_skylib//rules:copy_file.bzl", "copy_file") -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") package(default_visibility = ["//visibility:public"]) @@ -57,9 +58,8 @@ cc_proto_library( py_proto_library( name = "linear_solver_py_pb2", - srcs = ["linear_solver.proto"], + deps = [":linear_solver_proto"], visibility = ["//visibility:public"], - deps = ["//ortools/util:optional_boolean_py_pb2"], ) # You can include the interfaces to different solvers by invoking '--define' @@ -153,7 +153,7 @@ cc_library( "//ortools/util:fp_utils", "//ortools/util:lazy_mutable_copy", ] + select({ - ":with_glpk": ["@glpk//:glpk", + ":with_glpk": ["@glpk//:glpk", "//ortools/glpk:glpk_env_deleter"], "//conditions:default": [], }), diff --git a/ortools/sat/BUILD.bazel b/ortools/sat/BUILD.bazel index 2a2ceebb67..bcbd1a45bd 100644 --- a/ortools/sat/BUILD.bazel +++ b/ortools/sat/BUILD.bazel @@ -14,8 +14,9 @@ # Home of CP/SAT solver (which includes SAT, max-SAT and PB problems). # -load("@rules_cc//cc:defs.bzl", "cc_proto_library") -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") +load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library") +load("@rules_proto//proto:defs.bzl", "proto_library") +load("@rules_python//python:proto.bzl", "py_proto_library") load("@rules_java//java:defs.bzl", "java_proto_library") package( @@ -34,8 +35,8 @@ cc_proto_library( py_proto_library( name = "sat_parameters_py_pb2", - srcs = ["sat_parameters.proto"], visibility = ["//visibility:public"], + deps = [":sat_parameters_proto"], ) java_proto_library( @@ -66,8 +67,8 @@ cc_proto_library( py_proto_library( name = "cp_model_py_pb2", - srcs = ["cp_model.proto"], visibility = ["//visibility:public"], + deps = [":cp_model_proto"], ) java_proto_library( diff --git a/ortools/util/BUILD.bazel b/ortools/util/BUILD.bazel index d2a5241f5f..44d84d3bc9 100644 --- a/ortools/util/BUILD.bazel +++ b/ortools/util/BUILD.bazel @@ -12,7 +12,7 @@ # limitations under the License. load("@rules_cc//cc:defs.bzl", "cc_proto_library") -load("@com_google_protobuf//:protobuf.bzl", "py_proto_library") +load("@rules_python//python:proto.bzl", "py_proto_library") package(default_visibility = ["//visibility:public"]) @@ -339,8 +339,8 @@ cc_proto_library( py_proto_library( name = "optional_boolean_py_pb2", - srcs = ["optional_boolean.proto"], visibility = ["//visibility:public"], + deps = [":optional_boolean_proto"], ) cc_library(