From 5ee24d166232d086af9ce35498cc18419bc886ac Mon Sep 17 00:00:00 2001 From: Sebastian Schmidt Date: Tue, 19 Dec 2023 09:17:17 -0800 Subject: [PATCH] Expose MediaPipe's ABSL and Sentencepiece as shared dependencies PiperOrigin-RevId: 592256006 --- WORKSPACE | 30 +++++++++++++++++++++++--- third_party/BUILD | 5 +---- third_party/shared_dependencies.bzl | 33 ----------------------------- 3 files changed, 28 insertions(+), 40 deletions(-) delete mode 100644 third_party/shared_dependencies.bzl diff --git a/WORKSPACE b/WORKSPACE index 922b2c102..3a539569f 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -21,9 +21,21 @@ bazel_skylib_workspace() load("@bazel_skylib//lib:versions.bzl", "versions") versions.check(minimum_bazel_version = "3.7.2") -load("@//third_party:shared_dependencies.bzl", "mediapipe_absl", "mediapipe_sentencepiece") -mediapipe_absl() -mediapipe_sentencepiece() +# ABSL cpp library lts_2023_01_25. +http_archive( + name = "com_google_absl", + urls = [ + "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.0.tar.gz", + ], + patches = [ + "@//third_party:com_google_absl_windows_patch.diff" + ], + patch_args = [ + "-p1", + ], + strip_prefix = "abseil-cpp-20230125.0", + sha256 = "3ea49a7d97421b88a8c48a0de16c16048e17725c7ec0f1d3ea2683a2a75adc21" +) http_archive( name = "rules_cc", @@ -229,6 +241,18 @@ http_archive( build_file = "@//third_party:pffft.BUILD", ) +# sentencepiece +http_archive( + name = "com_google_sentencepiece", + strip_prefix = "sentencepiece-0.1.96", + sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754", + urls = [ + "https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip" + ], + build_file = "@//third_party:sentencepiece.BUILD", + patches = ["@//third_party:com_google_sentencepiece.diff"], + patch_args = ["-p1"], +) http_archive( name = "darts_clone", diff --git a/third_party/BUILD b/third_party/BUILD index 3b8608cff..d784fc3cc 100644 --- a/third_party/BUILD +++ b/third_party/BUILD @@ -20,10 +20,7 @@ licenses(["notice"]) # Apache License 2.0 package(default_visibility = ["//visibility:public"]) -exports_files([ - "LICENSE", - "shared_dependencies.bzl", -]) +exports_files(["LICENSE"]) cc_library( name = "glog", diff --git a/third_party/shared_dependencies.bzl b/third_party/shared_dependencies.bzl deleted file mode 100644 index 6cd211a38..000000000 --- a/third_party/shared_dependencies.bzl +++ /dev/null @@ -1,33 +0,0 @@ -"""MediaPipe's shared dependencies that can be used by dependent projects. Includes build patches.""" - -load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") - -# ABSL cpp library lts_2023_01_25. -def mediapipe_absl(): - http_archive( - name = "com_google_absl", - urls = [ - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20230125.0.tar.gz", - ], - patches = [ - "@//third_party:com_google_absl_windows_patch.diff", - ], - patch_args = [ - "-p1", - ], - strip_prefix = "abseil-cpp-20230125.0", - sha256 = "3ea49a7d97421b88a8c48a0de16c16048e17725c7ec0f1d3ea2683a2a75adc21", - ) - -def mediapipe_sentencepiece(): - http_archive( - name = "com_google_sentencepiece", - strip_prefix = "sentencepiece-0.1.96", - sha256 = "8409b0126ebd62b256c685d5757150cf7fcb2b92a2f2b98efb3f38fc36719754", - urls = [ - "https://github.com/google/sentencepiece/archive/refs/tags/v0.1.96.zip", - ], - build_file = "@//third_party:sentencepiece.BUILD", - patches = ["@//third_party:com_google_sentencepiece.diff"], - patch_args = ["-p1"], - )