From 535d769fcb2f17d8a969e20867763481e69212d6 Mon Sep 17 00:00:00 2001 From: Mautisim Munir Date: Sun, 9 Oct 2022 13:32:06 +0500 Subject: [PATCH] added android toolchain in workspace from ease of use --- WORKSPACE | 208 +++++++++++++++++++++++++++++++----------------------- 1 file changed, 119 insertions(+), 89 deletions(-) diff --git a/WORKSPACE b/WORKSPACE index d3cc40fbe..82d3c12b3 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -10,46 +10,50 @@ bind( http_archive( name = "bazel_skylib", + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", type = "tar.gz", urls = [ "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz", ], - sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", ) + load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace") + bazel_skylib_workspace() + load("@bazel_skylib//lib:versions.bzl", "versions") + versions.check(minimum_bazel_version = "3.7.2") # ABSL cpp library lts_2021_03_24, patch 2. http_archive( name = "com_google_absl", - urls = [ - "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.2.tar.gz", - ], - # Remove after https://github.com/abseil/abseil-cpp/issues/326 is solved. - patches = [ - "@//third_party:com_google_absl_f863b622fe13612433fdf43f76547d5edda0c93001.diff" - ], patch_args = [ "-p1", ], + # Remove after https://github.com/abseil/abseil-cpp/issues/326 is solved. + patches = [ + "@//third_party:com_google_absl_f863b622fe13612433fdf43f76547d5edda0c93001.diff", + ], + sha256 = "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f", strip_prefix = "abseil-cpp-20210324.2", - sha256 = "59b862f50e710277f8ede96f083a5bb8d7c9595376146838b9580be90374ee1f" + urls = [ + "https://github.com/abseil/abseil-cpp/archive/refs/tags/20210324.2.tar.gz", + ], ) http_archive( name = "rules_cc", strip_prefix = "rules_cc-2f8c04c04462ab83c545ab14c0da68c3b4c96191", -# The commit can be updated if the build passes. Last updated 6/23/22. + # The commit can be updated if the build passes. Last updated 6/23/22. urls = ["https://github.com/bazelbuild/rules_cc/archive/2f8c04c04462ab83c545ab14c0da68c3b4c96191.zip"], ) http_archive( - name = "rules_foreign_cc", - strip_prefix = "rules_foreign_cc-0.1.0", - url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip", + name = "rules_foreign_cc", + strip_prefix = "rules_foreign_cc-0.1.0", + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.1.0.zip", ) load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") @@ -63,67 +67,68 @@ all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//v # Last updated 2021-07-02. http_archive( name = "com_google_googletest", - urls = ["https://github.com/google/googletest/archive/4ec4cd23f486bf70efcc5d2caa40f24368f752e3.zip"], - strip_prefix = "googletest-4ec4cd23f486bf70efcc5d2caa40f24368f752e3", sha256 = "de682ea824bfffba05b4e33b67431c247397d6175962534305136aa06f92e049", + strip_prefix = "googletest-4ec4cd23f486bf70efcc5d2caa40f24368f752e3", + urls = ["https://github.com/google/googletest/archive/4ec4cd23f486bf70efcc5d2caa40f24368f752e3.zip"], ) # Google Benchmark library v1.6.1 released on 2022-01-10. http_archive( name = "com_google_benchmark", - urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.6.1.tar.gz"], - strip_prefix = "benchmark-1.6.1", - sha256 = "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4", build_file = "@//third_party:benchmark.BUILD", + sha256 = "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4", + strip_prefix = "benchmark-1.6.1", + urls = ["https://github.com/google/benchmark/archive/refs/tags/v1.6.1.tar.gz"], ) # gflags needed by glog http_archive( name = "com_github_gflags_gflags", - strip_prefix = "gflags-2.2.2", sha256 = "19713a36c9f32b33df59d1c79b4958434cb005b5b47dc5400a7a4b078111d9b5", + strip_prefix = "gflags-2.2.2", url = "https://github.com/gflags/gflags/archive/v2.2.2.zip", ) # 2020-08-21 http_archive( name = "com_github_glog_glog", - strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6", sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab", + strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6", urls = [ "https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip", ], ) + http_archive( name = "com_github_glog_glog_no_gflags", - strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6", - sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab", build_file = "@//third_party:glog_no_gflags.BUILD", - urls = [ - "https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip", + patch_args = [ + "-p1", ], patches = [ "@//third_party:com_github_glog_glog_9779e5ea6ef59562b030248947f787d1256132ae.diff", ], - patch_args = [ - "-p1", + sha256 = "58c9b3b6aaa4dd8b836c0fd8f65d0f941441fb95e27212c5eeb9979cfd3592ab", + strip_prefix = "glog-0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6", + urls = [ + "https://github.com/google/glog/archive/0a2e5931bd5ff22fd3bf8999eb8ce776f159cda6.zip", ], ) # easyexif http_archive( name = "easyexif", - url = "https://github.com/mayanklahiri/easyexif/archive/master.zip", - strip_prefix = "easyexif-master", build_file = "@//third_party:easyexif.BUILD", + strip_prefix = "easyexif-master", + url = "https://github.com/mayanklahiri/easyexif/archive/master.zip", ) # libyuv http_archive( name = "libyuv", + build_file = "@//third_party:libyuv.BUILD", # Error: operand type mismatch for `vbroadcastss' caused by commit 8a13626e42f7fdcf3a6acbb0316760ee54cda7d8. urls = ["https://chromium.googlesource.com/libyuv/libyuv/+archive/2525698acba9bf9b701ba6b4d9584291a1f62257.tar.gz"], - build_file = "@//third_party:libyuv.BUILD", ) # Note: protobuf-javalite is no longer released as a separate download, it's included in the main Java download. @@ -137,18 +142,19 @@ http_archive( http_archive( name = "com_google_protobuf", - sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422", - strip_prefix = "protobuf-3.19.1", - urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"], - patches = [ - "@//third_party:com_google_protobuf_fixes.diff" - ], patch_args = [ "-p1", ], + patches = [ + "@//third_party:com_google_protobuf_fixes.diff", + ], + sha256 = "87407cd28e7a9c95d9f61a098a53cf031109d451a7763e7dd1253abf8b4df422", + strip_prefix = "protobuf-3.19.1", + urls = ["https://github.com/protocolbuffers/protobuf/archive/v3.19.1.tar.gz"], ) load("//third_party/flatbuffers:workspace.bzl", flatbuffers = "repo") + flatbuffers() http_archive( @@ -160,27 +166,27 @@ http_archive( # sentencepiece http_archive( name = "com_google_sentencepiece", - strip_prefix = "sentencepiece-1.0.0", + repo_mapping = {"@com_google_glog": "@com_github_glog_glog"}, sha256 = "c05901f30a1d0ed64cbcf40eba08e48894e1b0e985777217b7c9036cac631346", + strip_prefix = "sentencepiece-1.0.0", urls = [ "https://github.com/google/sentencepiece/archive/1.0.0.zip", ], - repo_mapping = {"@com_google_glog" : "@com_github_glog_glog"}, ) http_archive( name = "org_tensorflow_text", + patch_args = ["-p1"], + patches = [ + "//third_party:tensorflow_text_remove_tf_deps.diff", + "//third_party:tensorflow_text_a0f49e63.diff", + ], + repo_mapping = {"@com_google_re2": "@com_googlesource_code_re2"}, sha256 = "f64647276f7288d1b1fe4c89581d51404d0ce4ae97f2bcc4c19bd667549adca8", strip_prefix = "text-2.2.0", urls = [ "https://github.com/tensorflow/text/archive/v2.2.0.zip", ], - patches = [ - "//third_party:tensorflow_text_remove_tf_deps.diff", - "//third_party:tensorflow_text_a0f49e63.diff", - ], - patch_args = ["-p1"], - repo_mapping = {"@com_google_re2": "@com_googlesource_code_re2"}, ) http_archive( @@ -195,20 +201,20 @@ http_archive( # 2020-07-09 http_archive( name = "pybind11_bazel", + sha256 = "75922da3a1bdb417d820398eb03d4e9bd067c4905a4246d35a44c01d62154d91", strip_prefix = "pybind11_bazel-203508e14aab7309892a1c5f7dd05debda22d9a5", urls = ["https://github.com/pybind/pybind11_bazel/archive/203508e14aab7309892a1c5f7dd05debda22d9a5.zip"], - sha256 = "75922da3a1bdb417d820398eb03d4e9bd067c4905a4246d35a44c01d62154d91", ) # Point to the commit that deprecates the usage of Eigen::MappedSparseMatrix. http_archive( name = "pybind11", + build_file = "@pybind11_bazel//:pybind11.BUILD", + sha256 = "b971842fab1b5b8f3815a2302331782b7d137fef0e06502422bc4bc360f4956c", + strip_prefix = "pybind11-70a58c577eaf067748c2ec31bfd0b0a614cffba6", urls = [ "https://github.com/pybind/pybind11/archive/70a58c577eaf067748c2ec31bfd0b0a614cffba6.zip", ], - sha256 = "b971842fab1b5b8f3815a2302331782b7d137fef0e06502422bc4bc360f4956c", - strip_prefix = "pybind11-70a58c577eaf067748c2ec31bfd0b0a614cffba6", - build_file = "@pybind11_bazel//:pybind11.BUILD", ) http_archive( @@ -223,15 +229,15 @@ http_archive( # Point to the commit that deprecates the usage of Eigen::MappedSparseMatrix. http_archive( name = "ceres_solver", - url = "https://github.com/ceres-solver/ceres-solver/archive/123fba61cf2611a3c8bddc9d91416db26b10b558.zip", - patches = [ - "@//third_party:ceres_solver_compatibility_fixes.diff" - ], patch_args = [ "-p1", ], + patches = [ + "@//third_party:ceres_solver_compatibility_fixes.diff", + ], + sha256 = "8b7b16ceb363420e0fd499576daf73fa338adb0b1449f58bea7862766baa1ac7", strip_prefix = "ceres-solver-123fba61cf2611a3c8bddc9d91416db26b10b558", - sha256 = "8b7b16ceb363420e0fd499576daf73fa338adb0b1449f58bea7862766baa1ac7" + url = "https://github.com/ceres-solver/ceres-solver/archive/123fba61cf2611a3c8bddc9d91416db26b10b558.zip", ) http_archive( @@ -250,7 +256,7 @@ new_local_repository( new_local_repository( name = "linux_ffmpeg", build_file = "@//third_party:ffmpeg_linux.BUILD", - path = "/usr" + path = "/usr", ) new_local_repository( @@ -288,39 +294,39 @@ http_archive( # '-DBUILD_PROTOBUF=OFF -DBUILD_opencv_dnn=OFF'. http_archive( name = "ios_opencv", - sha256 = "7dd536d06f59e6e1156b546bd581523d8df92ce83440002885ec5abc06558de2", build_file = "@//third_party:opencv_ios.BUILD", + sha256 = "7dd536d06f59e6e1156b546bd581523d8df92ce83440002885ec5abc06558de2", type = "zip", url = "https://github.com/opencv/opencv/releases/download/3.2.0/opencv-3.2.0-ios-framework.zip", ) http_archive( name = "stblib", - strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58", - sha256 = "13a99ad430e930907f5611325ec384168a958bf7610e63e60e2fd8e7b7379610", - urls = ["https://github.com/nothings/stb/archive/b42009b3b9d4ca35bc703f5310eedc74f584be58.tar.gz"], build_file = "@//third_party:stblib.BUILD", - patches = [ - "@//third_party:stb_image_impl.diff" - ], patch_args = [ "-p1", ], + patches = [ + "@//third_party:stb_image_impl.diff", + ], + sha256 = "13a99ad430e930907f5611325ec384168a958bf7610e63e60e2fd8e7b7379610", + strip_prefix = "stb-b42009b3b9d4ca35bc703f5310eedc74f584be58", + urls = ["https://github.com/nothings/stb/archive/b42009b3b9d4ca35bc703f5310eedc74f584be58.tar.gz"], ) # iOS basic build deps. http_archive( name = "build_bazel_rules_apple", - sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2", - url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz", - patches = [ - # Bypass checking ios unit test runner when building MP ios applications. - "@//third_party:build_bazel_rules_apple_bypass_test_runner_check.diff" - ], patch_args = [ "-p1", ], + patches = [ + # Bypass checking ios unit test runner when building MP ios applications. + "@//third_party:build_bazel_rules_apple_bypass_test_runner_check.diff", + ], + sha256 = "77e8bf6fda706f420a55874ae6ee4df0c9d95da6c7838228b26910fc82eea5a2", + url = "https://github.com/bazelbuild/rules_apple/releases/download/0.32.0/rules_apple.0.32.0.tar.gz", ) load( @@ -341,7 +347,7 @@ http_archive( name = "build_bazel_apple_support", sha256 = "741366f79d900c11e11d8efd6cc6c66a31bfb2451178b58e0b5edc6f1db17b35", urls = [ - "https://github.com/bazelbuild/apple_support/releases/download/0.10.0/apple_support.0.10.0.tar.gz" + "https://github.com/bazelbuild/apple_support/releases/download/0.10.0/apple_support.0.10.0.tar.gz", ], ) @@ -356,21 +362,22 @@ apple_support_dependencies() http_archive( name = "google_toolbox_for_mac", - url = "https://github.com/google/google-toolbox-for-mac/archive/v2.2.1.zip", + build_file = "@//third_party:google_toolbox_for_mac.BUILD", sha256 = "e3ac053813c989a88703556df4dc4466e424e30d32108433ed6beaec76ba4fdc", strip_prefix = "google-toolbox-for-mac-2.2.1", - build_file = "@//third_party:google_toolbox_for_mac.BUILD", + url = "https://github.com/google/google-toolbox-for-mac/archive/v2.2.1.zip", ) # Maven dependencies. RULES_JVM_EXTERNAL_TAG = "4.0" + RULES_JVM_EXTERNAL_SHA = "31701ad93dbfe544d597dbe62c9a1fdd76d81d8a9150c2bf1ecf928ecdf97169" http_archive( name = "rules_jvm_external", - strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, sha256 = RULES_JVM_EXTERNAL_SHA, + strip_prefix = "rules_jvm_external-%s" % RULES_JVM_EXTERNAL_TAG, url = "https://github.com/bazelbuild/rules_jvm_external/archive/%s.zip" % RULES_JVM_EXTERNAL_TAG, ) @@ -409,13 +416,13 @@ maven_install( "junit:junit:4.12", "org.hamcrest:hamcrest-library:1.3", ], + fetch_sources = True, repositories = [ "https://maven.google.com", "https://dl.google.com/dl/android/maven2", "https://repo1.maven.org/maven2", "https://jcenter.bintray.com", ], - fetch_sources = True, version_conflict_policy = "pinned", ) @@ -435,60 +442,83 @@ http_archive( http_archive( name = "zlib", build_file = "//third_party:zlib.BUILD", + patch_args = [ + "-p1", + ], + patches = [ + "@//third_party:zlib.diff", + ], sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1", strip_prefix = "zlib-1.2.11", urls = [ "http://mirror.bazel.build/zlib.net/fossils/zlib-1.2.11.tar.gz", "http://zlib.net/fossils/zlib-1.2.11.tar.gz", # 2017-01-15 ], - patches = [ - "@//third_party:zlib.diff", - ], - patch_args = [ - "-p1", - ], ) # TensorFlow repo should always go after the other external dependencies. # TF on 2022-08-10. _TENSORFLOW_GIT_COMMIT = "af1d5bc4fbb66d9e6cc1cf89503014a99233583b" + _TENSORFLOW_SHA256 = "f85a5443264fc58a12d136ca6a30774b5bc25ceaf7d114d97f252351b3c3a2cb" + http_archive( name = "org_tensorflow", - urls = [ - "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, + patch_args = [ + "-p1", ], patches = [ "@//third_party:org_tensorflow_compatibility_fixes.diff", # Diff is generated with a script, don't update it manually. "@//third_party:org_tensorflow_custom_ops.diff", ], - patch_args = [ - "-p1", - ], - strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT, sha256 = _TENSORFLOW_SHA256, + strip_prefix = "tensorflow-%s" % _TENSORFLOW_GIT_COMMIT, + urls = [ + "https://github.com/tensorflow/tensorflow/archive/%s.tar.gz" % _TENSORFLOW_GIT_COMMIT, + ], ) load("@org_tensorflow//tensorflow:workspace3.bzl", "tf_workspace3") + tf_workspace3() + load("@org_tensorflow//tensorflow:workspace2.bzl", "tf_workspace2") + tf_workspace2() # Edge TPU http_archive( - name = "libedgetpu", - sha256 = "14d5527a943a25bc648c28a9961f954f70ba4d79c0a9ca5ae226e1831d72fe80", - strip_prefix = "libedgetpu-3164995622300286ef2bb14d7fdc2792dae045b7", - urls = [ - "https://github.com/google-coral/libedgetpu/archive/3164995622300286ef2bb14d7fdc2792dae045b7.tar.gz" - ], + name = "libedgetpu", + sha256 = "14d5527a943a25bc648c28a9961f954f70ba4d79c0a9ca5ae226e1831d72fe80", + strip_prefix = "libedgetpu-3164995622300286ef2bb14d7fdc2792dae045b7", + urls = [ + "https://github.com/google-coral/libedgetpu/archive/3164995622300286ef2bb14d7fdc2792dae045b7.tar.gz", + ], ) + load("@libedgetpu//:workspace.bzl", "libedgetpu_dependencies") + libedgetpu_dependencies() load("@coral_crosstool//:configure.bzl", "cc_crosstool") + cc_crosstool(name = "crosstool") load("//third_party:external_files.bzl", "external_files") + external_files() + +load("@build_bazel_rules_android//android:rules.bzl", "android_ndk_repository", "android_sdk_repository") + +android_sdk_repository( + name = "androidsdk", + build_tools_version = "30.0.3", + # path = "/Users/tj/Library/Android/sdk", # Path to Android SDK, optional if $ANDROID_HOME is set +) + +android_ndk_repository( + name = "androidndk", # Required. Name *must* be "androidndk". + api_level = 21, + # path = "/Users/tj/Library/Android/sdk/ndk/21.4.7075529", # Optional. Can be omitted if `ANDROID_NDK_HOME` environment variable is set. +)