Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[workspace] Deprecate the picosha2 external #19879

Merged
merged 1 commit into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion geometry/render_gltf_client/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ drake_cc_library(
"//geometry/render:render_camera",
"//geometry/render:render_engine",
"//systems/sensors:image",
"@picosha2",
"@picosha2_internal//:picosha2",
"@vtk//:vtkIOImage",
],
)
Expand Down
4 changes: 2 additions & 2 deletions multibody/parsing/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ drake_cc_library(
"//common:network_policy",
"//common:scope_exit",
"//common/yaml",
"@picosha2",
"@picosha2_internal//:picosha2",
"@tinyxml2_internal//:tinyxml2",
],
)
Expand Down Expand Up @@ -637,7 +637,7 @@ drake_cc_googletest(
"//common:find_resource",
"//common:scope_exit",
"//common/test_utilities:expect_throws_message",
"@picosha2",
"@picosha2_internal//:picosha2",
],
)

Expand Down
1 change: 1 addition & 0 deletions tools/workspace/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ _DRAKE_EXTERNAL_PACKAGE_INSTALLS = ["@%s//:install" % p for p in [
"nlopt_internal",
"org_apache_xmlgraphics_commons",
"petsc",
"picosha2_internal",
"pybind11",
"qhull_internal",
"sdformat_internal",
Expand Down
5 changes: 5 additions & 0 deletions tools/workspace/default.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ load("@drake//tools/workspace/org_apache_xmlgraphics_commons:repository.bzl", "o
load("@drake//tools/workspace/osqp_internal:repository.bzl", "osqp_internal_repository") # noqa
load("@drake//tools/workspace/petsc:repository.bzl", "petsc_repository")
load("@drake//tools/workspace/picosha2:repository.bzl", "picosha2_repository")
load("@drake//tools/workspace/picosha2_internal:repository.bzl", "picosha2_internal_repository") # noqa
load("@drake//tools/workspace/platforms:repository.bzl", "platforms_repository") # noqa
load("@drake//tools/workspace/pybind11:repository.bzl", "pybind11_repository")
load("@drake//tools/workspace/pycodestyle:repository.bzl", "pycodestyle_repository") # noqa
Expand Down Expand Up @@ -247,7 +248,11 @@ def add_default_repositories(excludes = [], mirrors = DEFAULT_MIRRORS):
if "petsc" not in excludes:
petsc_repository(name = "petsc", mirrors = mirrors)
if "picosha2" not in excludes:
# The @picosha2 external is deprecated in Drake's WORKSPACE and will
# be removed on or after 2023-11-01.
picosha2_repository(name = "picosha2", mirrors = mirrors)
if "picosha2_internal" not in excludes:
picosha2_internal_repository(name = "picosha2_internal", mirrors = mirrors) # noqa
if "platforms" not in excludes:
platforms_repository(name = "platforms", mirrors = mirrors)
if "pybind11" not in excludes:
Expand Down
1 change: 1 addition & 0 deletions tools/workspace/picosha2/package.BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ cc_library(
name = "picosha2",
hdrs = ["picosha2.h"],
includes = ["."],
deprecation = "DRAKE DEPRECATED: The @picosha2 external is deprecated in Drake's WORKSPACE and will be removed on or after 2023-11-01.", # noqa
)
3 changes: 3 additions & 0 deletions tools/workspace/picosha2/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ load("@drake//tools/workspace:github.bzl", "github_archive")
def picosha2_repository(
name,
mirrors = None):
"""The @picosha2 external is deprecated in Drake's WORKSPACE and will be
removed on or after 2023-11-01.
"""
github_archive(
name = name,
repository = "okdshin/PicoSHA2",
Expand Down
3 changes: 3 additions & 0 deletions tools/workspace/picosha2_internal/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
load("//tools/lint:lint.bzl", "add_lint_tests")

add_lint_tests()
23 changes: 23 additions & 0 deletions tools/workspace/picosha2_internal/package.BUILD.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# -*- bazel -*-

load(
"@drake//tools/install:install.bzl",
"install",
)

licenses(["notice"]) # MIT

package(
default_visibility = ["//visibility:public"],
)

cc_library(
name = "picosha2",
hdrs = ["picosha2.h"],
includes = ["."],
)

install(
name = "install",
docs = ["LICENSE"],
)
18 changes: 18 additions & 0 deletions tools/workspace/picosha2_internal/patches/vendor.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Adds a hidden drake_vendor namespace for ODR safety

--- picosha2.h
+++ picosha2.h
@@ -36,6 +36,7 @@
#include <sstream>
#include <vector>
#include <fstream>
+inline namespace drake_vendor __attribute__ ((visibility ("hidden"))) {
namespace picosha2 {
typedef unsigned long word_t;
typedef unsigned char byte_t;
@@ -374,4 +375,5 @@

}
}// namespace picosha2
+}// namespace drake_vendor
#endif // PICOSHA2_H
16 changes: 16 additions & 0 deletions tools/workspace/picosha2_internal/repository.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
load("@drake//tools/workspace:github.bzl", "github_archive")

def picosha2_internal_repository(
name,
mirrors = None):
github_archive(
name = name,
repository = "okdshin/PicoSHA2",
commit = "27fcf6979298949e8a462e16d09a0351c18fcaf2",
sha256 = "18d82bb79c021ccf4ce58125b64691accef54237ba5194462740bacf8b39d8a9", # noqa
build_file = ":package.BUILD.bazel",
patches = [
":patches/vendor.patch",
],
mirrors = mirrors,
)