diff options
author | Samuel Freilich <sfreilich@google.com> | 2022-03-04 13:42:59 -0800 |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-03-04 13:43:27 -0800 |
commit | f810c5053f7e3c299be116080e1595ce40df3785 (patch) | |
tree | ce20fb6b3bb99479e1df553e630ab526ad04d4c6 | |
parent | 8628205a2c2ff704f89f8d9cbab05e8732d4a480 (diff) | |
download | ink-stroke-modeler-f810c5053f7e3c299be116080e1595ce40df3785.tar.gz |
Factor out dependency setup into workspace.bzl so that can be used by consumers
PiperOrigin-RevId: 432522663
-rw-r--r-- | WORKSPACE | 19 | ||||
-rw-r--r-- | workspace.bzl | 70 |
2 files changed, 72 insertions, 17 deletions
@@ -12,20 +12,5 @@ # See the License for the specific language governing permissions and # limitations under the License. -load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") - -git_repository( - name = "com_google_absl", - remote = "https://github.com/abseil/abseil-cpp.git", - # tag = "20211102.0", - commit = "215105818dfde3174fe799600bb0f3cae233d0bf", - shallow_since = "1635953174 -0400" -) - -git_repository( - name = "com_google_googletest", - remote = "https://github.com/google/googletest.git", - # tag = "release-1.11.0", - commit = "e2239ee6043f73722e7aa812a459f54a28552929", - shallow_since = "1623433346 -0700" -) +load(":workspace.bzl", "ink_stroke_modeler_workspace") +ink_stroke_modeler_workspace() diff --git a/workspace.bzl b/workspace.bzl new file mode 100644 index 0000000..00fc679 --- /dev/null +++ b/workspace.bzl @@ -0,0 +1,70 @@ +# Copyright 2022 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Set up dependencies for Ink Stroke Modeler. + +To use this from a consumer, add the following to your WORKSPACE setup: + +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") + +# https://bazel.build/rules/lib/repo/git#git_repository +git_repository( + name = "ink_stroke_modeler", + remote = "https://github.com/google/ink-stroke-modeler.git", + branch = "main", +) +load("@ink_stroke_modeler//:workspace.bzl", "ink_stroke_modeler_workspace") +ink_stroke_modeler_workspace() + +If you want to make it possible for your consumer to be consumed by other +Bazel projects, factor that setup into a workspace.bzl file, following +the pattern below. + +If you want to use a local version of this repo instead, use local_repository +instead of git_repository: + +# https://bazel.build/reference/be/workspace#local_repository +local_repository( + name = "ink_stroke_modeler", + path = "path/to/ink-stroke-modeler", +) + +Ink Stroke Modeler requires C++17. This is not currently the default for Bazel, +--cxxopt='-std=c++17' (or newer) is required. You can put the following in +.bazelrc at your project's root: + +build --cxxopt='-std=c++17' +""" + +load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") +load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") + +def ink_stroke_modeler_workspace(): + maybe( + git_repository, + name = "com_google_absl", + remote = "https://github.com/abseil/abseil-cpp.git", + # tag = "20211102.0", + commit = "215105818dfde3174fe799600bb0f3cae233d0bf", + shallow_since = "1635953174 -0400", + ) + + maybe( + git_repository, + name = "com_google_googletest", + remote = "https://github.com/google/googletest.git", + # tag = "release-1.11.0", + commit = "e2239ee6043f73722e7aa812a459f54a28552929", + shallow_since = "1623433346 -0700", + ) |